|
|
@@ -1,5 +1,3 @@
|
|
|
-version: "3.9"
|
|
|
-
|
|
|
x-common: &common
|
|
|
restart: unless-stopped
|
|
|
networks:
|
|
|
@@ -36,7 +34,7 @@ services:
|
|
|
frontend:
|
|
|
condition: service_healthy
|
|
|
healthcheck:
|
|
|
- test: ["CMD", "wget", "-q", "--spider", "http://localhost:2019/metrics"]
|
|
|
+ test: ["CMD", "curl", "-sf", "http://localhost:2019/metrics"]
|
|
|
interval: 30s
|
|
|
timeout: 10s
|
|
|
retries: 3
|
|
|
@@ -48,28 +46,24 @@ services:
|
|
|
environment:
|
|
|
POSTGRES_DB: photoplaces
|
|
|
POSTGRES_USER: photoplaces
|
|
|
- POSTGRES_PASSWORD_FILE: /run/secrets/db_password
|
|
|
+ POSTGRES_PASSWORD: ${DB_PASSWORD}
|
|
|
volumes:
|
|
|
- pgdata:/var/lib/postgresql/data
|
|
|
healthcheck:
|
|
|
test: ["CMD-SHELL", "pg_isready -U photoplaces"]
|
|
|
interval: 10s
|
|
|
retries: 5
|
|
|
- secrets:
|
|
|
- - db_password
|
|
|
|
|
|
redis:
|
|
|
<<: *common
|
|
|
image: redis:7-alpine
|
|
|
- command: redis-server --requirepass-file /run/secrets/redis_password
|
|
|
+ command: redis-server --requirepass ${REDIS_PASSWORD}
|
|
|
volumes:
|
|
|
- redisdata:/data
|
|
|
healthcheck:
|
|
|
- test: ["CMD", "redis-cli", "-a", "$(cat /run/secrets/redis_password)", "ping"]
|
|
|
+ test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
|
|
|
interval: 10s
|
|
|
retries: 5
|
|
|
- secrets:
|
|
|
- - redis_password
|
|
|
|
|
|
minio:
|
|
|
<<: *common
|
|
|
@@ -79,34 +73,31 @@ services:
|
|
|
- miniodata:/data
|
|
|
environment:
|
|
|
MINIO_ROOT_USER: ${S3_ACCESS_KEY}
|
|
|
- MINIO_ROOT_PASSWORD_FILE: /run/secrets/s3_secret_key
|
|
|
+ MINIO_ROOT_PASSWORD: ${S3_SECRET_KEY}
|
|
|
healthcheck:
|
|
|
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
|
|
|
interval: 10s
|
|
|
retries: 5
|
|
|
- secrets:
|
|
|
- - s3_secret_key
|
|
|
- # Порты 9000/9001 ТОЛЬКО внутри Docker сети (нет внешнего доступа)
|
|
|
|
|
|
backend:
|
|
|
<<: *common
|
|
|
build:
|
|
|
- context: ./backend
|
|
|
+ context: ../backend
|
|
|
dockerfile: Dockerfile
|
|
|
env_file:
|
|
|
- ./env.prod
|
|
|
environment:
|
|
|
APP_ENV: production
|
|
|
SERVER_PORT: "8080"
|
|
|
- DATABASE_URL: postgres://photoplaces:$(cat /run/secrets/db_password)@postgres:5432/photoplaces?sslmode=disable
|
|
|
- REDIS_URL: redis://:$(cat /run/secrets/redis_password)@redis:6379/0
|
|
|
+ DATABASE_URL: postgres://photoplaces:${DB_PASSWORD}@postgres:5432/photoplaces?sslmode=disable
|
|
|
+ REDIS_URL: redis://:${REDIS_PASSWORD}@redis:6379/0
|
|
|
S3_ENDPOINT: http://minio:9000
|
|
|
S3_PUBLIC_ENDPOINT: ${S3_PUBLIC_ENDPOINT}
|
|
|
S3_ACCESS_KEY: ${S3_ACCESS_KEY}
|
|
|
- S3_SECRET_KEY_FILE: /run/secrets/s3_secret_key
|
|
|
+ S3_SECRET_KEY: ${S3_SECRET_KEY}
|
|
|
S3_BUCKET: photoplaces
|
|
|
- JWT_SECRET_FILE: /run/secrets/jwt_secret
|
|
|
- JWT_REFRESH_SECRET_FILE: /run/secrets/jwt_refresh_secret
|
|
|
+ JWT_SECRET: ${JWT_SECRET}
|
|
|
+ JWT_REFRESH_SECRET: ${JWT_REFRESH_SECRET}
|
|
|
CLOUDPAYMENTS_PUBLIC_ID: ${CLOUDPAYMENTS_PUBLIC_ID}
|
|
|
CLOUDPAYMENTS_API_SECRET: ${CLOUDPAYMENTS_API_SECRET}
|
|
|
ALLOWED_ORIGINS: ${ALLOWED_ORIGINS}
|
|
|
@@ -118,22 +109,16 @@ services:
|
|
|
minio:
|
|
|
condition: service_healthy
|
|
|
healthcheck:
|
|
|
- test: ["CMD", "wget", "-q", "--spider", "http://localhost:8080/api/v1/health"]
|
|
|
+ test: ["CMD", "curl", "-sf", "http://localhost:8080/api/v1/health"]
|
|
|
interval: 30s
|
|
|
timeout: 10s
|
|
|
retries: 3
|
|
|
start_period: 10s
|
|
|
- secrets:
|
|
|
- - db_password
|
|
|
- - redis_password
|
|
|
- - jwt_secret
|
|
|
- - jwt_refresh_secret
|
|
|
- - s3_secret_key
|
|
|
|
|
|
frontend:
|
|
|
<<: *common
|
|
|
build:
|
|
|
- context: ./frontend
|
|
|
+ context: ../frontend
|
|
|
dockerfile: Dockerfile
|
|
|
args:
|
|
|
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL}
|
|
|
@@ -143,7 +128,7 @@ services:
|
|
|
backend:
|
|
|
condition: service_healthy
|
|
|
healthcheck:
|
|
|
- test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000"]
|
|
|
+ test: ["CMD", "curl", "-sf", "http://localhost:3000"]
|
|
|
interval: 30s
|
|
|
timeout: 10s
|
|
|
retries: 3
|
|
|
@@ -157,16 +142,4 @@ volumes:
|
|
|
caddy_config:
|
|
|
|
|
|
networks:
|
|
|
- photoplaces:
|
|
|
-
|
|
|
-secrets:
|
|
|
- db_password:
|
|
|
- external: true
|
|
|
- redis_password:
|
|
|
- external: true
|
|
|
- jwt_secret:
|
|
|
- external: true
|
|
|
- jwt_refresh_secret:
|
|
|
- external: true
|
|
|
- s3_secret_key:
|
|
|
- external: true
|
|
|
+ photoplaces:
|