I have multi-module maven project with two modules. Each module is a spring rest service (@RestController). I have successfully run the services on localhost and now I want to have remote access to my app, so I need to publish modules to some remote server.
I found that using Heroku is a good way to start. I read some tutorials but don’t completely understand one thing: can I deploy multiple services in one Heroku app (if yes, how I need to configure my Procfile) or I have to create one Heroku app for each module of my application? Or may be there is any way to package multiple modules to one war/ear file and use it for deployment?
Just in case, there is my top-level pom
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.nverapp</groupId> <artifactId>nverapp</artifactId> <version>1.0-SNAPSHOT</version> <packaging>pom</packaging> <modules> <module>server</module> <module>auth_server</module> </modules>
So i found this example https://github.com/seeebiii/multi-module-heroku , but I don’t undrestand how the application server handles with starting moudle
ChildTwo as separarte service. Can someone explain this moment?
You will need to create two apps because Heroku only allows one web process type per app.
You’ll also need to make your Procfile flexible enough to work with both modules. To do so I recommend putting the JAR file name in a config var like:
web: java -jar $JAR_FILE
You may also use the MAVEN_CUSTOM_OPTS config var to set the
-pl option per app to build only what you need.
Answered By – codefinger
Answer Checked By – Mary Flores (Easybugfix Volunteer)