我正在尝试在Heroku上运行Spring Boot应用程序。我已按照他们的教程进行操作,并尝试部署我的应用程序,但由于某些未知原因,该应用程序仍会失败。
2019-11-08T12:23:50.484165+00:00 app[web.1]:
2019-11-08T12:23:50.484215+00:00 app[web.1]: . ____ _ __ _ _
2019-11-08T12:23:50.484401+00:00 app[web.1]: /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
2019-11-08T12:23:50.484501+00:00 app[web.1]: ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
2019-11-08T12:23:50.484593+00:00 app[web.1]: \\/ ___)| |_)| | | | | || (_| | ) ) ) )
2019-11-08T12:23:50.484680+00:00 app[web.1]: ' |____| .__|_| |_|_| |_\__,| / / / /
2019-11-08T12:23:50.484770+00:00 app[web.1]: =========|_|==============|___/=/_/_/_/
2019-11-08T12:23:50.486599+00:00 app[web.1]: :: Spring Boot :: (v2.2.1.RELEASE)
2019-11-08T12:23:50.486673+00:00 app[web.1]:
2019-11-08T12:23:50.816454+00:00 app[web.1]: 2019-11-08 12:23:50.809 INFO 4 --- [ main] P.p.ProgresstrackerappApplication : Starting ProgresstrackerappApplication v0.0.1-snAPSHOT on 8f560338-e240-4b5d-afdf-be7d44992eb6 with PID 4 (/app/target/progresstrackerapp-0.0.1-snAPSHOT.jar started by u28233 in /app)
2019-11-08T12:23:50.819527+00:00 app[web.1]: 2019-11-08 12:23:50.819 INFO 4 --- [ main] P.p.ProgresstrackerappApplication : No active profile set,falling back to default profiles: default
2019-11-08T12:23:53.772610+00:00 app[web.1]: 2019-11-08 12:23:53.772 INFO 4 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2019-11-08T12:23:53.791185+00:00 app[web.1]: 2019-11-08 12:23:53.790 INFO 4 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-11-08T12:23:53.791563+00:00 app[web.1]: 2019-11-08 12:23:53.791 INFO 4 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.27]
2019-11-08T12:23:53.897317+00:00 app[web.1]: 2019-11-08 12:23:53.897 INFO 4 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-11-08T12:23:53.897452+00:00 app[web.1]: 2019-11-08 12:23:53.897 INFO 4 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2928 ms
2019-11-08T12:23:54.261713+00:00 app[web.1]: 2019-11-08 12:23:54.261 INFO 4 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-11-08T12:23:54.413274+00:00 app[web.1]: 2019-11-08 12:23:54.412 INFO 4 --- [ main] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page template: index
2019-11-08T12:23:54.709609+00:00 app[web.1]: 2019-11-08 12:23:54.709 INFO 4 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2019-11-08T12:23:54.715140+00:00 app[web.1]: 2019-11-08 12:23:54.714 INFO 4 --- [ main] P.p.ProgresstrackerappApplication : Started ProgresstrackerappApplication in 5.801 seconds (JVM running for 6.938)
2019-11-08T12:24:00.589583+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=progresstrackerapp.herokuapp.com request_id=68c7754f-2c39-4cf8-b207-426af344f40c fwd="xxx.xxx.xxx.xxx" dyno= connect= service= status=503 bytes= protocol=https
我从文本中删除了我的IP。知道什么可能导致超时吗?
编辑1: 我做了一些事情:我自己在应用程序的根目录中添加了Procfile,因为没有它,我的应用程序将崩溃
web java -jar target/progresstrackerapp-0.0.1-snAPSHOT.jar
对于我执行的命令:
git add .
git commit -m "s1"
git push heroku master
该应用的构建正常,并且在那里没有出现任何问题
heroku ps:scale:1 // this resulted in the problem
编辑2:
我发现了问题。似乎我需要指定一个环境变量PATH。 Heroku需要此变量才能在其上进行部署,因为包括它是开发人员的工作。这就是我的解决办法。