3
respostas

Erro no Deploy da aplicação via Heroku

Estou recebendo erro abaixo ao dar o deploy e não consigo alterar o tempo da aplicação :

2021-08-03T01:05:59.224445+00:00 app[web.1]: 2021-08-03 01:05:59.222  INFO 3 --- [           main] br.com.alura.forum.ForumApplication      : The following profiles are active: prod
2021-08-03T01:06:13.989870+00:00 app[web.1]: 2021-08-03 01:06:13.987  INFO 3 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode.
2021-08-03T01:06:14.844684+00:00 app[web.1]: 2021-08-03 01:06:14.843  INFO 3 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 809ms. Found 3 JPA repository interfaces.
2021-08-03T01:06:26.058187+00:00 app[web.1]: 2021-08-03 01:06:26.057  INFO 3 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8154 (http)
2021-08-03T01:06:26.082404+00:00 app[web.1]: 2021-08-03 01:06:26.082  INFO 3 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2021-08-03T01:06:26.082834+00:00 app[web.1]: 2021-08-03 01:06:26.082  INFO 3 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.36]
2021-08-03T01:06:26.811719+00:00 app[web.1]: 2021-08-03 01:06:26.811  INFO 3 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2021-08-03T01:06:26.811961+00:00 app[web.1]: 2021-08-03 01:06:26.811  INFO 3 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 26686 ms
2021-08-03T01:06:28.420634+00:00 app[web.1]: 2021-08-03 01:06:28.420  INFO 3 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2021-08-03T01:06:30.330996+00:00 app[web.1]: 2021-08-03 01:06:30.330  INFO 3 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2021-08-03T01:06:30.351441+00:00 app[web.1]: 2021-08-03 01:06:30.351  INFO 3 --- [           main] o.s.b.a.h2.H2ConsoleAutoConfiguration    : H2 console available at '/h2-console'. Database available at 'jdbc:h2:mem:alura-forum'
2021-08-03T01:06:33.563658+00:00 app[web.1]: 2021-08-03 01:06:33.563  INFO 3 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2021-08-03T01:06:34.343753+00:00 app[web.1]: 2021-08-03 01:06:34.337  INFO 3 --- [         task-1] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
2021-08-03T01:06:35.064173+00:00 app[web.1]: 2021-08-03 01:06:35.063  WARN 3 --- [           main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2021-08-03T01:06:39.109570+00:00 app[web.1]: 2021-08-03 01:06:39.101  INFO 3 --- [         task-1] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.4.17.Final
2021-08-03T01:06:43.815882+00:00 app[web.1]: 2021-08-03 01:06:43.815  INFO 3 --- [         task-1] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
2021-08-03T01:06:45.943432+00:00 app[web.1]: 2021-08-03 01:06:45.942  INFO 3 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 13 endpoint(s) beneath base path '/actuator'
**2021-08-03T01:06:46.509228+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch**
2021-08-03T01:06:46.610800+00:00 heroku[web.1]: Stopping process with SIGKILL
2021-08-03T01:06:46.976786+00:00 heroku[web.1]: Process exited with status 137
2021-08-03T01:06:47.085681+00:00 heroku[web.1]: State changed from starting to crashed
3 respostas

Oi Odair,

Parece ser a configuracao da Porta da aplicacao no Heroku.

Posta aqui o seu application-prod.properties e tambem o Dockerfile

application-prod.properties:

datasource

spring.datasource.driverClassName=org.h2.Driver spring.datasource.url=${FORUM_DATABASE_URL} spring.datasource.username=${FORUM_DATABASE_USERNAME} spring.datasource.password=${FORUM_DATABASE_PASSWORD}

jpa

spring.jpa.database-palataform=org.hibernate.dialect.H2Dialect spring.jpa.hibernate.ddl-auto=update spring.jpa.properties.hibernate.show_sql=true spring.jpa.properties.hibernate.format_sql=true

h2

spring.h2.console.enabled=true spring.h2.console.path=/h2-console

jwt

forum.jwt.secret=${FORUM_JWT_SECRET} forum.jwt.expiration=86400000

actuator

management.endpoint.health.show-details=always management.endpoints.web.exposure.include=* info.app.name=@project.name@ info.app.description=@project.description@ info.app.version=@project.version@ info.app.encoding=@project.build.sourceEncoding@ info.app.java.version=@java.version@

spring boot admin server

spring.boot.admin.client.url=http://localhost:8081

port Heroku

server.port =${PORT}

Dockerfile:

FROM openjdk:8-jdk-alpine RUN addgroup -S spring && adduser -S spring -G spring USER spring:spring ARG JAR_FILE=target/*.jar COPY ${JAR_FILE} app.jar ENTRYPOINT ["java","-Xmx512m","-Dserver.port=${PORT}","-jar","/app.jar"]

Boa noite

Aqui para mim apresentou o mesmo problema (R10 - Boot Timeout), dando uma procurada na web eu achei o link para alterar o tempo de boot da aplicação, https://tools.heroku.support/limits/boot_timeout. Lá você escolhe o seu projeto em which application e depois aumenta o tempo para 90 segundos.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software