update database configuration in .env and docker-compose, add backend-db service

This commit is contained in:
2025-10-27 03:18:27 +03:00
parent 06bef25e58
commit c3c694bf4d
3 changed files with 44 additions and 7 deletions

View File

@ -7,4 +7,12 @@ redis:
db: 0
hydra:
host: https://oauth2.logidex.ru/admin
host: https://oauth2.logidex.ru/admin
db:
host: backend-db
port: 5432
user: postgres
password: postgres
dbname: logidex-id

View File

@ -1 +1 @@
DSN=postgres://postgres:postgres@db:5432/hydra?sslmode=disable&max_conns=20&max_idle_conns=4
DSN=postgres://postgres:postgres@hydra-db:5432/hydra?sslmode=disable&max_conns=20&max_idle_conns=4

View File

@ -1,5 +1,7 @@
services:
hydra:
container_name:
"logidex-id-hydra"
image: oryd/hydra:v2.3.0
command: serve -c /etc/config/hydra/hydra.yml all --dev
depends_on:
@ -13,6 +15,8 @@ services:
env_file:
- ./config/hydra/.env
hydra-migrate:
container_name:
"logidex-id-hydra-migrate"
image: oryd/hydra:v2.3.0
command: migrate -c /etc/config/hydra/hydra.yml sql up -e --yes
volumes:
@ -25,7 +29,7 @@ services:
- ./config/hydra/.env
depends_on:
- db
- hydra-db
nginx:
container_name: "logidexid"
image: nginx:latest
@ -42,8 +46,10 @@ services:
- hydra
networks:
- appnet
- proxy
# - proxy
front:
container_name:
"logidex-id-frontend"
image: git.logidex.ru/fakz9/logidex-id-frontend:latest
environment:
- NODE_ENV=production
@ -51,16 +57,22 @@ services:
networks:
- appnet
back:
container_name:
"logidex-id-backend"
image: git.logidex.ru/fakz9/id-backend:latest
depends_on:
redis:
condition: service_healthy
backend-db:
condition: service_started
networks:
- appnet
volumes:
- ./config/back/.env:/app/.env
- ./config/back/config.yaml:/app/config.yaml
redis:
container_name:
"logidex-id-redis"
image: redis
command: [ "redis-server", "--save", "60", "1", "--appendonly", "no" ]
volumes:
@ -72,7 +84,9 @@ services:
interval: 5s
timeout: 2s
retries: 5
db:
hydra-db:
container_name:
"logidex-id-hydra-db"
image: postgres:17-alpine
restart: unless-stopped
environment:
@ -83,13 +97,28 @@ services:
- db:/var/lib/postgresql/data
networks:
- appnet
backend-db:
container_name:
"logidex-id-backend-db"
image: postgres:17-alpine
restart: unless-stopped
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: logidex-id
volumes:
- backed_db:/var/lib/postgresql/data
networks:
- appnet
networks:
appnet:
external: false
proxy:
external: true
# proxy:
# external: true
volumes:
redis_data:
db:
driver: local
backed_db:
driver: local