Implement lab4 S3 attachments and reliability checks
This commit is contained in:
+120
@@ -0,0 +1,120 @@
|
||||
services:
|
||||
s3:
|
||||
image: chrislusf/seaweedfs:4.44
|
||||
entrypoint: ["weed"]
|
||||
command:
|
||||
- mini
|
||||
- -dir=/data
|
||||
- -ip=s3
|
||||
- -ip.bind=0.0.0.0
|
||||
- -admin.ui=false
|
||||
- -bucket=messenger-attachments
|
||||
- -s3.port=9000
|
||||
- -s3.config=/run/secrets/s3_config
|
||||
- -s3.iam=false
|
||||
- -s3.port.iceberg=0
|
||||
- -s3.port.lance=0
|
||||
volumes:
|
||||
- s3_data:/data
|
||||
secrets:
|
||||
- s3_config
|
||||
cpus: "1.0"
|
||||
mem_limit: 768m
|
||||
stop_grace_period: 20s
|
||||
restart: unless-stopped
|
||||
|
||||
s3-check:
|
||||
build:
|
||||
context: .
|
||||
image: mtusi-messenger:lab4
|
||||
command: ["python", "-m", "app.s3_check"]
|
||||
environment:
|
||||
S3_ENDPOINT: http://s3:9000
|
||||
S3_REGION: us-east-1
|
||||
S3_BUCKET: messenger-attachments
|
||||
S3_ACCESS_KEY_ID_FILE: /run/secrets/s3_access_key_id
|
||||
S3_SECRET_ACCESS_KEY_FILE: /run/secrets/s3_secret_access_key
|
||||
secrets:
|
||||
- s3_access_key_id
|
||||
- s3_secret_access_key
|
||||
depends_on:
|
||||
s3:
|
||||
condition: service_started
|
||||
healthcheck:
|
||||
disable: true
|
||||
cpus: "0.5"
|
||||
mem_limit: 256m
|
||||
restart: "no"
|
||||
|
||||
migrate:
|
||||
image: mtusi-messenger:lab4
|
||||
|
||||
api:
|
||||
image: mtusi-messenger:lab4
|
||||
environment:
|
||||
S3_ENDPOINT: http://s3:9000
|
||||
S3_REGION: us-east-1
|
||||
S3_BUCKET: messenger-attachments
|
||||
S3_ACCESS_KEY_ID_FILE: /run/secrets/s3_access_key_id
|
||||
S3_SECRET_ACCESS_KEY_FILE: /run/secrets/s3_secret_access_key
|
||||
secrets:
|
||||
- s3_access_key_id
|
||||
- s3_secret_access_key
|
||||
depends_on:
|
||||
s3-check:
|
||||
condition: service_completed_successfully
|
||||
|
||||
|
||||
cleanup:
|
||||
build:
|
||||
context: .
|
||||
image: mtusi-messenger:lab4
|
||||
command:
|
||||
- python
|
||||
- -m
|
||||
- app.cleanup_orphans
|
||||
- --apply
|
||||
- --grace-seconds
|
||||
- "86400"
|
||||
- --interval-seconds
|
||||
- "3600"
|
||||
environment:
|
||||
PGHOST: postgres
|
||||
PGPORT: "5432"
|
||||
PGDATABASE: messenger
|
||||
PGUSER: messenger
|
||||
PGPASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}
|
||||
S3_ENDPOINT: http://s3:9000
|
||||
S3_REGION: us-east-1
|
||||
S3_BUCKET: messenger-attachments
|
||||
S3_ACCESS_KEY_ID_FILE: /run/secrets/s3_access_key_id
|
||||
S3_SECRET_ACCESS_KEY_FILE: /run/secrets/s3_secret_access_key
|
||||
secrets:
|
||||
- s3_access_key_id
|
||||
- s3_secret_access_key
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
migrate:
|
||||
condition: service_completed_successfully
|
||||
s3-check:
|
||||
condition: service_completed_successfully
|
||||
api:
|
||||
condition: service_started
|
||||
healthcheck:
|
||||
disable: true
|
||||
cpus: "0.25"
|
||||
mem_limit: 256m
|
||||
stop_grace_period: 30s
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
s3_data:
|
||||
|
||||
secrets:
|
||||
s3_config:
|
||||
file: ./secrets/s3_config.json
|
||||
s3_access_key_id:
|
||||
file: ./secrets/s3_access_key_id
|
||||
s3_secret_access_key:
|
||||
file: ./secrets/s3_secret_access_key
|
||||
Reference in New Issue
Block a user