Skip to content

Deploy to Heroku

wwitman edited this page Dec 22, 2015 · 2 revisions

Deploying a Zetta server to Heroku

  1. Click the Deploy to Heroku button on the bottom of the Zetta Cloud Starter GitHub repository.

  2. Heroku will prompt you to setup a new Heroku account or log in with your existing account.

  3. Pick an app name, like myherokuname-zetta.

You will now have a Zetta server instance running in the cloud.

Link Zetta servers together

Linking Zetta servers together requires one line of code.

  1. In the server.js file that runs on your geo-distributed hub add the link() function to the zetta config:

    .link('http://myherokuname-zetta.herokuapp.com/')

  2. Below is an example server.js file that inludes linking to a Zetta server running on Heroku.

    var zetta = require('zetta');
    var LED = require('zetta-led-mock-driver');
    var Photocell = require('zetta-photocell-mock-driver');
    
    var duskToDawnLight = require('./apps/dusk_to_dawn_light');
    
    zetta()
    .use(LED)
    .use(Photocell)
    .use(duskToDawnLight)
    .link('http://myherokuname-zetta.herokuapp.com/')
    .listen(1337, function(){
      console.log('Zetta is running at http://127.0.0.1:1337');
    });
Clone this wiki locally