Copying files to target system as part of release process

Hi folks. I’m moving one of my apps from Distillery to mix releases. One thing I’m not sure about, is there a “recommended” way to copy files to target (the web server), I’m talking about files that belong outside the Elixir release where the priv is not appropriate. Specifically, I have a SystemD unit/system file (/lib/systemd/system/my_app.service) I want to write to the Linux target system. In Distillery I had something like this:

set overlays: [
    {:template, "rel/etc/my_app.service", "etc/my_app.service"},

I was putting the unit file inside the release directory and then simlinking to it in a separate step. I guess I could put the unit file in priv then simlink to it.

Really appreciate any suggestions on this one.


It looks like the latest Elixir v1.10-rc adds support for overlays which was just committed a few days ago:

Otherwise you could use a tool such as ansible to automate copying arbitrary files/templates to the server along with the .tgz release file.

Oh nice, that’s great! I will see about going to 1.10. Reading the docs for that commit gave me another idea: It looks like in 1.9 the “recommended” way would be in the :steps of the release configuration as shown here:

1 Like