简体   繁体   中英

Deploy jhipster gateway with mongodb on heroku

Using jhipster 5.7.2.

I'm trying to deploy a gateway created with jhipster to heroku as per the documentation

The gateway is using mongodb and works on my machine. Tested the app directly with a local mongodb as well as with docker-compose. All of it works well.

Then I tried deploying it on heroku :

jhipster heroku

But it failed to start :

2019-01-07T23:37:16.326055+00:00 app[web.1]: java.lang.IllegalArgumentException: Invalid argument syntax: --spring.data.mongodb.database=
2019-01-07T23:37:16.326066+00:00 app[web.1]: at org.springframework.core.env.SimpleCommandLineArgsParser.parse(SimpleCommandLineArgsParser.java:75)
2019-01-07T23:37:16.326074+00:00 app[web.1]: at org.springframework.core.env.SimpleCommandLinePropertySource.<init>(SimpleCommandLinePropertySource.java:90)
2019-01-07T23:37:16.326076+00:00 app[web.1]: at org.springframework.boot.DefaultApplicationArguments$Source.<init>(DefaultApplicationArguments.java:76)
2019-01-07T23:37:16.326078+00:00 app[web.1]: at org.springframework.boot.DefaultApplicationArguments.<init>(DefaultApplicationArguments.java:42)
2019-01-07T23:37:16.326081+00:00 app[web.1]: at org.springframework.boot.SpringApplication.run(SpringApplication.java:295)
2019-01-07T23:37:16.326122+00:00 app[web.1]: at com.lastcall.gateway.GatewayApp.main(GatewayApp.java:66)
2019-01-07T23:37:16.326397+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2019-01-07T23:37:16.326400+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

As I see it in the console, the complete command heroku execute is :

`java $JAVA_OPTS -Xmx256m -jar target/*.war --spring.profiles.active=prod,heroku,no-liquibase --server.port=4838 --spring.data.mongodb.database=$(echo "$MONGODB_URI" | sed "s/^.*:[0-9]*\///g")`

From here I'm not sure where to go next. Was it supposed to work all out of the box or do I miss some steps ? I suppose I should install myself the mongodb on heroku but I'm not sure. Any related advice on hosting jhipster microservices architecture are also welcome.

Thanks in advance :)

UPDATE : Indeed, the environement variable 'MONGODB_URI' mentionned in the deploy command is not set on the server. At this point I assume I should create manually a mongodb server and the set this variable ?

You have to install the MongoDB add-on for your Heroku application which you can do on the Heroku page or by running:

heroku addons:create mongolab

After that, the environment variable MONGODB_URI will be set.

More information can be found at https://devcenter.heroku.com/articles/mongolab .

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