feat(tunnels): switch to temporary Cloudflare tunnels

Replace persistent Cloudflare tunnels (API-based) with temporary tunnels using
'cloudflared tunnel --url'. This removes the need for Cloudflare API tokens,
DNS records, and persistent tunnel management.

Changes:
- Install cloudflared binary in API Dockerfile
- Add start_cloudflared_tunnel() and stop_cloudflared_tunnel() to docker.py
- Update instance start/stop/restart/delete to use temporary tunnels
- Store tunnel PID in tunnel_id field, temporary URL in url/public_url
- Remove Cloudflare API service (cloudflare_tunnel.py)
- Remove cloudflared container from docker-compose
- Remove Cloudflare env vars (CLOUDFLARE_API_TOKEN, ZONE_ID, etc.)
- Remove Cloudflare configuration from config.py
- Remove Cloudflare startup check from main.py
- Remove /health/cloudflare endpoint
This commit is contained in:
Fusion
2026-05-20 16:23:16 +02:00
parent 23ae12e69c
commit 2bd778117f
8 changed files with 113 additions and 476 deletions
-20
View File
@@ -91,17 +91,11 @@ services:
AUTHENTIK_APPLICATION_SLUG: ${AUTHENTIK_APPLICATION_SLUG:-headquarter-web}
AUTHENTIK_AUTHORIZE_URL: ${AUTHENTIK_AUTHORIZE_URL:-}
AUTHENTIK_TOKEN_URL: ${AUTHENTIK_TOKEN_URL:-}
CLOUDFLARE_API_TOKEN: ${CLOUDFLARE_API_TOKEN}
CLOUDFLARE_ZONE_ID: ${CLOUDFLARE_ZONE_ID}
CLOUDFLARE_ACCOUNT_ID: ${CLOUDFLARE_ACCOUNT_ID}
CLOUDFLARE_BASE_DOMAIN: ${CLOUDFLARE_BASE_DOMAIN}
CLOUDFLARED_CONFIG_DIR: /etc/cloudflared
volumes:
- repo_data:/data/repos
- instance_data:/data/instances
- avatar_uploads:/app/uploads
- /var/run/docker.sock:/var/run/docker.sock
- cloudflared_config:/etc/cloudflared
depends_on:
postgres:
condition: service_healthy
@@ -119,26 +113,12 @@ services:
- "traefik.http.routers.headquarter-api.tls.certresolver=${TRAEFIK_CERT_RESOLVER:-letsencrypt}"
- "traefik.http.services.headquarter-api.loadbalancer.server.port=8000"
# Cloudflare Tunnel
cloudflared:
image: cloudflare/cloudflared:latest
container_name: hq-cloudflared
command: tunnel --config /etc/cloudflared/config.yml run
volumes:
- cloudflared_config:/etc/cloudflared
networks:
- backend
restart: unless-stopped
depends_on:
- headquarter-api
volumes:
postgres_data:
redis_data:
repo_data:
instance_data:
avatar_uploads:
cloudflared_config:
networks:
backend: