* перенесла постгрес из хоста в compose
This commit is contained in:
+22
-4
@@ -1,10 +1,27 @@
|
||||
x-lab-number: 2
|
||||
x-required-roles:
|
||||
- api
|
||||
# - postgres
|
||||
- postgres
|
||||
|
||||
# Лабораторная 2. API + Redis
|
||||
# Лабораторная 2. API + PostgreSQL + Redis
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:18.6-alpine
|
||||
container_name: mtusi-postgres
|
||||
environment:
|
||||
POSTGRES_USER: ${POSTGRES_USER:-messenger}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-messenger}
|
||||
POSTGRES_DB: ${POSTGRES_DB:-high_load_messenger}
|
||||
volumes:
|
||||
- postgres-data:/var/lib/postgresql
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-messenger} -d ${POSTGRES_DB:-high_load_messenger}"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 20
|
||||
start_period: 30s
|
||||
restart: unless-stopped
|
||||
|
||||
redis:
|
||||
image: redis:7.4.1-alpine
|
||||
container_name: mtusi-redis
|
||||
@@ -29,9 +46,9 @@ services:
|
||||
- "127.0.0.1:8080:8080"
|
||||
env_file:
|
||||
- .env
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
@@ -43,4 +60,5 @@ services:
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
postgres-data:
|
||||
redis-data:
|
||||
Reference in New Issue
Block a user