Deploying your application

On the Heroku website, under the Deploy tab, at the bottom, you will see the instructions to deploy your application. The first thing to do is install the Heroku CLI; follow this link (https://devcenter.heroku.com/articles/heroku-cli) and pick your operating system to install the Heroku CLI.

Once the CLI has been installed, go to IntelliJ and click on the Terminal tab located at the bottom of the window. IntelliJ will set the current path of the Terminal to the root path of the current project.

From inside the Terminal, log in to Heroku by using the following command:

heroku login

Type in your email address and password to log in.

If you are on macOS and are using Keychain Access to generate and save the password, for some reason, the password generated upon sign up is not saved on Keychain. If this is the case, just log out from the Heroku dashboard, and, on the login form, click on Forgot Password. You'll receive an email to change your password. On that page, you can use the password generation, and Keychain will remember it!

Once you have logged in, initialize Git with the following command:

git init

Then, you will need to add the Heroku reference to Git, as follows:

heroku git:remote -a shopping-fs

Replace shopping-fs with the application name that you picked previously.

You should see the following printed in your console:

set git remote heroku to https://git.heroku.com/shopping-fs.git

Let's add the file and commit it locally in Git, as follows:

git add . git commit -am 'Initial commit'

The final step is to deploy it with the following command:

git push heroku master

The deployment is executed on the Heroku server, and the log of the server is printed to your local console.

The process takes a little bit of time. Finally, you should see the following in the log:

..........
remote: -----> Launching... remote: Released v4 remote:https://shopping-fs.herokuapp.com/ deployed to Heroku remote:

That's it; your application has been compiled, packaged, and executed in the server.

Let's browse https://shopping-fs.herokuapp.com/ to confirm it. The following page should appear:

Congratulations! You have deployed your application on the internet. Notice that your application can be reached for free on a secure HTTP protocol, with valid certificates.

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

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