LAB 10 Deploy to Heroku - sindhusha-t/ASE-Lab-Assignments GitHub Wiki
Deploying to Heroku
Team Members: 6-1
Sindhusha Tiyyagura 24
Pradeepika Kolluru 12
Main Objective:
Is to deploy web application in Heroku.
Steps followed to deploy the web application in Heroku.
- Create an account and getting access to the Heroku web page.
- For command line access of Heroku cli downloaded and installed it from the website
"https://devcenter.heroku.com/articles/heroku-cli#download-and-install". - Checking the existence of heroku by opening Git Bash and executing
heroku -v
. - One can create an application in Heroku either using the command
heroku create app_name
or can create in the heroku website. - To setup the project correctly with the build and execution information which is necessary for the Heroku aplication.
- So as the project is NodeJS and ExpressJS, we have created procfile specifying the web buildpack and the command to run by the heroku.
- Package.json file also contains the information about the engine versions of node and npm and also specifies which js file start/execute with.
- Next we have set the GIT remote repository in heroku using the command
heroku git:remote -a app_name
- I have initiated the git repository and versionised the files using the sequence of below commands.
git init
git add .
git commit
- Next we have deployed the files to the heroku using the following command.
git push heroku master
- The above command gives the link of the application deployed in heroku and can execute the code using the mentioned link.
- Initially we faced an error while running the web application in heroku. So we checked the heroku logs to find out the issue using the command
heroku logs
- There is an issue with the port that is assigned in the localhost by the heroku. So, I have replaced the port number 3000 to process.env.PORT ( default port used by heroku).
- And then deployed the changes back to the heroku.
- It worked perfectly fine now. Here are the screenshots for the execution of web application in heroku.
Credentials:
Conclusion:
We have learnt how to deploy an application in heroku.