Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions heroku-gradle-example/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: java -Dserver.port=$PORT $JAVA_OPTS -jar build/libs/*.jar
21 changes: 21 additions & 0 deletions heroku-gradle-example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Vert.x Heroku Example

This project shows how to deploy a Vert.x 3 applications to Heroku. The same application can be deployed using 3 approaches:

you must to execute

heroku config:set GRADLE_TASK="shadowJar"

to configure task build.

## Git

Follow these steps to deploy with Git.

```sh-session
$ git clone https://github.com/vert-x3/vertx-examples
$ heroku create
$ heroku config:set GRADLE_TASK="shadowJar"
$ git push heroku master
```

42 changes: 42 additions & 0 deletions heroku-gradle-example/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
plugins {
id 'java'
id 'application'
id 'com.github.johnrengelman.shadow' version '1.2.3'
}

repositories {
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/iovertx-3750/"
}
}

version = '3.5.1'
sourceCompatibility = '1.8'
mainClassName = 'io.vertx.core.Launcher'
def mainVerticleName = 'io.vertx.example.HelloWorldVerticle'

dependencies {
compile "io.vertx:vertx-core:$version"
}

shadowJar {
classifier = 'fat'
manifest {
attributes 'Main-Verticle': 'io.vertx.example.HelloWorldVerticle'
}
mergeServiceFiles {
include 'META-INF/services/io.vertx.core.spi.VerticleFactory'
}
}

task copyToLib(type: Copy) {
into "$buildDir/lib"
from(configurations.compile)
}

copyToLib.dependsOn(shadowJar)

task wrapper(type: Wrapper) {
gradleVersion = '4.0'
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Sun Jun 18 19:03:02 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-bin.zip
172 changes: 172 additions & 0 deletions heroku-gradle-example/gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

84 changes: 84 additions & 0 deletions heroku-gradle-example/gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions heroku-gradle-example/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
if (!JavaVersion.current().java8Compatible) {
throw new IllegalStateException('''A Haiku:
| This needs Java 8,
| You are using something else,
| Refresh. Try again.'''.stripMargin())
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.vertx.example;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.Vertx;

/**
* @author <a href="http://tfox.org">Tim Fox</a>
*/
public class HelloWorldVerticle extends AbstractVerticle {

@Override
public void start() {
// Create an HTTP server which simply returns "Hello World!" to each request.
vertx.createHttpServer().requestHandler(req -> req.response().end("Hello World!")).listen(Integer.getInteger("server.port"), System.getProperty("http.address", "0.0.0.0"));
}
}