简体   繁体   English

在heroku上使用mongodb部署jhipster网关

[英]Deploy jhipster gateway with mongodb on heroku

Using jhipster 5.7.2.使用 jhipster 5.7.2。

I'm trying to deploy a gateway created with jhipster to heroku as per the documentation我正在尝试根据文档将使用 jhipster 创建的网关部署到 heroku

The gateway is using mongodb and works on my machine.网关正在使用 mongodb 并在我的机器上工作。 Tested the app directly with a local mongodb as well as with docker-compose.直接使用本地 mongodb 以及 docker-compose 测试了该应用程序。 All of it works well.所有这些都运行良好。

Then I tried deploying it on heroku :然后我尝试在 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 :正如我在控制台中看到的,heroku 执行的完整命令是:

`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.我想我应该在heroku上安装自己的mongodb,但我不确定。 Any related advice on hosting jhipster microservices architecture are also welcome.也欢迎任何有关托管 jhipster 微服务架构的相关建议。

Thanks in advance :)提前致谢 :)

UPDATE : Indeed, the environement variable 'MONGODB_URI' mentionned in the deploy command is not set on the server.更新:确实,部署命令中提到的环境变量“MONGODB_URI”并未在服务器上设置。 At this point I assume I should create manually a mongodb server and the set this variable ?在这一点上,我假设我应该手动创建一个 mongodb 服务器并设置这个变量?

You have to install the MongoDB add-on for your Heroku application which you can do on the Heroku page or by running:您必须为 Heroku 应用程序安装 MongoDB 附加组件,您可以在 Heroku 页面上或通过运行:

heroku addons:create mongolab

After that, the environment variable MONGODB_URI will be set.之后,将设置环境变量 MONGODB_URI。

More information can be found at https://devcenter.heroku.com/articles/mongolab .更多信息可以在https://devcenter.heroku.com/articles/mongolab找到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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