automa/tailscale/compose.yaml
m1ngsama 1ef24b3be8 improve: best-practice configs for all projects, CLI UX overhaul
Compose improvements:
- forgejo: add healthcheck (/api/healthz), ROOT_URL + SSH_PORT env, LFS
- tailscale: drop redundant privileged (use cap_add only), use devices
  for /dev/net/tun, mount /lib/modules, reliable healthcheck (tailscale
  status), profiles for opt-in DERP, headscale comment in .env.example
- uptime-kuma: add built-in healthcheck (extra/healthcheck)
- filesuite: add healthchecks for both cloudreve and qbittorrent
- minecraft: add mc-health check (built into itzg image), simplify volumes
- teamspeak: add healthcheck via ServerQuery (nc localhost 10011)
- nextcloud: add healthchecks for all 3 services, depends_on with
  service_healthy conditions so startup order is correct

CLI improvements:
- Fix docker compose detection (was broken with space in arg)
- Use global array for project discovery (no word-splitting bugs)
- Empty selection no longer defaults to "all" (safety)
- Show .env.example comments as hints during interactive configure
- Required fields (empty default) loop until user provides a value
- Disable colors when stdout is not a terminal
- compose() wrapper auto-adds --env-file
- Deduplicate project_exists / project_dir helpers
2026-04-15 10:02:41 +08:00

52 lines
1.5 KiB
YAML

services:
tailscale:
image: tailscale/tailscale:latest
container_name: tailscale
hostname: "${TS_HOSTNAME}"
profiles: ["tailscale", "derp"]
cap_add:
- NET_ADMIN
- SYS_MODULE
- NET_RAW
devices:
- /dev/net/tun:/dev/net/tun
network_mode: host
environment:
TS_AUTHKEY: "${TS_AUTHKEY}"
TS_EXTRA_ARGS: "${TS_EXTRA_ARGS:---advertise-tags=tag:container}"
TS_STATE_DIR: /var/lib/tailscale
TS_SOCKET: /var/run/tailscale/tailscaled.sock
TS_USERSPACE: "${TS_USERSPACE:-false}"
TS_DEBUG_FIREWALL_MODE: "${TS_FIREWALL_MODE:-nftables}"
TS_HOSTNAME: "${TS_HOSTNAME}"
TZ: "${TZ:-Asia/Shanghai}"
volumes:
- ./tailscale-data:/var/lib/tailscale
- /var/run/tailscale:/var/run/tailscale
- /lib/modules:/lib/modules:ro
healthcheck:
test: ["CMD-SHELL", "tailscale status"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
restart: unless-stopped
derp-server:
image: ghcr.io/nbtca/tailscale-derp:edge
container_name: tailscale-derp
profiles: ["derp"]
network_mode: host
depends_on:
tailscale:
condition: service_healthy
environment:
TZ: "${TZ:-Asia/Shanghai}"
DERP_HOST: "${DERP_HOST}"
DERP_PORT: "${DERP_PORT:-443}"
STUN_PORT: "${STUN_PORT:-3478}"
HTTP_PORT: "-1"
VERIFY_CLIENTS: "true"
volumes:
- /var/run/tailscale:/var/run/tailscale
restart: unless-stopped