Skip to content

Instantly share code, notes, and snippets.

@phund
Last active June 19, 2017 20:38
Show Gist options
  • Save phund/e8f4ec616acf6f3a18021d8b0cb21b73 to your computer and use it in GitHub Desktop.
Save phund/e8f4ec616acf6f3a18021d8b0cb21b73 to your computer and use it in GitHub Desktop.
Deploy meteor app to heroku
1. Install heroku
reference: https://toolbelt.heroku.com
wget -O- https://toolbelt.heroku.com/install-ubuntu.sh | sh
2. create a heroku app
heroku login
heroku apps:create foobar
3. Set a Meteor buildpack for your Heroku instance
reference: https://elements.heroku.com/search/buildpacks?q=meteor
heroku buildpacks:set https://github.com/AdmitHub/meteor-buildpack-horse.git
4. Create a new mLab instance (As of February 29, 2016, MongoLab has changed their name to mLab)
heroku addons:create mongolab:sandbox (sandbox: free tier)
5. Get your MongoLab URI
heroku config | grep MONGOLAB_URI
heroku config | grep MONGODB_URI
6. Set the configurations of your Meteor app running on Heroku
heroku config:add MONGO_URL=<MONGOLAB_URI value>
heroku config:add ROOT_URL=<APP_URL>
7. Check your remotes to ensure heroku is there
git remote -v
8. Deploy app
git push heroku master
git push heroku <branch>:master (<branch> is which needed to deploy)
Bonus:
1. Work around to redeploy without modifing
git commit --allow-empty -m "empty commit"
git push heroku master
2. Check log
heroku logs --tail
3. Multiple Heroku apps in one folder
// Add a suffix to Heroku commands
--app yourAppName
4. Using external MongoDB service
mongodb://<dbUser>:<dbPassword>@<service>.com:<port>/<databaseName>
developments:
MONGO_URL=mongodb://<dbUser>:<dbPassword>@<service>.com:<port>/<databaseName> meteor
// In server
process.env.MONGO_URL=mongodb://<dbUser>:<dbPassword>@<service>.com:<port>/<databaseName>
5. Use setiings.json
// For development
meteor --settings settings.json
// For Heroku
heroku config:add METEOR_SETTINGS="$(cat settings.json)"
// Please remember to .gitignore it if you're using a public repository
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment