forked from mtusi2026/mtusi2026lab5
Implement lab 5 durable image processing worker
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
global
|
||||
maxconn 512
|
||||
defaults
|
||||
mode http
|
||||
timeout connect 1s
|
||||
timeout client 30s
|
||||
timeout server 30s
|
||||
timeout check 1s
|
||||
retries 0
|
||||
resolvers docker
|
||||
nameserver dns 127.0.0.11:53
|
||||
resolve_retries 2
|
||||
timeout resolve 1s
|
||||
timeout retry 1s
|
||||
hold valid 1s
|
||||
hold obsolete 1s
|
||||
hold nx 1s
|
||||
frontend ingress
|
||||
bind :8080
|
||||
default_backend api
|
||||
backend api
|
||||
balance roundrobin
|
||||
option httpchk GET /health/ready
|
||||
http-check expect status 200
|
||||
default-server inter 1s fall 2 rise 1 resolvers docker init-addr libc,none
|
||||
server api1 api1:8080 check
|
||||
server api2 api2:8080 check
|
||||
frontend object_ingress
|
||||
bind :9000
|
||||
default_backend objects
|
||||
backend objects
|
||||
option httpchk GET /minio/health/live
|
||||
http-check expect status 200
|
||||
server storage minio:9000 check inter 1s fall 1 rise 1 resolvers docker init-addr libc,none
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
root_user=$(cat /run/secrets/s3_root_user)
|
||||
root_password=$(cat /run/secrets/s3_root_password)
|
||||
app_user=$(cat /run/secrets/s3_access_key)
|
||||
app_password=$(cat /run/secrets/s3_secret_key)
|
||||
attempt=0
|
||||
until mc alias set local http://minio:9000 "$root_user" "$root_password" >/dev/null 2>&1; do
|
||||
attempt=$((attempt+1)); [ "$attempt" -lt 60 ] || exit 1; sleep 1
|
||||
done
|
||||
mc mb --ignore-existing local/messenger >/dev/null
|
||||
mc anonymous set none local/messenger >/dev/null
|
||||
mc admin user add local "$app_user" "$app_password" >/dev/null
|
||||
mc admin policy create local messenger-app /bootstrap/policy.json >/dev/null
|
||||
mc admin policy attach local messenger-app --user "$app_user" >/dev/null
|
||||
echo 'Private bucket and scoped application identity ready'
|
||||
@@ -0,0 +1 @@
|
||||
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["s3:GetBucketLocation"],"Resource":["arn:aws:s3:::messenger"]},{"Effect":"Allow","Action":["s3:GetObject","s3:PutObject","s3:DeleteObject"],"Resource":["arn:aws:s3:::messenger/original/*","arn:aws:s3:::messenger/staging/*","arn:aws:s3:::messenger/variants/*"]}]}
|
||||
Reference in New Issue
Block a user