Skip to content

Instantly share code, notes, and snippets.

@mtgrosser
Last active August 2, 2016 18:09
Show Gist options
  • Save mtgrosser/174c5a82dcafb23087c9 to your computer and use it in GitHub Desktop.
Save mtgrosser/174c5a82dcafb23087c9 to your computer and use it in GitHub Desktop.
Passenger standalone systemd unit file for hosting multiple apps
[Unit]
Description=Passenger Standalone Application Server
After=network.target
[Service]
Type=forking
PrivateTmp=yes
User=USERNAME
Group=GROUPNAME
WorkingDirectory=/apps/%i
#RuntimeDirectory=passenger
#RuntimeDirectoryMode=0755
PIDFile=/run/passenger/app.%i.pid
Environment="PATH=/opt/rubies/2.1.5/bin:/usr/local/bin:/usr/bin"
Environment="GEM_HOME=/opt/rubies/2.1.5/lib/ruby/gems/2.1.0"
Environment="GEM_PATH=/opt/rubies/2.1.5/lib/ruby/gems/2.1.0"
Environment="PASSENGER_ROOT=/opt/rubies/2.1.5/lib/ruby/gems/2.1.0/gems/passenger-5.0.0.beta1"
Environment="PASSENGER_INSTANCE_REGISTRY_DIR=/run/passenger"
EnvironmentFile=-/apps/%i/current/config/passenger.env
ExecStart=/usr/bin/bash -c 'exec ${PASSENGER_ROOT}/bin/passenger start current --daemonize --instance-registry-dir /run/passenger --socket /run/passenger/app.%i.sock --pid-file /run/passenger/app.%i.pid --log-file /apps/%i/shared/log/passenger.log --environment production $PASSENGER_OPTS'
ExecReload=/usr/bin/bash -c 'exec ${PASSENGER_ROOT}/bin/passenger-config restart-app /apps/%i'
ExecStop=/usr/bin/bash -c 'exec ${PASSENGER_ROOT}/bin/passenger stop --pid-file /run/passenger/app.%i.pid'
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment