Tuesday, January 03, 2012

How to make release without erts

Erlang OTP has very interesting thing like release. You can upgrade or downgrade your application in real-time. Release contains erts. It means that your release will contain erlang package. If you builds release with ubuntu 10.10/64bit then you cannot use release in archlinux/32bit because of binary incompatibility. Sometimes it's a big problem. I have found way to remove that disadvantages. I modified standard node startup script and created makefile to make package archive. The example you can find in my github project (https://github.com/sinnus/erlang_without_erts_example). Folder release contains bin and etc sub-folders. "bin" sub-folder contains startup scripts (node and nodetool), "etc" sub-folder contains standard  configuration for prod and dev environments (app.config and vm.vargs). Take a look at node shell script. You should replace ERTS_PATH on your real erts path and STARTUP_MODULE on your startup module like https://github.com/sinnus/erlang_without_erts_example/blob/master/src/start_mod.erl. To build package you should run "make package_dev" for dev environment. The package will be in root project folder (example-prod.tar.gz). To run application you should extract package (or use existed target folder) and execute from shell "node console" script. You also can see all available options if you run script without arguments (). There is no problem to run package on other operation system now. I haven't tested upgrade and downgrade release because it was not necessary for my project.

No comments: