Skip to content

Commit

Permalink
caddy SHOULD work
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikvtcodes committed Dec 22, 2023
1 parent fceab85 commit 0eac11c
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docker/proxy/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Cloudflare
CF_API_TOKEN=

# Domains
AUTH_DOMAIN=auth.orangeunilabs.com
GIT_DOMAIN=git.orangeunilabs.com
STATUS_PAGE_DOMAIN=status.orangeunilabs.com
23 changes: 23 additions & 0 deletions docker/proxy/Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
tls {
dns cloudflare {env.CF_API_TOKEN}
resolvers 1.1.1.1
}

servers {
metrics
}

# Uptime Kuma
{env.STATUS_PAGE_DOMAIN} {
reverse_proxy uptime:3001
}

# Authentik
{env.AUTH_DOMAIN} {
reverse_proxy auth:9000
}

# Git (Forgejo/Gitea - not sure which as of yet)
{env.GIT_DOMAIN} {
reverse_proxy git:3000
}
10 changes: 10 additions & 0 deletions docker/proxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ARG VERSION=2.7

FROM caddy:${VERSION}-builder-alpine AS builder

RUN xcaddy build \
--with github.com/caddy-dns/cloudflare

FROM caddy:${VERSION}-alpine

COPY --from=builder /usr/bin/caddy /usr/bin/caddy
9 changes: 9 additions & 0 deletions docker/proxy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# proxy

This folder contains the setup for using Caddy with Cloudflare & the ACME DNS01 challenge

# Environment Variables

| Variable | Description |
| -------------- | -------------------------------------------------------------------- |
| `CF_API_TOKEN` | Cloudflare API Token with Zone-Zone-Read & Zone-DNS-Edit permissions |
26 changes: 26 additions & 0 deletions docker/proxy/compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: "3.9"

services:
caddy:
build: ./Dockerfile
container_name: caddy
hostname: caddy
restart: unless-stopped
networks:
- proxynet
ports:
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- ./data:/data
- ./config:/config

env_file:
- .env

networks:
proxynet:
attachable: true
driver: bridge
3 changes: 3 additions & 0 deletions docker/proxy/reload.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# !/bin/bash
# Reload the caddy container to apply changes without downtime
docker exec -w /etc/caddy caddy caddy reload

0 comments on commit 0eac11c

Please sign in to comment.