I'm trying to deploy a Spring Boot REST API to Heroku.
It successfully uploads the files to Heroku's Git repository.
But it is not creating the database tables and so the app doesn't work.
This is how I'm doing on the CLI.
git add .
git commit -m "message"
heroku login
heroku create myappname
heroku addons:create heroku-postgresql:hobby-dev
git push heroku main
Tried with several different application.properties (as below) and none of them was successful. (user/passwords below are fake. Just for explanation purpose)
application.properties test1
spring.jpa.hibernate.ddl-auto=create
application.properties test2
spring.datasource.url=${JDBC_DATABASE_URL}
spring.datasource.username=${JDBC_DATABASE_USERNAME}
spring.datasource.password=${JDBC_DATABASE_PASSWORD}
spring.jpa.hibernate.ddl-auto=create
application.properties test3
spring.jpa.hibernate.ddl-auto=create
spring.datasource.url=postgres://aooswjxdniusmd:f99447ede191d139d32f1e3d539dc8ty4535c65350a51960d887km44d6we7c4@ec2-21-567-987-345.compute-1.amazonaws.com:5432/q5kl3s76jh08yt
application.properties test4
spring.jpa.hibernate.ddl-auto=create
spring.datasource.url=postgres://aooswjxdniusmd:f99447ede191d139d32f1e3d539dc8ty4535c65350a51960d887km44d6we7c4@ec2-21-567-987-345.compute-1.amazonaws.com:5432/q5kl3s76jh08yt
application.properties test5
spring.jpa.properties.hibernate.show_sql=false
spring.jpa.properties.hibernate.use_sql_comments=true
spring.jpa.properties.hibernate.format_sql=false
spring.jpa.properties.hibernate.type=info
application.properties test6
spring.datasource.url=${JDBC_DATABASE_URL}
spring.jpa.show-sql=true
spring.jpa.generate-ddl=true
application.properties test7
spring.jpa.properties.hibernate.show_sql=false
spring.jpa.properties.hibernate.use_sql_comments=true
spring.jpa.properties.hibernate.format_sql=false
spring.jpa.properties.hibernate.type=info
UPDATE:
I ran heroku logs --tail
to take a look at the logs.
Two entries called my attention:
heroku[router]: at=error code=H14 desc="No web processes running"
Error: Unable to access jarfile target/myapp-0.0.1-SNAPSHOT.jar
Then I tried the following:
java -jar myapp-0.0.1-SNAPSHOT.jar
Also got the same error message:
Error: Unable to access jarfile myapp-0.0.1-SNAPSHOT.jar
So that seems to be the cause of the issue.
Not sure why it is happening though.