Building OTP applications with Rake for EC2
Eric Cestari - cstar - January 23, 2009I uploaded a mashup of otherâs code this morning to github. Namely charpiâs Rakefile, used to build the Duke of Erlâs ec2nodefinder.
Rakefile
Itâs way more than a Rakefile, actually. Itâs a whole project organization.
Your OTP applications go into lib/, and you can have as many as you want in there.
Just typing rake will build the release files, doing all the chores (creating app files and rel files ⦠BORING !)
Here are all the defined tasks.
rake clean # Remove any temporary products.
rake clobber # Remove any generated file.
rake compile # Compile all project
rake dialyzer # Run dialyzer
rake edoc[name] # Buid Application documentation
rake edocs # Buid all application documentation
rake erlang_applications # Build application resource file
rake erlang_modules # Compile Erlang sources
rake erlang_release_files # Build erlang boot files
rake erlang_releases # Build release tarball
rake erlang_target_systems[n] # Build release tarball with erts
rake run[name,node] # Runs application
rake tests # Runs EUnit tests
rake upload # Sends release to S3 (presumably for deployment on EC2)
ec2nodefinder
In a nutshell, makes all erlang nodes in a single EC2 security group discover each other automatically.
Your applications on those instances can have processes joining pg2 groups, and you get scalability with very little efforts. However pg2 is quite crude in choosing a process as its only strategy is closest process or random.
ec2nodefinder is described here. Works well and very handy. I however would like to remove the dependency on ec2-describe-instances (which in turn requires a JRE on the deployment server). Itâs working as advertised but JVM startup slows down discovery.
AMIs
Check out Kevin Smithâs blog. He is building erlang centric AMI based on Eric Hammondâs Ubuntu AMIs
Next cool things Iâd like to do or see
Run OTP releases on <n> instances, with just one command :
ec2-run-instances ami-XXXXX -n <n> -d "release=<s3bucket>/<otp-release>"
It wonât be that easy, because the AMIs will need credentials to access S3 (and EC2 admin commands)
Actually thatâs my 10⬠question. Where are AWS credentials best stored ?
- have the cert / private key on S3 and pass the S3 AWSACCESS* values as parameters :
ec2-run-instances ami-XXXXX -n <n> -d "release=<s3bucket>/<otp-release>&AWS_ACCESS_KEY=XXXXX&AWS_SECRET_ACCESS_KEY=XXXX++XXXX"
- pass everything in a tar.gz (
-fflag of ec2-run-instances)
Not decided yet.
relup, appup ⦠hot code upgrade
No rake magic yet for those. Watch this space or charpiâs !
Code
Categories: Blogs Eric Cestari
Comments
Hi, I have just written a module for finding available erlang node on EC2. The module uses amazon ec2 api via https.
http://github.com/stevenchan/ec2_node.erl/tree/master
Posted by Seven Chan on 29 Jan 2009 at 14:45
Add comment
Erlang on Twitter
» ingojaeckel (ingo jaeckel): Even more awesome, free Erlang resources http://t.co/blGINLJd
» DiTeam (Тимурка): @multybuq @ukhin руби хороший вариант :) можно даже без rails..попробуй erlang еще :)
» michelir5 (Micheli Gelatinous): @pharkmillups Still seeing it. I might just have to manually install it. The version of Erlang required by Riak is not current version in HB
» Angry_Lawyer (Tony Aldridge): @rvirding @saghul If Erlang kills you, does a supervisor automatically create a replacement of you?
» rvirding (Robert Virding): Softly I hope. RT @saghul: Slowly making progress… erlang is killing me.
» jsvd (João Duarte): RT @FrancescoC: Woot! RT @valdo404: Practical Erlang Programming at #QConLondon I want to go there
» saghul (Saúl Ibarra Corretgé): Slowly making progress… erlang is killing me.
» dlsspy (Dustin Sallings): @IbnFirnas heh. The erlang parts are still solid. The currently active alerting box is arm5, failed over from a pc that died one day.
» quercialwji2 (Quercia Quinn): @MikeSmooth_ABCs http://t.co/pPiIpTCx
» levicole (Levi Kennedy): @pharkmillups the homebrew version of erlang is the most recent version, and riak requires R14B I think.
Statistics
Number of aggregated posts: 10456
Number of comments: 1445
Most recent article: February 06, 2012
Latest comments
» simple smile on Scale means Skills: Very informative article. Pretty sure people would love to go to that place for shopping. Specially to those who are…
» simplesmile on 27 January 2012: Erlang Solutions embarks on an Erlang Embedded KTP: Your article will make the world better. Thanks again and good luck to you in your life. See you next time.simplesmile
» tandblekning easewhite on 08 February 2012: Erlang Express 3-day Course in San Francisco on 8 February: ncomprehensible to me now, but in general, the usefulness and significance is overwhelmingtandblekning easewhite