makoto_blog

パパさん_blog

プログラミング勉強メモや雑記など。

SpringBootアプリをHerokuで使ってみる(使えてない)

Build succeeded なんだが Open app でエラーになっている状況。
後日再開するためにメモだけ残します。

コードはこちら。

github.com

やったこと。

  • ローカルで動く事を確認

application.properties

spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost:5432/xxx
spring.datasource.username=xxx
spring.datasource.password=xxx
  • Heroku でアプリ作成

  • application.properties 変更

spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.url=xxx
spring.datasource.username=xxx
spring.datasource.password=xxx
spring.jpa.hibernate.ddl-auto=update
logging.level.jdbc=OFF
logging.level.jdbc.sqltiming=DEBUG
  • table 作成
psql -h xxx -U xxx -d xxx 

で入ってテーブル作成。

  • Procfile 作る
web: java -jar target/spring-page-0.1.0.jar -server.port=$PORT
  • heroku git:remote -a spring-page
  • git add .
  • git commit -am "make it better"
  • git push heroku master ・・・この辺は手順通り

  • Build succeeded → Open app でエラー

2018-08-03T23:01:53.000000+00:00 app[api]: Build started by user xxx@mail.com
2018-08-03T23:02:26.050270+00:00 heroku[web.1]: State changed from crashed to starting
2018-08-03T23:02:25.757608+00:00 app[api]: Release v4 created by user xxx@mail.com
2018-08-03T23:02:25.757608+00:00 app[api]: Deploy 29da64d9 by user xxx@mail.com
2018-08-03T23:02:29.196795+00:00 heroku[web.1]: Starting process with command `java -jar target/*.jar`
2018-08-03T23:02:31.209274+00:00 heroku[web.1]: Process exited with status 1
2018-08-03T23:02:31.147502+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2018-08-03T23:02:31.148860+00:00 app[web.1]: Error: Unable to access jarfile target/*.jar
2018-08-03T23:02:31.329269+00:00 heroku[web.1]: State changed from starting to crashed
2018-08-03T23:02:31.331563+00:00 heroku[web.1]: State changed from crashed to starting
2018-08-03T23:02:35.312171+00:00 heroku[web.1]: Starting process with command `java -jar target/*.jar`
2018-08-03T23:02:36.000000+00:00 app[api]: Build succeeded
2018-08-03T23:02:37.974187+00:00 heroku[web.1]: Process exited with status 1
2018-08-03T23:02:38.028941+00:00 heroku[web.1]: State changed from starting to crashed
2018-08-03T23:02:37.908651+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2018-08-03T23:02:37.910194+00:00 app[web.1]: Error: Unable to access jarfile target/*.jar
2018-08-03T23:02:55.666004+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=spring-page.herokuapp.com request_id=6580218c-a401-4684-b123-73f0815f0a46 fwd="106.154.26.247" dyno= connect= service= status=503 bytes= protocol=https
2018-08-03T23:02:56.657023+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=spring-page.herokuapp.com request_id=c001ffce-c75e-41db-82dc-a23a3e7ca094 fwd="106.154.26.247" dyno= connect= service= status=503 bytes= protocol=https
2018-08-03T23:03:17.158563+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=spring-page.herokuapp.com request_id=7d3b650e-6e99-4f04-bd37-4d1faa0ff4b0 fwd="106.154.26.247" dyno= connect= service= status=503 bytes= protocol=https
2018-08-03T23:03:18.215271+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=spring-page.herokuapp.com request_id=433ef0b2-3703-4ae4-91d0-c33e7a9054da fwd="106.154.26.247" dyno= connect= service= status=503 bytes= protocol=https
^Cバッチ ジョブを終了しますか (Y/N)? y