简体   繁体   English

如何在 Heroku 上托管 spring-boot 微服务 dockerized(docker compose)应用程序

[英]How to host spring-boot micro-service dockerized(docker compose) application on Heroku

I have developed small spring-boot microservice application and dockerized the same.我开发了小型 spring-boot 微服务应用程序并对其进行了码头化。 I have multiple spring-boot services and angular which are dockerized using docker-compose file.我有多个 spring-boot 服务和 angular 使用 docker-compose 文件进行码头化。 My app runs fine in my local.我的应用程序在我的本地运行良好。 I just wanted to host my app on Heroku for free.我只是想免费在 Heroku 上托管我的应用程序。 please help me how to host my app and how to configure multiple ports with application.请帮助我如何托管我的应用程序以及如何使用应用程序配置多个端口。 how to deploy using docker-compose.如何使用 docker-compose 进行部署。

First of all, you can not run your docker-compose in heroku.首先,你不能在 heroku 中运行你的 docker-compose。

Docker is not required Docker 不是必需的

If you will choose heroku, docker is not required.如果您要选择 heroku,则不需要 docker。 Just ensure that your spring boot apis and angular app are standard.只需确保您的 spring 引导 API 和 angular 应用程序是标准的。 If you fulfill that, just create many applications as git repositories you have (I guess you have it like this).如果你实现了这一点,只需创建许多应用程序作为你拥有的 git 存储库(我猜你有这样的)。

Smart heroku engine will detect the technology of your git repository and will provide you an standard dyno for your app.智能 heroku 引擎将检测您的 git 存储库的技术,并为您的应用程序提供标准测功机。 After that heroku will run standard commands of open source languages.之后 heroku 将运行开源语言的标准命令。

For example, heroku will run npm install and npm run start in your angular/nodejs app.例如,heroku 将运行 npm 安装和 npm 在您的 angular/nodejs 应用程序中运行启动。 If you don't put the start script in your package.json , an error will be trowed.如果您没有将启动脚本放在package.json中,则会引发错误。 The same will happen with your spring boot rest api.您的 spring 启动 rest api 也会发生同样的情况。

If you have any error with your current spring boot apis, try to compare it with my templates https://github.com/jrichardsz/spring-boot-templates/tree/master/000-hello-world .如果您当前的 spring 引导 API 有任何错误,请尝试将其与我的模板https://github.com/jrichardsz/spring-boot-templates/tree/master/000-hello-world进行比较。

I want docker我想要 docker

Anyway, if you want to use docker in heroku, just put the classic Dockerfile inside of any git repository and push them to heroku. Anyway, if you want to use docker in heroku, just put the classic Dockerfile inside of any git repository and push them to heroku. Smart engine will detect it and deploy it.智能引擎将检测并部署它。

1.You don't need docker as answered already. 1.您不需要已经回答的 docker。 See this link for deployment to Heroku请参阅此链接以部署到Heroku

  1. You could also deploy using Travis CI for continuous integration via github.您还可以使用Travis CI 进行部署,通过 github 进行持续集成

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

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