I have always started nitrogen to run as a daemon using the command below:
sudo /home/someuser/myapp/bin/nitrogen start
It works well but i have to repeat the same activity should the server reboot.
Most web servers by default start at boot time. When nitrogen is started, it starts the underlying Erlang web server. Unfortunately I have not found any single resource talking about starting nitrogen at boot time.
How do you start nitrogen as a daemon at system boot time?
The easiest solution is to use the
/etc/rc.localfile. By default, it's empty.Since rc.local runs as root, you can use it as such (though if you prefer to run Nitrogen as a separate user, using
su -c "command" username) is good.Anyway, the simple solution is to add to your rc.local file the following:
To run as root:
To run as another user:
That will launch Nitrogen appropriately and will let you connect to the VM using
bin/nitrogen attach.My previous recommendation of using
sudois not sufficient, as it doesn't reset the environment to the user you want.I'm using this in production on Ubuntu 14.04 and a linode VPS.
I hope that helps.