Skip to content

Instantly share code, notes, and snippets.

@Jamp
Created May 20, 2019 18:00
Show Gist options
  • Save Jamp/08fda08700109fedc59dce80c239f32d to your computer and use it in GitHub Desktop.
Save Jamp/08fda08700109fedc59dce80c239f32d to your computer and use it in GitHub Desktop.
Systemd config for NodeJS App
[Unit]
Description=Application NodeJS
# Requires the mysql service to run first
Requires=After=mysql.service
[Service]
ExecStart=/usr/bin/node /app/main.js
# Required on some systems
WorkingDirectory=/app
Restart=always
# Restart service after 10 seconds if node service crashes
RestartSec=10
# Output to syslog
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=nodejs-app
Environment=NODE_ENV=production PORT=3000
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment