Skip to content

Instantly share code, notes, and snippets.

@joseconstela
Last active June 29, 2016 10:43
Show Gist options
  • Save joseconstela/426bb262b135668726eb33f38b139eb5 to your computer and use it in GitHub Desktop.
Save joseconstela/426bb262b135668726eb33f38b139eb5 to your computer and use it in GitHub Desktop.
MeteorJS application upstart service config file example, as shown at http://joseconstela.com/nginx-config-files-for-production-ready-meteorjs-apps/
# upstart service file at /etc/init/meteorapp.conf
description "Meteor.js application"
author "Jose Constela <[email protected]>"
# When to start the service
start on started mongod and runlevel [2345]
# When to stop the service
stop on shutdown
# Automatically restart process if crashed
respawn
respawn limit 10 5
# drop root proviliges and switch to ubuntu user
setuid ubuntu
setgid ubuntu
script
export PATH=/opt/local/bin:/opt/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export NODE_PATH=/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript
export PWD=/home/ubuntu
export HOME=/home/ubuntu
export BIND_IP=127.0.0.1
export PORT=8081
export HTTP_FORWARDED_COUNT=1
export ROOT_URL=https://app.mymeteorapp.com
export SITE_URL=https://app.mymeteorapp.com
export MY_API_ENDPOINT='https://api.mymeteorapp.com'
export MAIL_URL="smtp://[email protected]:587"
export MONGO_URL=mongodb://localhost:27017/myDatabase
export REDIS_HOST=127.0.0.1
export AWSRegion='eu-west-1'
export AWSAccessKeyId=...
export AWSSecretAccessKey=...
export AWSS3Bucket='...-ireland'
export KADIRA_APP_ID=...
export KADIRA_APP_SECRET=...
METEOR_SETTINGS='{ "public": { "site_url": "https://app.mymeteorapp.com", "googleMapsKey": "...", "staticFilesUrl": "https://...-ireland.s3-eu-west-1.amazonaws.com" } }'
exec node /home/ubuntu/mymeteorapp/bundle/main.js >> /home/ubuntu/mymeteorapp.log
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment