EUC 2013 - Erlang in a *NIX World

Post on 28-Nov-2014

522 views 2 download

description

How to get Erlang to Integrate With Your Environment

Transcript of EUC 2013 - Erlang in a *NIX World

ERLANG IN A *NIX WORLDHow to get Erlang to Integrate With Your Environment

Wednesday, June 12, 13

Meta GoalsMake it easy to integrate into a standard unix environment

Make it easy to integrate into a continuous deployment system

Remove the need for a custom tool chain for Erlang

Wednesday, June 12, 13

Goals

How to build releases with Relx

How to integrate those releases under your system management tools

How to build native packages (rpms, debs, etc for your releases)

Wednesday, June 12, 13

Tools We Will UseRelx - Release Building

http://relx.org

Erlnixify - Erlang Node Shim

http://erlware.github.io/erlnixify/

Fpm - Native Package Creation Tool

https://github.com/jordansissel/fpm

Wednesday, June 12, 13

Basic EnvironmentA Unix Environment (either in a VM or native on your laptop)

Erlang

Ruby 1.9.3 (yea, yea)

Git

Wednesday, June 12, 13

Installing DependenciesInstall Gems -

gem install erlnixify

gem install fpm

Download the code

https://github.com/ericbmerritt/EUC2013

Wednesday, June 12, 13

Relx - Creating A ReleaseA tool to build releases

Convention over configuration

Absolutely minimal configuration

Talk tomorrow that will go into more detail

Wednesday, June 12, 13

Relx - Creating A Release>relx Starting relx build process ...Resolving OTP Applications from directories: /Users/emerrit/workspace/EUC2013/echo_get/ebin /Users/emerrit/workspace/EUC2013/echo_get/deps /usr/local/Cellar/erlang/R16B/lib/erlang/lib

Resolving available releases from directories: /Users/emerrit/workspace/EUC2013/echo_get/ebin /Users/emerrit/workspace/EUC2013/echo_get/deps /usr/local/Cellar/erlang/R16B/lib/erlang/lib

Resolved echo_get-0.0.1release successfully created!

Wednesday, June 12, 13

Erlnixify - Running ReleaseA simple ruby app

Traps Unix Signals and propagates them to the running Release in an OTPish way

Monitors the running Release and crashes if the Release crashes

Wednesday, June 12, 13

FPM - Trivial Package BuildingCan build packages most platforms (rpms, debs)

Can build packages based an a directory layout

Can have before/after scripts etc

Wednesday, June 12, 13

Running FPM> relx> mkdir -p _dist/opt/echo_get> mkdir -p _dist/etc/init.d> cp -r _rel _dist/opt/echo_get> cp ./bin/ _dist/etc/init.d> cd _dist> fpm -s dir -t rpm -d esl-erlang -n echo_get -v 0.0.1 \ --rpm-rpmbuild-define '__prelink_undo_cmd %{nil}' \ ./

Wednesday, June 12, 13

Running FPM - Makefilerelease: compile @rm -rf $(DISTDIR) $(REL) @$(REBAR) skip_deps=true release rm -rf $(DISTDIR)/opt mkdir -p $(DISTDIR)/opt mkdir -p $(DISTDIR)/etc/init.d mkdir -p $(DISTDIR)/etc/apollo mkdir -p $(DISTDIR)/var/log/apollo cp -r rel $(DISTDIR)/opt/apollo cp -r $(CURDIR)/etc/* $(DISTDIR)/etc/

rpm: release $(eval $@_NAME := $(shell atbx print-git-vsn | cut -d "," -f 1)) $(eval $@_VSN := $(shell atbx print-git-vsn | cut -d "," -f 2)) cd $(DISTDIR); fpm -s dir -t rpm -d esl-erlang -n $($@_NAME) -v $($@_VSN) \ --before-remove ../bin/before-remove \ --rpm-rpmbuild-define '__prelink_undo_cmd %{nil}' \ ./

Wednesday, June 12, 13

Taking Things a Step Further

Continuous Integration (Jenkins, etc)

Inotify - http://inotify.aiken.cz

Ansible, Puppet or Chef

Wednesday, June 12, 13

August 30th - 31st

http://erlangcamp.com

Wednesday, June 12, 13

October 11th - 12th

http://erlangcamp.com

Wednesday, June 12, 13