[erlang-questions] (no subject)

Valery Tikhonov valerii.tikhonov@REDACTED
Tue May 8 13:54:19 CEST 2018


> Hey everyone,
>
>
>
>
> I’ve recently built a few applications that handle high volume message
passing and all communicate with each other using Erlang’s ssl
distribution. I’m working on deploying these to multiple servers - right
now I am just using rebar3 release and creating a zipped tar of the release
directory, moving it to a new box, and changing the some vm.args and
sys.config options on the new machines. This doesn’t seem totally intuitive
though… it take far longer than I feel like it should.
>
>
>
>
> I’ve read about Docker and Kubernetes, and those seem promising, but our
IT guys aren’t ready to move to containers and are using static nodes right
now.
>
>
>
>
> So, what is the best way to quickly distribute your erlang binaries and
configure the enviornment? Have a quick script to do it automatically? Is
the answer just containerize with Docker and wait a few months for the IT
team to catch up with it? Or is there some other option out there?
>
>
>
>
> Thanks for your help!

Please take a look at Enot (https://github.com/comtihon/enot), this is
actually I've created it for.
It can help you with both deployment and environment variables handling.

For deployment - just add install steps you perform to enot's config (here
is an example https://github.com/comtihon/example_service) and you will be
able to install and run it on another linux machine with `enot install
you/yourservice`. If your service is private (not open sourced) - you
should run your enot auto builder first, to store enot packages there (
https://github.com/comtihon/enot_auto_builder).

For templating - you can use environment variables in app.src, relx.conf or
vm.args:

{env, [
                {% if MAGIC_GREETING is defined %}
                  {greeting, "{{ MAGIC_GREETING }}"}
                {% else %}
                  {greeting, "hello world!" }
                {% endif %}
              ]}

or:

{% if app.git_branch == 'master' %}
            {log, info}
        {% else %}
            {log, debug}
        {% endif %}

or:

{% if hostname in prod_hosts %}
                {database, [
                        {host, "prod_db"},
                        {password, "super_secure_password"},
                        {pool_size, 400}
                ]}
        {% elif hostname in stage_hosts %}
                {database, [
                        {host, "staging_db"},
                        {password, "other_secure_password"},
                        {pool_size, 200}
                ]}

        {% else %}
                {database, [
                        {host, "dev_host"},
                        {password, "dev_password"},
                        {pool_size, 10}
                ]}

{% endif %}

Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180508/e039cea0/attachment.htm>


More information about the erlang-questions mailing list