Skip to content

Instantly share code, notes, and snippets.

@Voronchuk
Created October 8, 2014 20:51
Show Gist options
  • Save Voronchuk/04be8d7fc0f9c5045458 to your computer and use it in GitHub Desktop.
Save Voronchuk/04be8d7fc0f9c5045458 to your computer and use it in GitHub Desktop.
Shell script to start bundled Meteor.js application on Ubuntu
# This file can be used manually to start Meteor Node.js server, but it's also used by /etc/init/starbuildr.com daemon
export METEOR_PROJECT=starbuildr.com
export METEOR_DB_NAME=starbuildr_com
export METEOR_PROJECT_DIR=/home/web/starbuildr
export PORT=8090
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
# set to home directory of the user Meteor will be running as
export PWD=/home/web
export HOME=/home/web
# this allows Meteor to figure out correct IP address of visitors
# export HTTP_FORWARDED_COUNT=1
# MongoDB connection string using todos as database name
export MONGO_URL="mongodb://localhost:27017/$METEOR_DB_NAME"
# The domain name as configured previously as server_name in nginx
export ROOT_URL="http://$METEOR_PROJECT"
# optional JSON config - the contents of file specified by passing "--settings" parameter to meteor command in development mode
export METEOR_SETTINGS=$(cat "$METEOR_PROJECT_DIR/settings.json")
# this is optional: http://docs.meteor.com/#email
# commented out will default to no email being sent
# you must register with MailGun to have a username and password there
# export MAIL_URL=smtp://voronchuk:password@smtp.sendgrid.net
# alternatively install "apt-get install default-mta" and uncomment:
export MAIL_URL=smtp://localhost
# exec node "$METEOR_PROJECT_DIR/bundle/main.js" >> "$METEOR_PROJECT_DIR/$METEOR_PROJECT.log"
exec forever start "$METEOR_PROJECT_DIR/bundle/main.js"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment