7 Simple steps to deploy your first grails app in Heroku server.

  • Step 1) Install Git
  • Step 2) Create account in Heroku
  • Step 3) Install Heroku Toolbelt

    wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh

    Below code taken from here

    mkdir ~/heroku-debs
    cd ~/heroku-debs wget http://toolbelt.heroku.com/ubuntu/foreman-0.60.0.deb
    wget http://toolbelt.heroku.com/ubuntu/heroku-toolbelt-2.34.0.deb
    wget http://toolbelt.heroku.com/ubuntu/heroku-2.34.0.deb
    sudo dpkg -i *.deb
    sudo apt-get update && sudo apt-get -f install
    heroku login

    enter your heroku authentication details

  • Step 4) Create new grails app

    grails create-app herokuApp
    cd herokuApp
  • Step 5) Create new git repository on your git account
  • Step 6) Initialize your git repository

    git init
    git remote add origin git_remote_url
    git commit -m "message"
    git push
  • Step 7) Initialize your heroku server instance

    heroku create
    git remote -v
    git push heroku master

    You can see these details in your screen

    Fetching repository, done.
    Counting objects: 9, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (4/4), done.
    Writing objects: 100% (5/5), 544 bytes, done.
    Total 5 (delta 1), reused 0 (delta 0)
    -----> Grails app detected
    -----> Grails 2.2.3 app detected
    WARNING: The Grails buildpack is currently in Beta.
    -----> Installing OpenJDK 1.6...done
    -----> Executing grails -Divy.default.ivy.user.dir=/app/tmp/cache compile --non-interactive
    | Loading Grails 2.2.3
    | Configuring classpath
    Procfile declares types  -> (none)
    Default types for Grails -> web
    -----> Compressing... done, 83.8MB
    -----> Launching... done, v23
    http://still-cliffs-9238.herokuapp.com deployed to Heroku

Note : you can see sever logs as well

sudo heroku logs --tail

Example server logs

heroku[slug-compiler]: Slug compilation finished
heroku[web.1]: State changed from down to starting
heroku[web.1]: Starting process with command <code>java -Xmx384m -Xss512k -XX:+UseCompressedOops -jar server/webapp-runner.jar $RUNNER_OPTS --port 43849 target/*.war</code>
app[web.1]: Picked up JAVA_TOOL_OPTIONS:  -Djava.rmi.server.useCodebaseOnly=true
app[web.1]: Adding Context  for target/myHeroKuApp-0.1.war
org.apache.coyote.AbstractProtocol init
app[web.1]: INFO: Initializing ProtocolHandler [&quot;http-nio-43849&quot;]
app[web.1]: Jan 13, 2014 11:56:52 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
app[web.1]: INFO: Using a shared selector for servlet write/read
org.apache.catalina.core.StandardService startInternal
app[web.1]: INFO: Starting service Tomcat
app[web.1]: Jan 13, 2014 11:56:52 AM org.apache.catalina.core.StandardEngine startInternal
app[web.1]: INFO: Starting Servlet Engine: Apache Tomcat/7.0.40
heroku[web.1]: State changed from starting to up

So by these seven simple steps you can easily configure Git and Heroku, and deploy your first Grails app on Heroku server.