Search code examples
elixiredeliverdistillery

edeliver with distillery: how to setup `start` command to use systemctl


I am deploying the Elixir project to remote using edeliver backed up by distillery.

I also successfully created the systemd.service file that starts, stops, restarts etc the release from the command line.

But the mix edeliver start production command seems to run the release bypassing systemd, by plain old good bin/my_app start shell command. What I want is to use systemd always, even with hot uploads, since it (unlike upstart) does provide reload functionality.

I can not find what and whom am I to tell to use systemd to [re]start the release. Should it be delivery strategy? Something else? I understand this question is not a good fit for SO, but I am just lost.

So: can I force edeliver over distillery to use systemd to start the release? If yes, how?


Solution

  • FWIW, I will post it here. I had overcome the issue with a nasty kludge. I have a release.sh script that contains few subsequent build, deploy and ping commands. So I did the following:

    # mix edeliver restart production
    
    for host in `cat .deliver/config | grep PRODUCTION_HOSTS | cut -d '=' -f 2 | sed -e 's/"//g'`
    do
      echo "Restarting the remote [$host]..."
      echo `ssh rates-injector@$host sudo systemctl restart rates_injector.service`
    done
    echo "Likely restarted."
    

    Basically, I manually issue the restart command for systemctl, getting production hosts list from the .deliver/config file.