Skip to content

Instantly share code, notes, and snippets.

@tene
Created May 17, 2011 22:13
Show Gist options
  • Save tene/977533 to your computer and use it in GitHub Desktop.
Save tene/977533 to your computer and use it in GitHub Desktop.
instance-based upstart configuration
task
script
for port in $(seq 8080 8087) ; do
start platform-worker PORT=$port
done
end script
#!upstart
description "node.js server"
start on startup
stop on shutdown
respawn # restart when job dies
respawn limit 5 60 # give up restart after 5 respawns in 60 seconds
instance $PORT
script
export HOME="/imvu/platform/src"
export NODE_PATH="/imvu/platform/src"
touch /var/log/imvu.log
su platform-admin -c "/usr/bin/node /imvu/platform/src/server.js $PORT >> /tmp/imvu.log.$PORT 2>&1"
end script
# Example systemd equivalent for my own notes, because I was fucking around with it
[Unit]
Description=node.js server
[Service]
User=platform-admin
Environment=HOME=/imvu/platform/src HOME_PATH=/imvu/platform/src
ExecStart=/usr/bin/node /imvu/platform/src/server.js %i
StandardOutput=syslog
SyslogIdentifier=%p (%i)
Restart=always
# Install eight workers by default on service enable
[Install]
[email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment