Skip to content

Deploying to Heroku

Pedro Felix edited this page May 29, 2016 · 1 revision

Deploying to Heroku:

  1. Create an Heroku free account. Heroku is an example of a Platform-as-a-Service (PaaS) provider.

  2. Follow the Getting Started with Java on Heroku instructions, with the following differences:

  • On the "Introduction" step, there is no need to install Maven 3. We will be using a Gradle based build process instead.

  • On the "Prepare the app" step, use the https://github.com/isel-leic-ls/1415-2-common repository, instead of the https://github.com/heroku/java-getting-started.

  • On the "Deploy the app" step,

    • Define an explicit name when creating the application on Heroku - e.g. heroku create s1516-2-LI41D-G00
    • The output of the git push heroku master command will be different, since we are using an alternative build process based on Gradle instead of on Maven.
  • On the "Define a Procfile" step, use the one already defined on the repository.

  1. Follow the Using a hosted SQL Server instructions, to setup an SQL Server in AppHarbor (another example of a PaaS provider). When you can successfully establish a connection to the SQL Server instance, using SQL Management Studio, return to the Heroku setup.

  2. Change source file HerokuFirstHttpServer.java to use StudentsServlet.

  3. StudentServlet uses three environment variable. Configure them at the provider, using the heroku config:set command. Use the values of Hostname, Username and Password, of the SQL Server instance, to define variables named dbserver, dbuser and dbpassword.

  4. Commit your local changes and push to the heroku remote. Test the new application.

Notes

  • The used build process is based on Gradle and not on Maven.

  • The Gradle build file uses the application plugin to create an installation.

  • The Procfile is using a shell script created by application installation.

Clone this wiki locally