Statement : The sole purpose of this post is to learn how to host your application to the Internet so that anyone can access it across the world.
- Sign up for the heroku account.
- Download heroku cli to host you application from your local terminal.
- Login to your account by using id and password through terminal by using below command –
- Create a new repo on your github account.
- Now clone your repo on your local machine using the below command –
git clone https://github.com/guptakumartanuj/Cryptocurrency-Concierge.git
- It’s time to develop your application. Once it is done, push your whole code to your github repo by using below commands –
- tangupta-mbp:Cryptocurrency-Concierge tangupta$ git add .
- tangupta-mbp:Cryptocurrency-Concierge tangupta$ git commit -m “First commit of cryptocurrency Concierge””
- tangupta-mbp:Cryptocurrency-Concierge tangupta$ git push
- Now you are ready to crate a heroku app. Use the below command for the same –
cd ~/workingDir $ heroku create Creating app... done, ⬢ any-random-name https://any-random-name.herokuapp.com/ | https://git.heroku.com/any-random-name.git
- Now commit you application to heroku using the below command –
tangupta-mbp:Cryptocurrency-Concierge tangupta$ git push heroku master
- It’s time to access your hosted application using the above highlighted url. But most probably you won’t be able to access the same. Make sure one instance of your hosted application is running. Use the below command to do the same –
heroku ps:scale web=1
- In case, you are getting the below error while running the above command, then you need to make one file name Procfile with no extension and add the same to git repo. Then you need to push the repo to heroku again.
Scaling dynos… !
▸ Couldn’t find that process type.
- In my case, to run my spring boot application, I have added the following command in the Procfile to run the application.
web: java $JAVA_OPTS -Dserver.port=$PORT -jar target/*.war
- Finally your application should be up and running. In case, you are facing any issues while pushing or running your application, you can check the heroku logs which will help you to troubleshoot the issue by using below commands-
heroku logs –tail
Enjoy coding and Happy Learning 🙂