Add Heroku support

This commit is contained in:
Charles Gould 2016-12-31 02:09:20 -05:00
parent 8e2d443c0e
commit a9e03b481c
5 changed files with 31 additions and 1 deletions

1
Procfile Normal file
View File

@ -0,0 +1 @@
web: java -jar server/target/lingo-websocket-server.jar

12
pom.xml
View File

@ -21,10 +21,20 @@
</properties>
<modules>
<module>client</module>
<module>client-api</module>
<module>common</module>
<module>server</module>
</modules>
<profiles>
<!-- Prevent client module from building on Heroku -->
<!-- Heroku's JDKs are headless -->
<profile>
<id>javafx</id>
<modules>
<module>client</module>
</modules>
</profile>
</profiles>
</project>

View File

@ -46,6 +46,17 @@
<!-- Add src/main/config to the classpath -->
<folders>src/main/config</folders>
</configuration>
<executions>
<!-- Repackage as executable JAR (java -jar) -->
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<finalName>${project.artifactId}</finalName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

View File

@ -7,6 +7,13 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
public class LingoServer {
public static void main(String[] args) {
// Heroku dynamically assigns a port
final String webPort = System.getenv("PORT");
if (webPort != null && !webPort.isEmpty()) {
System.setProperty("server.port", webPort);
}
SpringApplication.run(LingoServer.class, args);
}

1
system.properties Normal file
View File

@ -0,0 +1 @@
java.runtime.version=1.8