Hi !
I’m new and trying to start my Spring Boot project application on Render.
Actually, i’ve tried lot of combination like Blueprint (To create my database and WebService), or create a new WebService.
Actually, running on Blueprint :
So i created a Dockerfile :
FROM maven:3.8.3-openjdk-17 AS build
COPY . .
RUN mvn clean package -DskipTests
FROM openjdk:17.0.1-jdk-slim
COPY --from=build /target/demo-0.0.1-SNAPSHOT.jar /demo.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "demo.jar"]
And create a render.yaml :
services:
- type: web
name: demo
runtime: docker
region: frankfurt
plan: free
healthCheckPath: /
envVars:
- key: SPRING_DATASOURCE_CONNECTION_STRING
fromDatabase:
name: demo-bdd
property: connectionString
- key: SPRING_DATASOURCE_USERNAME
fromDatabase:
name: demo-bdd
property: user
- key: SPRING_DATASOURCE_PASSWORD
fromDatabase:
name: demo-bdd
property: password
- key: SPRING_DATASOURCE_HOST
fromDatabase:
name: demo-bdd
property: host
- key: SPRING_DATASOURCE_PORT
fromDatabase:
name: demo-bdd
property: port
- key: SPRING_DATASOURCE_SCHEMA
fromDatabase:
name: demo-bdd
property: database
- key: SPRING_DATASOURCE_URL
value: jdbc:postgresql://${SPRING_DATASOURCE_HOST}:${SPRING_DATASOURCE_PORT}/${SPRING_DATASOURCE_SCHEMA}
- key: SPRING_PORT
value: 8080
databases:
- name: demo-bdd
region: frankfurt
plan: free
And correctly set a port for environment variable.
My application.properties looks like :
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.hibernate.ddl-auto=update
spring.jpa.hibernate.show-sql=true
################### BDD properties ###################
# BDD internal pour RENDER (PROD)
spring.datasource.url=jdbc:postgresql://dpg-url.render.com:5432/bdd
spring.datasource.username=user
spring.datasource.password=password
I hide username/password and url, my connection to the bdd works correctly, i got Hibernate alter table
I read the doc and search on internet, but i don’t know how to know if it binds on 127.0.0.1 or on 0.0.0.0, so, my first question is : How to ?
Next, i don’t know why, because i think i’ve correctly configured my render.yaml too on my Blueprint. Maybe someone find a mistake in my configuration ?
Thanks a lot for your help in advance !