Deploying Meteor App to Heroku

Date Posted: November 9, 2016, 11:05 am


Follow the steps bellow to get this project running on Heroku for your personal testing.

Required softwares:

  1. Upload your project to Github.
  2. Clone github project to your computer.
    • $ git clone https://github.com/ACCOUNT_USERNAME/NAME_OF_PROJECT.git
  3. Navigate to the cloned folder.
    • In windows: $ cd meteor-app-todo-list
  4. $ heroko login
    • Fill up credentials
    • If you do not have an account yet, you can register for one at http:/heroku.com
  5. $ heroku apps:create NAME_OF_PROJECT
    • Creates the project depending on the name provided.
  6. Set Buildpack for Heroku Instance
    • $ heroku buildpacks:set https://github.com/AdmitHub/meteor-buildpack-horse.git
      • Meteor needs a buildpack in order to be executed by the Heroku dyno manager. As Heroku’s cedar stack has no default language/framework support, the buildpack determines the framework for us. Unfortunately, Heroku does not have official Meteor support. To get around this, we will use a third-party custom buildpack.
  7. Create a new mongodb instance
    • $ heroku addons:create mongolab:sandbox
  8. Add Environment Variables in heroku:
    • $ heroku config:add MONGO_URL=<MONGODB_URI value>
      • You can get MONGO_URL by running: $ heroku config
    • $ heroku config:add ROOT_URL=https://NAME_OF_PROJECT.herokuapp.com
  9. Check if we can push to heroku:
    • $ git remote -v
      • Should give you a list of git URLS (github and heroku github).
      • if heroku link is not in the list, you can manually add it like this:
        • $ git remote add heroku https://git.heroku.com/NAME_OF_PROJECT.git
  10. Deploy our code:
    • $ git push heroku master

Optional

  • Deploy app to your mobile device using Heroku project URL as server:
    $ meteor run android-device –mobile-server https://YOU_HEROKU_APP_SLUG.herokuapp.com/

About author


Carl Victor Fontanos

A fine gentleman specializing in front-end and back-end development with extensive experience building high performance web applications that keeps users engaged and help businesses grow.

 
Hire Me