forked from mtusi2026/mtusi2026lab4
feat(lab4): private S3 attachments and safe storage reconciliation
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
FROM golang:1.24.2-alpine AS build
|
||||
RUN apk add --no-cache git
|
||||
RUN go install github.com/minio/mc@RELEASE.2025-04-16T18-13-26Z
|
||||
FROM alpine:3.21.3
|
||||
RUN apk add --no-cache ca-certificates
|
||||
COPY --from=build /go/bin/mc /usr/local/bin/mc
|
||||
ENTRYPOINT ["mc"]
|
||||
@@ -0,0 +1,7 @@
|
||||
FROM golang:1.24.2-alpine AS build
|
||||
RUN apk add --no-cache git
|
||||
RUN go install github.com/minio/minio@RELEASE.2025-04-22T22-12-26Z
|
||||
FROM alpine:3.21.3
|
||||
RUN apk add --no-cache ca-certificates curl
|
||||
COPY --from=build /go/bin/minio /usr/local/bin/minio
|
||||
ENTRYPOINT ["minio"]
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
mc alias set local http://s3:9000 "$(cat /run/secrets/minio_root_user)" "$(cat /run/secrets/minio_root_password)" >/dev/null
|
||||
mc mb --ignore-existing local/messenger-attachments >/dev/null
|
||||
mc anonymous set none local/messenger-attachments >/dev/null
|
||||
mc admin user add local "$(cat /run/secrets/s3_access_key_id)" "$(cat /run/secrets/s3_secret_access_key)" >/dev/null
|
||||
mc admin policy create local messenger /config/s3-policy.json >/dev/null
|
||||
mc admin policy attach local messenger --user "$(cat /run/secrets/s3_access_key_id)" >/dev/null
|
||||
echo 'Private bucket and scoped application user ready'
|
||||
@@ -0,0 +1,17 @@
|
||||
global
|
||||
maxconn 128
|
||||
defaults
|
||||
mode http
|
||||
timeout connect 2s
|
||||
timeout client 30s
|
||||
timeout server 30s
|
||||
frontend public
|
||||
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
|
||||
server api1 api1:8080 check
|
||||
server api2 api2:8080 check
|
||||
@@ -0,0 +1 @@
|
||||
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["s3:ListBucket"],"Resource":["arn:aws:s3:::messenger-attachments"]},{"Effect":"Allow","Action":["s3:GetObject","s3:PutObject","s3:DeleteObject"],"Resource":["arn:aws:s3:::messenger-attachments/originals/*"]}]}
|
||||
Reference in New Issue
Block a user