forked from mtusi2026/mtusi2026lab4
grade4
This commit is contained in:
+32
-4
@@ -60,6 +60,10 @@ services:
|
||||
- SESSION_TTL_SECONDS=3600
|
||||
- INSTANCE_ID=api-replica-1
|
||||
- SECRET_HMAC_KEY=${SECRET_HMAC_KEY}
|
||||
- S3_ENDPOINT=http://s3:8333
|
||||
- S3_BUCKET=messenger-attachments
|
||||
- S3_ACCESS_KEY_ID=appuser
|
||||
- S3_SECRET_ACCESS_KEY=appsecretpassword
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
@@ -72,6 +76,8 @@ services:
|
||||
condition: service_healthy
|
||||
migrate:
|
||||
condition: service_completed_successfully
|
||||
s3-init:
|
||||
condition: service_completed_successfully
|
||||
healthcheck:
|
||||
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8080/health/ready')"]
|
||||
interval: 5s
|
||||
@@ -87,6 +93,10 @@ services:
|
||||
- SESSION_TTL_SECONDS=3600
|
||||
- INSTANCE_ID=api-replica-2
|
||||
- SECRET_HMAC_KEY=${SECRET_HMAC_KEY}
|
||||
- S3_ENDPOINT=http://s3:8333
|
||||
- S3_BUCKET=messenger-attachments
|
||||
- S3_ACCESS_KEY_ID=appuser
|
||||
- S3_SECRET_ACCESS_KEY=appsecretpassword
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
@@ -99,6 +109,8 @@ services:
|
||||
condition: service_healthy
|
||||
migrate:
|
||||
condition: service_completed_successfully
|
||||
s3-init:
|
||||
condition: service_completed_successfully
|
||||
healthcheck:
|
||||
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8080/health/ready')"]
|
||||
interval: 5s
|
||||
@@ -129,11 +141,9 @@ services:
|
||||
image: chrislusf/seaweedfs:latest
|
||||
command: "mini -dir=/data"
|
||||
environment:
|
||||
- AWS_ACCESS_KEY_ID=minioadmin
|
||||
- AWS_SECRET_ACCESS_KEY=minioadminpassword
|
||||
- AWS_ACCESS_KEY_ID=appuser
|
||||
- AWS_SECRET_ACCESS_KEY=appsecretpassword
|
||||
- S3_BUCKET=messenger-attachments
|
||||
ports:
|
||||
- "8333:8333"
|
||||
volumes:
|
||||
- s3data:/data
|
||||
deploy:
|
||||
@@ -147,6 +157,24 @@ services:
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
|
||||
s3-init:
|
||||
image: python:3.11-slim
|
||||
volumes:
|
||||
- ./scripts:/scripts
|
||||
- ./requirements.txt:/requirements.txt
|
||||
environment:
|
||||
- S3_ENDPOINT=http://s3:8333
|
||||
- S3_BUCKET=messenger-attachments
|
||||
- S3_ROOT_ACCESS_KEY=appuser
|
||||
- S3_ROOT_SECRET_KEY=appsecretpassword
|
||||
command: >
|
||||
sh -c "pip install --no-cache-dir -r /requirements.txt &&
|
||||
python /scripts/bootstrap_s3.py"
|
||||
depends_on:
|
||||
s3:
|
||||
condition: service_healthy
|
||||
restart: "no"
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
redisdata:
|
||||
|
||||
Reference in New Issue
Block a user