Let's begin by describing Heroku. Heroku is a cloud application platform a new way of building and deploying web applications,applications (www.heroku.com).
This guide provides the steps required for creating a Heroku account, instaling Heroku Toolbelt, configuration configuring and last deployment finally deploying in the Heroku environment.
Create a Heroku account
- Go to www.heroku.com and hit sign up button, add your credentials and hit Create Free Account.
Go to your dashboard to start creating the application environment.
Installing Heroku toolbelt
...
- Go to https://toolbelt.heroku.com
- Hit the download button for you OS.
Once you have created your Heroku account you give your credentials after typing in the command line
Code Block language text $ heroku login
...
Install the
...
heroku-deploy plugin
This project is a Heroku toolbelt plugin for deploying WAR files. It can also be used to deploy executable JAR files.
Using the Heroku toolbelt you can write in the command line:
Code Block language text $ heroku plugins:install https://github.com/heroku/heroku-deploy
- 2.
Check if the heroku-deploy plugin is installed by typing in the command line
Code Block language bash $ heroku plugins
And if everything is ok you will see:
Code Block language bash === Installed Plugins
heroku-deploy
Creating a Heroku application
- Create a folder for example termweb-heroku in your local drive.
- Go to the command line and navigate to the created folder from the previous step
When you are in the targeted folder type in the command line
Code Block language text $ heroku create
You have now created a Dyno, your virtual environment ready for deploying your application. A random name will be assigned by Heroku, for example obscure-peak-95997
Deploying the
...
war file to Heroku
- In the folder you have created for your app in this case termweb-heroku you must have the following files: 1. .WAR file 2.Procfile.
- Procfile creation details go to: https://devcenter.heroku.com/articles/procfile
As soon as all the required files are in the folder enter the command so as to deploy your code in Heroku:
name>Code Block language text $ heroku deploy:war --war <your war file> --app <your heroku app
name>
...
After the deployment you can now open your application in the browser by typing:
...
Code Block language text $ heroku open --app <your heroku app name>
Database creation
You can go to your Heroku dashboard (https://dashboard.heroku.com/apps), choose your dyno and then go to Add-ons and add Heroku Postgress database, or again by giving the command in the command line:
Code Block | ||
---|---|---|
| ||
$ heroku addons:create heroku-postgresql --app <your heroku app name> |
Useful configuration commands
These are some configuration commands to display and/or configure Heroku regarding environmental variables and Java options, or just displaying info about the application--
Code Block | ||||
---|---|---|---|---|
|
...
$ heroku config --app <your heroku app name> |
...
Code Block | ||||
---|---|---|---|---|
| ||||
$ heroku run printenv --app <your heroku app name> |
...
Code Block | ||||
---|---|---|---|---|
|
...
$ heroku info --app <your heroku app name> |
...
Code Block | ||||
---|---|---|---|---|
|
...
$ heroku config:add JAVA_OPTS='-Xms128m -Xmx512m' --app <your heroku app name> |
...
Code Block | ||||
---|---|---|---|---|
| ||||
$ heroku restart --app <your heroku app name> |
Installation complete
Open your browser and enter https:/yourappname.herokuapp.com/. You should now see the TermWeb login screen. You can log in with client admin
, user admin
and password admin
.
...