简体   繁体   中英

How can I deploy my maven project on Heroku?

My config.yml is defined as follow:

http:
    port: 8080
    adminPort: 8081

mongodb:
    default_database_uri: mongodb://127.0.0.1:27017/myappdb

I normally start mongod and run the app on localhost 8080 with

java -jar myapp-0.0.1-SNAPSHOT.jar server config.yml

I tried the following:

heroku deploy:jar myapp-0.0.1-SNAPSHOT.jar --app stark-sea-3911

But it didn't work.

My app is similar to this https://github.com/mongodb-labs/socialite

Run this command:

heroku deploy:jar myapp-0.0.1-SNAPSHOT.jar --options "server config.yml" --app stark-sea-3911

If you don't want to add the --options "server config.yml" every time, you can either create a Procfile with the full command, or set JAR_OPTS on your app by running:

heroku config:set JAR_OPTS="server config.yml"

Also, make sure the config.yml is available on Heroku. You may need to also add --includes config.yml to your deploy:jar command.

You'll also probably want to change the http port stuff too look like this:

http:
    port: ${PORT}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM