Skip to content

Instantly share code, notes, and snippets.

@mostlyobvious
Last active March 14, 2016 08:15
Show Gist options
  • Save mostlyobvious/72f562e88d60255d79fb to your computer and use it in GitHub Desktop.
Save mostlyobvious/72f562e88d60255d79fb to your computer and use it in GitHub Desktop.
# Expectations:
#
# * application code in /srv/myapp/current
# * ruby runtime in /srv/myapp/.rubies/ruby-2.3.0
# * unicorn.rb config specifies pid file location to /srv/myapp/current/unicorn.pid and working directory to /srv/myapp/current
[Unit]
Description=Sample unicorn app
[Service]
User=myapp
WorkingDirectory=/srv/myapp/current
KillSignal=SIGQUIT
ExecStart=/srv/myapp/.rubies/ruby-2.3.0/bin/bundle exec unicorn -c /srv/myapp/current/unicorn.rb
ExecReload=/bin/kill -s USR2 $MAINPID ; /bin/sleep 1 ; /bin/kill -s QUIT $MAINPID
Environment=PATH=/srv/myapp/.rubies/ruby-2.3.0/bin:$PATH
Restart=on-abnormal
PIDFile=/srv/myapp/current/unicorn.pid
@KamilLelonek
Copy link

When does it start?

@mostlyobvious
Copy link
Author

On systemctl start or at boot time when systemctl enable issued previously. If it depends on something, that'd be nice to describe in unit file as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment