for 3
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
services:
|
||||
db:
|
||||
image: postgres:16-alpine
|
||||
container_name: messenger-db
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB_FILE: /run/secrets/postgres_db
|
||||
POSTGRES_USER_FILE: /run/secrets/postgres_user
|
||||
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
secrets:
|
||||
- postgres_db
|
||||
- postgres_user
|
||||
- postgres_password
|
||||
networks:
|
||||
- messenger-net
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U $$(cat /run/secrets/postgres_user) -d $$(cat /run/secrets/postgres_db)"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
|
||||
api:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: messenger-api
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
SPRING_DATASOURCE_URL: jdbc:postgresql://db:5432/messenger
|
||||
SPRING_DATASOURCE_USERNAME_FILE: /run/secrets/postgres_user
|
||||
SPRING_DATASOURCE_PASSWORD_FILE: /run/secrets/postgres_password
|
||||
SPRING_PROFILES_ACTIVE: ${APP_ENV:-lab}
|
||||
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-400}
|
||||
SESSION_STORE: ${SESSION_STORE:-postgres}
|
||||
ports:
|
||||
- "127.0.0.1:8080:8080"
|
||||
secrets:
|
||||
- postgres_user
|
||||
- postgres_password
|
||||
networks:
|
||||
- messenger-net
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:8080/health/ready | grep -q '\"status\":\"ok\"'"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 20
|
||||
start_period: 40s
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
|
||||
networks:
|
||||
messenger-net:
|
||||
driver: bridge
|
||||
|
||||
secrets:
|
||||
postgres_db:
|
||||
file: ./secrets/postgres_db.txt
|
||||
postgres_user:
|
||||
file: ./secrets/postgres_user.txt
|
||||
postgres_password:
|
||||
file: ./secrets/postgres_password.txt
|
||||
Reference in New Issue
Block a user