On my server, I can start my rails application server (puma) and give my application a UNIX socket by cd'ing into the application's root directory and issuing the following command:
bundle exec puma -e production -b unix:///var/run/my_app.sock
Everything works great, expect that my terminal to the server is now useless:
Puma starting in single mode...
* Version 2.6.0, codename: Pantsuit Party
* Min threads: 0, max threads: 16
* Environment: production
* Listening on unix:///var/run/my_app.sock
Use Ctrl-C to stop
This may be majorly n00by but I literally don't know what to do here.
I can't CTRL-C, because that would stop puma.
I can't just close my terminal window because that too would stop puma.
Conundrum!
You can use the --daemon
option to make puma fork to the background. That way, it will free your terminal as soon as it ends the startup process.
To make the process exit afterwards, you need to send it the TERM
signal:
kill -TERM $PID
Where $PID
stands for puma's process id. The easiest way to get that on a server is to ask puma to save its pid on a file (a, suitably named, "pidfile"), using the --pidfile
option when starting it up.
For more options, check out puma's documentation and examples on github: https://github.com/puma/puma