Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates #12

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions e2e/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ services:
protocol: tcp
mode: host
environment:
- "S3_BUCKET="
- "S3_ACCESS_ID="
- "S3_SECRET_KEY="
- "AWS_BUCKET="
- "AWS_ACCESS_KEY_ID="
- "AWS_SECRET_ACCESS_KEY="
- ADMIN_UI_URL=${ADMIN_UI_URL}
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
Expand Down
13 changes: 5 additions & 8 deletions rootfs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@ FROM caddy:2.8.4-builder as builder

RUN xcaddy build \
--with github.com/ss098/certmagic-s3 \
--with github.com/lucaslorentz/caddy-docker-proxy@v2.8.4
--with github.com/lucaslorentz/caddy-docker-proxy@v2.9.1

FROM caddy:2.8.4

LABEL org.opencontainers.image.description "A Caddy reverse proxy with s3 storage for certmagic, service discovery via labels"

ENV S3_BUCKET ""
ENV S3_ACCESS_ID ""
ENV S3_SECRET_KEY ""
ENV AWS_ENDPOINT=https://s3.storage.planetary-networks.de

# optional
ENV S3_HOST "s3.storage.planetary-networks.de"
ENV S3_PREFIX ""
ENV S3_INSECURE "false"
ENV AWS_BUCKET=""
ENV AWS_ACCESS_KEY_ID=""
ENV AWS_SECRET_ACCESS_KEY=""

WORKDIR /
ADD . .
Expand Down
48 changes: 48 additions & 0 deletions rootfs/etc/quantum-caddy/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,54 @@
servers {
metrics
}

@s3storage {
storage s3 {
s3_force_path_style true
endpoint {env.AWS_ENDPOINT}
bucket {env.AWS_BUCKET}
region us-east-1
access_key_id {env.AWS_ACCESS_KEY_ID}
secret_access_key {env.AWS_SECRET_ACCESS_KEY}
}
}

# conditionally enable s3-certmagic only when AWS_ACCESS_KEY_ID is set
{if {env.AWS_ACCESS_KEY_ID} {len} > 0} {
import @s3storage
}
}

# cors import
(cors) {
@cors_preflight {
method OPTIONS
header Origin *
header Access-Control-Request-Method *
}

@cors {
header Origin *
}

handle @cors_preflight {
header Access-Control-Allow-Origin "{args.0}"
header Access-Control-Allow-Methods "{args.1}" {
GET, POST, PUT, DELETE, OPTIONS
}
header Access-Control-Allow-Headers "Content-Type"
header Access-Control-Allow-Credentials true
respond 204
}

handle @cors {
header Access-Control-Allow-Origin "{args.0}"
header Access-Control-Allow-Methods "{args.1}" {
GET, POST, PUT, DELETE, OPTIONS
}
header Access-Control-Allow-Headers "Content-Type"
header Access-Control-Allow-Credentials true
}
}

# admin-ui host
Expand Down