This article will tell the way to deploy the Meilix Generator on Heroku with the help of Travis. A successful deployment will help as a test for a good PR. Later in the article, we’ll see the one-button deployment on Heroku.
We will here deploy Meilix Generator on Heroku. The way to deploy the project on Heroku is that one should connect its Github account and deploy it on Heroku. The problem arises when one wants to deploy the project on each and every commit. This will help to test that the commits are passing or not. Here we will see that how to use Travis to deploy on Heroku on each and every commit. If the Travis test passed which means that the changes made in the commit are implemented.
We used the same idea to test the commits for Meilix Generator.
Idea behind it
Travis (.travis.yml) will be helpful to us to achieve this. We will use this deploy build to Heroku on each commit. If it gets successfully deployed then it proves that the commit made is working.
How to implement it
I will use Meilix Generator repository to tell the way to implement this. It is as simple as editing the .travis.yml file. We just have to add few lines to .travis.yml and hence it will get deployed.
secure: "YOUR ENCRYPTED API KEY" # explained below
app: meilix-generator # write the name of the app
repo: fossasia/meilix-generator # repo name
branch: master # branch name
Way to generate the api key:
This is really a matter of concern since if this gets wrong then the deployment will not occur.
- cd into the repository which you want to deploy on Heroku.
- Login Heroku CI and Travis CI into your terminal and type the following.
travis encrypt $(heroku auth:token) --add deploy.api_key
This will automatically provide the key inside the .travis.yml file.
You can also configure manually using
That it, you are done, test the build.
Things are still left:
But we are still left with the test of the PR.
For this we have to create a new app.json file as:
"description": "A webapp which generates iso for you",
"url": "heroku/python" # this is the only place of concern
This code should be put in a file in the root of the repo with the name as app.json.
In the buildpacks : the url should be the one which contains the code base language used.
This can be helpful in 2 ways:
- Test the commit made and deploy it on Heroku
2. One-click deployment button which will deploy the app on Heroku
- Test the deployment through the URL:
How can this idea be helpful to a developer
A developer can use this to deploy its app on Heroku and test the commit automatically and view the quality and status of PR too.
Useful repositories and link which uses this:
I have used the same idea in my project. Do have a look:
deployment on Heroku
app.json file schema