Skip to content
Andy Coenen edited this page Feb 3, 2015 · 1 revision

Jaunt Build & Deployment

Jaunt is a node express server, deployed on Heroku, utilizing a mongoLab hosted mongoDB. Jaunt uses an Ionic framework for a mobile-first front-end.

Local Deployment

Jaunt is built locally using gulp. To install gulp, npm modules, and bower components, use:

npm install
bower install

After installing dependencies, set up the environment variables necessary for the app by creating a file called '.env'. This file should contain a few variable declarations:

NODE_ENV=localTest
MONGOLAB_URI=mongodb://<dbuser>:<dbpassword>@ds031611.mongolab.com:31611/heroku_app33432931

There are three possible values of NODE_ENV - production, localTest, and local. 'production' is the value of NODE_ENV on the deployed application server, and tells the app to look for mongoDB at the mongoLab URL. 'localTest' also tells the app to look for mongoDB at the mongoLab URL, and is used for connecting a local instance of the app to the real database. 'local' teslls the app to look for mongoDB on the local host - ideal for testing the application in a completely local environment.

The MONOGLOLAB_URI variable is the URL of the mongoLab DB that the application connects to. You can find the username and password for the variable in the mongoLab account, or in the Application Keys document (NOT hosted in the project). Be VERY careful with this and any sensitive information - even one reference to it in any committed code will require cleaning up the commit of the references and creating new database credentials. DON'T DO IT!

The Jaunt Maker utility is integrated with Yelp. In order to utilize the Yelp functionality, four Yelp API keys must also be set in the .env file.

YELP_CONSUMER_KEY=<REPLACE WITH PROPER KEY>
YELP_CONSUMER_SECRET=<REPLACE WITH PROPER KEY>
YELP_TOKEN=<REPLACE WITH PROPER KEY>
YELP_SECRET=<REPLACE WITH PROPER KEY>

The Jaunt server is run locally using foreman - this simulates the environment variables on the heroku deployment server by reading our .env file and running a task described in the Procfile ('local' for a local deployment). To run Jaunt, first install foreman globally, the easiest way being to install the Heroku toolkit.

Once these variables are set and the heroku tools are installed, run gulp!

gulp

The gulpfile will compile the client code and run the server, automatically refreshing when anything changes!

Remote Deployment

Jaunt is deployed on Heroku at gojaunt.herokuapp.com. To begin deployment to Heroku, Heroku toolkit must first be installed. After cloning the repo, login to heroku using:

heroku login

with your credentials for the gojaunt heroku account. In order to deploy to heroku, you need to initialize a git remote pointing to heroku:

heroku git:remote -a gojaunt

Now you can deploy the code to heroku:

git push heroku master

Heroku will install all dependencies listed in package.json and run the Procfile. The keyword 'web' is special - it tells heroku what command to execute once all dependencies are installed and any additional scripts are executed. In the case of our server, our Procfile is simply:

web: node index.js

The environment variables for the jaunt application are already configured on heroku. To view these environment variables, use:

heroku config