EUC 2013 - Erlang in a *NIX World

15
ERLANG IN A *NIX WORLD How to get Erlang to Integrate With Your Environment Wednesday, June 12, 13

description

How to get Erlang to Integrate With Your Environment

Transcript of EUC 2013 - Erlang in a *NIX World

Page 1: EUC 2013 - Erlang in a *NIX World

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

Wednesday, June 12, 13

Page 2: EUC 2013 - Erlang in a *NIX World

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

Page 3: EUC 2013 - Erlang in a *NIX World

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

Page 4: EUC 2013 - Erlang in a *NIX World

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

Page 5: EUC 2013 - Erlang in a *NIX World

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

Page 6: EUC 2013 - Erlang in a *NIX World

Installing DependenciesInstall Gems -

gem install erlnixify

gem install fpm

Download the code

https://github.com/ericbmerritt/EUC2013

Wednesday, June 12, 13

Page 7: EUC 2013 - Erlang in a *NIX World

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

Page 8: EUC 2013 - Erlang in a *NIX World

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

Page 9: EUC 2013 - Erlang in a *NIX World

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

Page 10: EUC 2013 - Erlang in a *NIX World

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

Page 11: EUC 2013 - Erlang in a *NIX World

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

Page 12: EUC 2013 - Erlang in a *NIX World

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

Page 13: EUC 2013 - Erlang in a *NIX World

Taking Things a Step Further

Continuous Integration (Jenkins, etc)

Inotify - http://inotify.aiken.cz

Ansible, Puppet or Chef

Wednesday, June 12, 13

Page 14: EUC 2013 - Erlang in a *NIX World

August 30th - 31st

http://erlangcamp.com

Wednesday, June 12, 13

Page 15: EUC 2013 - Erlang in a *NIX World

October 11th - 12th

http://erlangcamp.com

Wednesday, June 12, 13