automa/nextcloud/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

75 lines
2.1 KiB
YAML

services:
nextcloud:
image: nextcloud:stable-apache
container_name: nextcloud
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
ports:
- "${NC_PORT:-8080}:80"
environment:
TZ: "${TZ:-Asia/Shanghai}"
NEXTCLOUD_ADMIN_USER: "${NC_ADMIN_USER:-admin}"
NEXTCLOUD_ADMIN_PASSWORD: "${NC_ADMIN_PASSWORD}"
NEXTCLOUD_TRUSTED_DOMAINS: "${NC_TRUSTED_DOMAINS:-localhost}"
MYSQL_HOST: db
MYSQL_DATABASE: "${MYSQL_DATABASE:-nextcloud}"
MYSQL_USER: "${MYSQL_USER:-nextcloud}"
MYSQL_PASSWORD: "${MYSQL_PASSWORD}"
REDIS_HOST: redis
REDIS_HOST_PASSWORD: "${REDIS_PASSWORD}"
volumes:
- nc-html:/var/www/html
- nc-data:/var/www/html/data
- nc-config:/var/www/html/config
- nc-apps:/var/www/html/custom_apps
healthcheck:
test: ["CMD", "curl", "-fSs", "http://localhost/status.php"]
interval: 30s
timeout: 5s
retries: 5
start_period: 60s
restart: unless-stopped
db:
image: mariadb:11
container_name: nextcloud-db
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW --innodb_read_only_compressed=OFF
environment:
TZ: "${TZ:-Asia/Shanghai}"
MYSQL_ROOT_PASSWORD: "${MYSQL_ROOT_PASSWORD}"
MYSQL_DATABASE: "${MYSQL_DATABASE:-nextcloud}"
MYSQL_USER: "${MYSQL_USER:-nextcloud}"
MYSQL_PASSWORD: "${MYSQL_PASSWORD}"
volumes:
- nc-db:/var/lib/mysql
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
restart: unless-stopped
redis:
image: redis:7-alpine
container_name: nextcloud-redis
command: ["redis-server", "--requirepass", "${REDIS_PASSWORD}"]
volumes:
- nc-redis:/data
healthcheck:
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
interval: 10s
timeout: 5s
retries: 3
restart: unless-stopped
volumes:
nc-html:
nc-data:
nc-config:
nc-apps:
nc-db:
nc-redis: