Postgres integration #74

Merged
kruti merged 4 commits from kruti/CFTunnels:feature/33-postgres-database into test 2025-10-12 18:11:34 +00:00
4 changed files with 8 additions and 9 deletions
Showing only changes of commit bbadd41ec4 - Show all commits

View File

@ -27,7 +27,6 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher' testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
runtimeOnly 'org.postgresql:postgresql' runtimeOnly 'org.postgresql:postgresql'
implementation 'org.hibernate.validator:hibernate-validator' implementation 'org.hibernate.validator:hibernate-validator'

View File

@ -15,10 +15,10 @@ services:
- POSTGRES_USER=${POSTGRES_USERNAME} - POSTGRES_USER=${POSTGRES_USERNAME}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
env_file: env_file:
- .env - stack.env
kruti marked this conversation as resolved Outdated

Replace this to be stack.env

Replace this to be `stack.env`
restart: unless-stopped restart: unless-stopped
postgres: postgres:
image: postgres:15 image: postgres:15-alpine
kruti marked this conversation as resolved Outdated

Can you use postgres:15-alpine ?

Can you use postgres:15-alpine ?
container_name: cftunnel-db container_name: cftunnel-db
environment: environment:
POSTGRES_DB: cftunnel POSTGRES_DB: cftunnel
@ -28,7 +28,4 @@ services:
ports: ports:
- "5432:5432" - "5432:5432"
volumes: volumes:
- pgdata:/var/lib/postgresql/data - ${DB_PATH}:/var/lib/postgresql/data
kruti marked this conversation as resolved Outdated

Map this to an env variable

Map this to an env variable
volumes:
pgdata: {}

View File

@ -6,3 +6,5 @@ management.endpoint.health.show-details=always
logging.level.org.hibernate.SQL=DEBUG logging.level.org.hibernate.SQL=DEBUG
debug=true debug=true
spring.datasource.url=jdbc:postgresql://localhost:5432/cftunnel

View File

@ -18,7 +18,7 @@ spring.security.oauth2.client.provider.cftunnels.user-info-uri=https://auth.hith
spring.security.oauth2.client.provider.cftunnels.jwk-set-uri=https://auth.hithomelabs.com/application/o/cftunnels/jwks/ spring.security.oauth2.client.provider.cftunnels.jwk-set-uri=https://auth.hithomelabs.com/application/o/cftunnels/jwks/
spring.security.oauth2.client.provider.cftunnels.issuer-uri=https://auth.hithomelabs.com/application/o/cftunnels/ spring.security.oauth2.client.provider.cftunnels.issuer-uri=https://auth.hithomelabs.com/application/o/cftunnels/
spring.datasource.url=jdbc:postgresql://localhost:5432/cftunnel spring.datasource.url=jdbc:postgresql://192.168.0.100:5432/cftunnel
kruti marked this conversation as resolved Outdated

Add the private IP of the server instead of localhost

spring.datasource.url=jdbc:postgresql://192.168.1.100:5432/cftunnel

Add the private IP of the server instead of localhost spring.datasource.url=jdbc:postgresql://192.168.1.100:5432/cftunnel
spring.datasource.username=${POSTGRES_USERNAME} spring.datasource.username=${POSTGRES_USERNAME}
spring.datasource.password=${POSTGRES_PASSWORD} spring.datasource.password=${POSTGRES_PASSWORD}
spring.datasource.driver-class-name=org.postgresql.Driver spring.datasource.driver-class-name=org.postgresql.Driver
@ -26,5 +26,6 @@ spring.sql.init.mode=always
spring.jpa.hibernate.ddl-auto=update spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.open-in-view=false