devops

Pushing Your Meteor Project to Heroku

Meteor preparation

Go to your meteor project folder:

$ meteor bundle myproject.tar.gz
$ tar -xf myproject.tar.gz
$ cd bundle/

Reinstall fibers

$ cd programs/server
$ npm uninstall fibers
$ sudo npm install fibers
$ cd ../../

Heroku preparation

Node.js

Create package.json file. You can use example one or modify it for your needs:

{
  "name": "metoer-heorku-example",
  "version": "0.0.1",
  "engines": {
    "node": "0.10.x",
    "npm": "1.3.x"
  }
}

Procfile

Create Procfile file to provide launching instruction for heroku:

web: node main.js

Git preparation

$ git init
$ git add .
$ git commit -am "Init commit"

Heroku deployment

Create app

Make sure your local git repository exists on this stage. Heroku must add remote repository to your project.

$ heroku create
$ heroku addons:add mongohq:sandbox
  • Application will be created on this stage. Please notice that heroku will return URL for the application.
  • MongoDB will be also created. To get URL for your new db please run $ heroku config:get MONGOHQ_URL
  • To make sure that heroku added remote repository you can do git remote -v. Heroku should be defined.

Meteor environment on heroku

$ heroku config:add ROOT_URL=<your_application_url>
$ heroku config:add MONGO_URL=<your_application_mongo_url>
$ heroku config:add PORT=<your_application_port>
$ heroku config:add DISABLE_WEBSOCKETS=1
  • <your_application_url> - this value comes from step 'Create app'
  • <your_application_mongo_url> - this value comes from step 'Create app' / create mongo sandbox.
  • <your_application_port> - typicaly should be set to 80
  • DISABLE_WEBSOCKETS=1 - so far heroku cedar doesn't support native websockets

Push app

$ git push heroku master

Open in browser

$ heroku open

Maintenance

Start/Stop/Restart

$ heroku ps:stop web
$ heroku ps:start web
$ heroku ps:restart web

Scaling

$ heroku ps:scale web=1

Logs

$ heroku logs

Bash

$ heroku run bash

Have fun!

Comments

Related posts

Say hello to Chihuahua-VR box project

What is that? As you can find on my blog (tag: VR) I have been working for few weeks on the 3D/VR real-time platform for streaming and communication. The main goal is to find the cutting edge technology which would allow…

Pushing Your Meteor Project to Heroku

Meteor preparation Go to your meteor project folder: $ meteor bundle myproject.tar.gz $ tar -xf myproject.tar.gz $ cd bundle/ Reinstall fibers $ cd programs/server $ npm uninstall fibers $ sudo npm install fibers $ cd ../../ Heroku preparation Node.js Create package.json file.

Migration to Heroku App Cloud with UptimeRobot monitoring

After few hours of playing with Heroku and UptimeRobot I decided to move my blog (WordPress) and website (PHP) to new hosting cloud. So now it is running for free. Hopefully will be stable... Useful resources: https://github.com/mhoofman/wordpress-heroku https://github.com/mchung/heroku-buildpack-wordpress https://wordpress.org/plugins/wp-s3/