lab4: исправления по ревью
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
name: mtusi-messenger-lab4
|
||||
|
||||
# Built once by the api service; migrate and s3-init consume the same image.
|
||||
x-app: &app
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
image: mtusi-messenger:lab4
|
||||
|
||||
services:
|
||||
@@ -46,6 +44,45 @@ services:
|
||||
retries: 10
|
||||
start_period: 3s
|
||||
restart: unless-stopped
|
||||
seaweedfs:
|
||||
image: chrislusf/seaweedfs:3.80@sha256:1055999e08eed1789b0ae45d235126e4495e23d3fb9d6396293fd42539b1ae6a
|
||||
command:
|
||||
- server
|
||||
- -s3
|
||||
- -s3.config=/etc/seaweedfs/s3.json
|
||||
- -dir=/data
|
||||
- -master.volumeSizeLimitMB=64
|
||||
volumes:
|
||||
- ./infra/s3/s3.json:/etc/seaweedfs/s3.json:ro
|
||||
- seaweedfs-data:/data
|
||||
ports:
|
||||
- "127.0.0.1:${S3_PORT:-8333}:8333"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "wget -q -O /dev/null http://127.0.0.1:8333/healthz || exit 1"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 20
|
||||
start_period: 60s
|
||||
restart: unless-stopped
|
||||
|
||||
s3-init:
|
||||
<<: *app
|
||||
entrypoint: ["/usr/local/bin/s3init"]
|
||||
environment:
|
||||
S3_ENDPOINT: http://seaweedfs:8333
|
||||
S3_REGION: ${S3_REGION:-us-east-1}
|
||||
S3_BUCKET: ${S3_BUCKET:-messenger-attachments}
|
||||
S3_ADMIN_ACCESS_KEY: ${S3_ADMIN_ACCESS_KEY:-lab4admin}
|
||||
S3_ADMIN_SECRET_ACCESS_KEY: ${S3_ADMIN_SECRET_ACCESS_KEY:-lab4admin-secret}
|
||||
S3_ACCESS_KEY_ID: ${S3_ACCESS_KEY_ID:-lab4app}
|
||||
S3_SECRET_ACCESS_KEY: ${S3_SECRET_ACCESS_KEY:-lab4app-secret}
|
||||
depends_on:
|
||||
seaweedfs:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
disable: true
|
||||
restart: "no"
|
||||
|
||||
migrate:
|
||||
<<: *app
|
||||
entrypoint: ["/usr/local/bin/migrate"]
|
||||
@@ -65,6 +102,9 @@ services:
|
||||
|
||||
api:
|
||||
<<: *app
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
env_file:
|
||||
- path: .env
|
||||
required: false
|
||||
@@ -80,6 +120,15 @@ services:
|
||||
REDIS_HOST: redis
|
||||
REDIS_PORT: "6379"
|
||||
CACHE_ENABLED: "${CACHE_ENABLED:-true}"
|
||||
S3_ENDPOINT: http://seaweedfs:8333
|
||||
S3_PUBLIC_ENDPOINT: ${S3_PUBLIC_ENDPOINT:-http://127.0.0.1:8333}
|
||||
S3_REGION: ${S3_REGION:-us-east-1}
|
||||
S3_BUCKET: ${S3_BUCKET:-messenger-attachments}
|
||||
S3_ACCESS_KEY_ID: ${S3_ACCESS_KEY_ID:-lab4app}
|
||||
S3_SECRET_ACCESS_KEY: ${S3_SECRET_ACCESS_KEY:-lab4app-secret}
|
||||
S3_USE_PATH_STYLE: "true"
|
||||
MAX_UPLOAD_BYTES: ${MAX_UPLOAD_BYTES:-10485760}
|
||||
MAX_IMAGE_PIXELS: ${MAX_IMAGE_PIXELS:-40000000}
|
||||
ports:
|
||||
- "127.0.0.1:${SERVER_PORT:-8080}:8080"
|
||||
depends_on:
|
||||
@@ -89,6 +138,8 @@ services:
|
||||
condition: service_healthy
|
||||
migrate:
|
||||
condition: service_completed_successfully
|
||||
s3-init:
|
||||
condition: service_completed_successfully
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:8080/health/ready"]
|
||||
interval: 10s
|
||||
@@ -102,3 +153,5 @@ volumes:
|
||||
name: mtusi-messenger-lab4-postgres18-data
|
||||
redis7-data:
|
||||
name: mtusi-messenger-lab4-redis7-data
|
||||
seaweedfs-data:
|
||||
name: mtusi-messenger-lab4-seaweedfs-data
|
||||
|
||||
Reference in New Issue
Block a user