在heroku上使用mongodb部署jhipster网关



使用jhipster 5.7.2。

我正试图根据文档将用jhipster创建的网关部署到heroku

网关使用mongodb,在我的机器上运行。直接用本地mongodb和docker-compose测试了该应用程序。所有这些都很有效。

然后我试着在heroku:上部署它

jhipster heroku

但它未能启动:

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)

正如我在控制台中看到的,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")`

从这里开始,我不知道下一步该去哪里。是应该开箱即用,还是我错过了一些步骤?我想我应该在heroku上安装mongodb,但我不确定。也欢迎任何关于托管jhipster微服务架构的相关建议。

提前感谢:)

更新:事实上,deploy命令中提到的环境变量"MONGODB_URI"并没有在服务器上设置。在这一点上,我认为我应该手动创建一个mongodb服务器,并设置这个变量?

您必须为您的Heroku应用程序安装MongoDB插件,您可以在Heroku页面上或运行:

heroku addons:create mongolab

之后,将设置环境变量MONGODB_URI。

更多信息,请访问https://devcenter.heroku.com/articles/mongolab.

最新更新