2
1
I am trying to export a simple Ruby app using foreman. Based on its usage for systemd, I appear to be doing things correctly.
However, when I start the target/service, I get status messages along the lines of this:
systemd[1]: Starting app-web-1.service...
systemd[1]: Started app-web-1.service.
systemd[1]: Service app-web-1.service is not needed anymore. Stopping.
systemd[1]: Stopping app-web-1.service...
systemd[1]: Stopped app-web-1.service.
The process begins, then ends. I have no idea why this is happening.
Granted, I am not an expert in systemd. This is my first time dealing with service scripts so I am not sure if there is something in the generated files that is causing this.
When exporting through foreman, a few target and service files are created. Thus, there are a few I have to deal with.
Here are the contents of app.target:
[Unit]
StopWhenUnneeded=true
Wants=app-web.target
[Install]
WantedBy=multi-user.target
And the contents of app-web-1.target:
[Unit]
StopWhenUnneeded=true
Wants=app-web-1.service
Finally, app-web-1.service:
[Unit]
StopWhenUnneeded=true
[Service]
User=deployer
WorkingDirectory=/home/deployer/app/releases/20141202043054
Environment=PORT=5000
ExecStart=/bin/bash -lc 'bundle exec puma -p 5000 '
Restart=always
StandardInput=null
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=%n
KillMode=process
Obviously, StopWhenUnneeded
is part of the problem, but I am not sure what this is supposed to do in context of starting a web server within my app.
Can anyone help me figure how to get the server running and permanent?