Skip to content

Instantly share code, notes, and snippets.

@bastengao
Last active November 1, 2019 00:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bastengao/052caf4888400e342a5fd96a2bb93182 to your computer and use it in GitHub Desktop.
Save bastengao/052caf4888400e342a5fd96a2bb93182 to your computer and use it in GitHub Desktop.
passenger standalone systemd service

copy passenger-APP-NAME.service to /usr/lib/systemd/system/passenger-APP-NAME.service

Place Passengerfile.json to /var/www/APP-NAME/current

sudo systemctl daemon-reload
sudo systemctl start passenger-APP-NAME
sudo systemctl stop passenger-APP-NAME
# start passenger on system boot
sudo systemctl enable passenger-APP-NAME
[Unit]
Description=passenger-APP-NAME
After=network.target postgresql-12.service
[Service]
User=root
Group=root
PIDFile=/var/www/APP-NAME/current/tmp/pids/passenger.pid
Environment="RAILS_ENV=production"
# https://unix.stackexchange.com/questions/241752/symlink-as-workingdirectory-in-systemd-service
Environment="PWD=/var/www/APP-NAME/current"
WorkingDirectory=/var/www/APP-NAME/current
ExecStart=/usr/local/rvm/bin/rvm-exec ruby-2.6.5 bundle exec passenger start
ExecStop=/usr/local/rvm/bin/rvm-exec ruby-2.6.5 bundle exec passenger stop
[Install]
WantedBy=multi-user.target
{
"environment": "production",
"port": 3000,
"daemonize": true,
"pid_file": "tmp/pids/passenger.pid",
"log_file": "log/passenger.log"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment