首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >部署Tomcat/Docker Hello-World到Heroku返回HTTP:503

部署Tomcat/Docker Hello-World到Heroku返回HTTP:503
EN

Stack Overflow用户
提问于 2021-05-24 18:24:20
回答 1查看 188关注 0票数 0

我承认,我有点像野草一样,管理港口,对住在Tomcat容器里的这个小应用程序吐露心声。

我知道TC会收听8080。我假设,只要Heroku提出的任何端口都映射到容器中的8080,请求至少应该到达容器。我试着按照他们的指示去做。不知道为什么需要webapp运行程序,但Heroku指定了它。

但是,在本地开发时(在工作正常的地方),请求(即http://127.0.0.1:8080/DockerJavaWebApp-1.0-SNAPSHOT/)中指定了目标war的名称。我不知道如何在部署中这样做,或者如果有必要的话。我也不想在当地这样做。

任何援助,如事先表示感谢,将不胜感激。

文档:

代码语言:javascript
复制
FROM tomcat
ADD target/DockerJavaWebApp-1.0-SNAPSHOT.war /usr/local/tomcat/webapps/
EXPOSE 8080
CMD ["catalina.sh", "run" , "-b", "0.0.0.0:$PORT"]

docker-compose:

代码语言:javascript
复制
version: '3'

services:
  app:
    build: .
    image: yermammy #tomcat_test
    environment:
      - PORT

Procfile:

代码语言:javascript
复制
web: java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT target/*.war

heroku日志(省略):(该端口映射看起来有正确的语法吗?)

代码语言:javascript
复制
2021-05-25T00:39:16.515638+00:00 heroku[web.1]: Starting process with command `catalina.sh run -b 0.0.0.0:\48915`

2021-05-24T18:04:27.398894+00:00 app[web.1]: 24-May-2021 18:04:27.398 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [6388] milliseconds

2021-05-24T18:05:07.025452+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=blah-tomcat-test.herokuapp.com request_id=0b87e97e-ca2f-4406-b4f2-329890f923db fwd="65.35.200.119" dyno= connect= service= status=503 bytes= protocol=https

2021-05-24T18:05:07.725522+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

2021-05-24T18:05:07.785462+00:00 heroku[web.1]: Stopping process with SIGKILL

2021-05-24T18:05:08.146910+00:00 heroku[web.1]: Process exited with status 137
2021-05-24T18:05:08.219013+00:00 heroku[web.1]: State changed from starting to crashed

2021-05-24T18:05:10.482493+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=blah-tomcat-test.herokuapp.com request_id=d328a542-0466-4be5-9a82-1eda0cb42af4 fwd="65.35.200.119" dyno= connect= service= status=503 bytes= protocol=https

2021-05-24T18:05:12.259286+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=blah-tomcat-test.herokuapp.com request_id=c2172b8c-4a66-491d-9db1-86685a4f6662 fwd="65.35.200.119" dyno= connect= service= status=503 bytes= protocol=https

2021-05-24T18:05:27.529565+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/index.jsp" host=blah-tomcat-test.herokuapp.com request_id=38a21675-c542-46a1-8692-1672547b6f02 fwd="65.35.200.119" dyno= connect= service= status=503 bytes= protocol=https

2021-05-24T18:05:27.951191+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=blah-tomcat-test.herokuapp.com request_id=7cba1f7a-abdf-43c0-bba7-dd7341e4daee fwd="65.35.200.119" dyno= connect= service= status=503 bytes= protocol=https
EN

回答 1

Stack Overflow用户

发布于 2021-05-25 01:12:50

war文件在通过这些指令( https://devcenter.heroku.com/articles/java-webapp-runner#prerequisites )部署时运行良好--这些指令规定使用GIT。

查看一下:https://stormy-wildwood-00412.herokuapp.com/index.jsp

但是,包含该应用程序的坞映像无法与Heroku提供的端口连接。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67677104

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档