Skip to content

Commit

Permalink
move userdb to docker-compose-database
Browse files Browse the repository at this point in the history
  • Loading branch information
Danzigerrr committed May 10, 2024
1 parent b6331c2 commit 61e49b5
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,4 @@ fabric.properties
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
/db
/userdb
21 changes: 21 additions & 0 deletions docker-compose-database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,29 @@ services:
timeout: 5s
retries: 20

userdb:
image: postgres
environment:
- POSTGRES_USER=admin
- POSTGRES_PASSWORD=admin
- POSTGRES_DB=users
- PGDATA=/data/postgres
expose:
- "5432"
restart: unless-stopped
volumes:
- ./userdb:/data/postgres
networks:
- backend
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB" ]
interval: 5s
timeout: 5s
retries: 20

volumes:
postgres:
userdb:

networks:
backend:
Expand Down
15 changes: 0 additions & 15 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,6 @@ services:
- rabbitmq
- discovery
- gateway
- userdb
networks:
- backend

userdb:
image: postgres
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=password
- POSTGRES_DB=users
expose:
- "5432"
restart: always
volumes:
- ./db:/var/lib/postgres
networks:
- backend

Expand Down
4 changes: 2 additions & 2 deletions user-service/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ eureka.instance.instance-id=${spring.application.name}:${spring.application.inst
spring.datasource.driver-class-name=org.postgresql.Driver
#spring.datasource.url=jdbc:postgresql://localhost:5432/users?createDatabaseIfNotExist=true&autoReconnect=true&useSSL=false&useUnicode=yes&characterEncoding=UTF-8&allowPublicKeyRetrieval=true&currentSchema=public
spring.datasource.url=jdbc:postgresql://userdb:5432/users
spring.datasource.username=postgres
spring.datasource.password=password
spring.datasource.username=admin
spring.datasource.password=admin
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=create
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
Expand Down

0 comments on commit 61e49b5

Please sign in to comment.