Easy way to run Vertx 2.0 on Heroku hosting

465 views
Skip to first unread message

Maksym Mikheienko

unread,
Jun 2, 2013, 5:39:12 AM6/2/13
to ve...@googlegroups.com
With this approach we start vertx using maven plugin mvn vertx:runmod on heroku. Here's java example:
  1. Create maven-based project as described in the nice article: https://github.com/vert-x/vert.x/wiki/Vert.x-2.0---Developing-Vert.x-with-Maven
  2. Make your Verticle start listening port suggested by heroku environment. This is not working sample, just an example how to get port from heroku environment.
    public class ServerExample extends Verticle {
     public void start() {
        vertx.createHttpServer().listen(Integer.valueOf(container.env().get("PORT")), "0.0.0.0");
      }
    }

  3. Init git repo
    git init
  4. Create heroku app with custom buildpack. By default maven is present during compile time only, so we need to copy it to the live file system. This is done in custom build pack and it's vertx independent.
    $ heroku create myapp --buildpack https://github.com/maksym-mikheienko/heroku-buildpack-java-maven.git
  5. Create 'system.properties' file with the content:
    java.runtime.version=1.7

  6. Create 'Procfile' file with the content:
    web:    .maven/bin/mvn vertx:runmod

  7. Now you're ready to push your app to heroku
    $ git add .
    $ git commit -m "my first commit"
    $ git push heroku master
    

Maksym Mikheienko

unread,
Jun 14, 2013, 1:02:17 PM6/14/13
to ve...@googlegroups.com
Update:
Create maven-based project as described in the nice article: 
https://github.com/vert-x/vertx-maven/tree/master/archetype
Reply all
Reply to author
Forward
0 new messages