Last active
March 24, 2021 07:34
-
-
Save AlexeyDemidov/77a2791ab75426bc7776d4bdc7c588b4 to your computer and use it in GitHub Desktop.
Unicorn service file for systemd with rvm support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# save this file in /etc/default/unicorn_app | |
USER=app_user | |
APP_ROOT=/srv/app | |
RVM_STRING=2.2.4@app_gemset | |
RACK_ENV=production | |
UNICORN_OPTS="-D -c /srv/app/shared/config/unicorn.rb -E production" | |
DAEMON=unicorn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
# You can create multiple unicorn service by linking [email protected] to [email protected], [email protected] | |
# each application reads its settings from /etc/default/unicorn_appone, /etc/default/unicorn_apptwo | |
Description=Unicorn serving %I app | |
After=syslog.target | |
[Service] | |
Restart=always | |
RestartSec=10 | |
Type=forking | |
WorkingDirectory=/srv/%I/current | |
EnvironmentFile=/etc/default/unicorn_%I | |
SyslogIdentifier=unicorn-%I | |
PIDFile=/srv/%I/shared/pids/unicorn.pid | |
KillMode=mixed | |
KillSignal=SIGQUIT | |
User=%I | |
ExecStart=/usr/local/rvm/bin/rvm-shell ${RVM_STRING} -c "bundle exec ${DAEMON} ${UNICORN_OPTS}" | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
zi