Since we're using the MEAN.JS generator, we have a file available in the application root folder named .travis.yml
. We can use it for the initial setup on Shippable; however, we will create a new file.
Travis is another tool for continuous integration in open source projects, which is directly integrated with GitHub. More information is available at http://docs.travis-ci.com/.
To create the file, follow these steps:
.shippable.yml
.language: node_jsnode_js: - "0.10" env: - NODE_ENV=travis services: - mongodb after_success:- git push [email protected]:<some name>.git master
The last command in this file, after_success
, receives the Git Heroku URL that was copied in step 7 of the Setting up a Heroku account section. After all the commands have run successfully, this line confirms the automatic deployment. However, one last action is required, that is, adding another file to the root folder.
Procfile
in the root project folder and type the following code in it:web: ./node_modules/.bin/forever -m 5 server.js
Procfile
determines which specific commands must be executed by your application dynos on the Heroku platform. These commands can vary for several types of processes such as: web, worker, urgentworker, and clock, among others.
You can find more about the Heroku process at https://devcenter.heroku.com/articles/procfile.
That's all, so let's commit and upload the changes to Git and push them to the GitHub repository.
In the Shippable dashboard, it is possible to view all the builds performed, and it is also possible to identify errors and monitor the entire process, as shown in the following screenshot:
We have a detailed log showing step by step the running process. It is possible to consult the log for each of the builds performed as shown in the following screenshot:
After completing all of these processes, the application will be available at http://<the name you give before>.herokuapp.com/
. Open your browser and visit the application in production. The example application can be found at http://conference-api.herokuapp.com.
18.191.205.99