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

chore(infra): record coolify caddy changes and apply dns-01 challenge as acme protocol #2342

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
14 changes: 14 additions & 0 deletions apps/infra/stage/coolify/caddy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Not included in CI/CD. Should be built manually

ARG CADDY_VERSION=2.8.4
FROM caddy:${CADDY_VERSION}-builder AS builder

RUN xcaddy build \
--with github.com/lucaslorentz/caddy-docker-proxy/v2 \
--with github.com/caddy-dns/route53

FROM caddy:${CADDY_VERSION}-alpine

COPY --from=builder /usr/bin/caddy /usr/bin/caddy

CMD ["caddy", "docker-proxy"]
13 changes: 13 additions & 0 deletions apps/infra/stage/coolify/caddy/acme-challenge.caddy
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Not included in CI/CD. Should be added in coolify manually

*.coolify.codedang.com, coolify.codedang.com {
tls {
dns route53 {
wait_for_propagation true # should be set true
# access_key_id $AWS_ACCESS_KEY_ID # $AWS_ACCESS_KEY_ID should be set as environmental variable in coolify's docker-compose.yml
# secret_access_key $AWS_SECRET_ACCESS_KEY # $AWS_SECRET_ACCESS_KEY should be set as environmental variable in coolify's docker-compose.yml
# region $AWS_REGION # $AWS_REGION should be set as environmental variable in coolify's docker-compose.yml
}
}
reverse_proxy localhost:5525 # route to frontend stage/preview deployments.
}
31 changes: 31 additions & 0 deletions apps/infra/stage/coolify/caddy/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
networks:
coolify:
external: true
services:
caddy:
container_name: coolify-proxy
image: 'jimin9038/caddy-docker-proxy-with-route53'
restart: unless-stopped
extra_hosts:
- 'host.docker.internal:host-gateway'
environment:
- CADDY_DOCKER_POLLING_INTERVAL=5s
- CADDY_DOCKER_CADDYFILE_PATH=/dynamic/Caddyfile
# For using DNS-01 challenge in Caddy, make an access key having access to use route53 - see: https://github.com/libdns/route53
- AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
- AWS_REGION=us-east-1
networks:
- coolify
ports:
- '80:80'
- '443:443'
- '443:443/udp'
labels:
- coolify.managed=true
- coolify.proxy=true
volumes:
- '/var/run/docker.sock:/var/run/docker.sock:ro'
- '/data/coolify/proxy/caddy/dynamic:/dynamic'
- '/data/coolify/proxy/caddy/config:/config'
- '/data/coolify/proxy/caddy/data:/data'