Hands-on deployment

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.

Tip

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:

  1. Open the project and add a new file in the root folder named .shippable.yml.
  2. Paste the following code and save the file:
    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.

  3. Create a new file called 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.

Tip

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.

Checking the build process

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:

Checking the build process

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:

Checking the build process

Checking the application in production

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.205.99