-
Notifications
You must be signed in to change notification settings - Fork 703
Deploy to Heroku
The following documents how to setup and deploy uptime to (Heroku)[https://www.heroku.com/]. Some of these steps could be combined but are separated for clarity.
Create Heroku App
$ heroku apps:create heroku-uptime
Add MongoLab Add-on
$ heroku addons:add mongolab
Add WebSSocket Support
$ heroku labs:enable websockets
Add PaperTrail (Optional, but very handy for debugging)
$ heroku addons:add papertrail
Heroku creates the environment variable, MONGODB_URI but we are still forced to provide a username and password (see bootstrap.js). Set your config variables.
$ heroku config
=== heroku-uptime Config Vars
MONGOLAB_URI: mongodb://YourAwesomeUsername:YourAwesomePassword@subdomain.mongolab.com:51368/YourAwesomeUsername
$ heroku config:add MONGOLAB_USERNAME=YourAwesomeUsername MONGOLAB_PASSWORD=YourAwesomePassword
Setting config vars and restarting uptime-demo... done, v2
MONGOLAB_USERNAME: YourAwesomeUsername
MONGOLAB_PASSWORD: YourAwesomePassword
Set the environment for node-config
$ heroku config:add NODE_ENV=demo
Create the config/demo.js file. A .js file is used instead of a .yaml file so environment variables can be used. Remember, yhe name of this file needs to correspond to the name of the environment set in the previous step!
// demo.js
module.exports = {
mongodb: {
user: process.env.MONGOLAB_USERNAME,
password: process.env.MONGOLAB_PASSWORD,
connectionString: process.env.MONGOLAB_URI
},
monitor: {
apiUrl: process.env.UPTIME_API_URL
},
verbose: false
}
Push your repo to Heroku
$ git push heroku master
Navigate to your app, https://heroku-uptime.herokuapp.com. Note the use of the HTTPS endpoint.
You're now monitoring uptime in the cloud!