a462ff1729
- ansible.cfg: suppress Python interpreter discovery warning - ansible/inventory.ini: add ansible_host; server IP is now defined in one place and read dynamically by run-bootstrap.sh - group_vars/all/ → directory layout so vault.yml is auto-loaded by Ansible (previously vault.yml did not match any group name and was silently ignored) - scripts/run-bootstrap.sh: read server IP from inventory, chmod 600 private keys automatically, show actual SSH error when root login fails - scripts/bootstrap-deploy-user.sh: add sudoers.d entry for passwordless sudo (deploy user has no password so sudo group membership alone was not enough) - nextcloud: fix Redis healthcheck (CMD-SHELL pipe was unreliable in Alpine, switched to CMD form with start_period) - group_vars/all/vars.yml: fix Roundcube image tag (1.6-apache and 1.6 do not exist; correct tag is 1.6.x-apache) - docs/runbook.md: expand prerequisites (SSH keys section), add step 1 for setting the server IP, expand bootstrap step with preflight detail, fix step numbering
104 lines
3.6 KiB
Django/Jinja
104 lines
3.6 KiB
Django/Jinja
# Managed by Ansible — do not edit manually
|
|
services:
|
|
nextcloud-db:
|
|
image: postgres:{{ nextcloud_db_version }}
|
|
container_name: nextcloud-db
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_USER: nextcloud
|
|
POSTGRES_PASSWORD: "{{ nextcloud_db_password }}"
|
|
POSTGRES_DB: nextcloud
|
|
volumes:
|
|
- {{ nextcloud_data_dir }}/db:/var/lib/postgresql/data
|
|
networks:
|
|
- nextcloud_internal
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U nextcloud"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
nextcloud-redis:
|
|
image: redis:7-alpine
|
|
container_name: nextcloud-redis
|
|
restart: unless-stopped
|
|
command: --save 60 1 --loglevel warning
|
|
volumes:
|
|
- {{ nextcloud_data_dir }}/redis:/data
|
|
networks:
|
|
- nextcloud_internal
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 10s
|
|
|
|
nextcloud:
|
|
image: nextcloud:{{ nextcloud_version }}
|
|
container_name: nextcloud
|
|
restart: unless-stopped
|
|
environment:
|
|
# Database
|
|
POSTGRES_HOST: nextcloud-db
|
|
POSTGRES_DB: nextcloud
|
|
POSTGRES_USER: nextcloud
|
|
POSTGRES_PASSWORD: "{{ nextcloud_db_password }}"
|
|
# Redis — used for file locking and memcache
|
|
REDIS_HOST: nextcloud-redis
|
|
# Admin bootstrap (only used on first start)
|
|
NEXTCLOUD_ADMIN_USER: "{{ nextcloud_admin_user }}"
|
|
NEXTCLOUD_ADMIN_PASSWORD: "{{ nextcloud_admin_password }}"
|
|
# URLs — must match external domain; tells Nextcloud it's behind an HTTPS proxy
|
|
NEXTCLOUD_TRUSTED_DOMAINS: "{{ domain_nextcloud }}"
|
|
OVERWRITEPROTOCOL: https
|
|
OVERWRITECLIURL: "https://{{ domain_nextcloud }}"
|
|
OVERWRITEHOST: "{{ domain_nextcloud }}"
|
|
# PHP limits for large file uploads
|
|
PHP_MEMORY_LIMIT: 512M
|
|
PHP_UPLOAD_LIMIT: 512M
|
|
volumes:
|
|
- {{ nextcloud_data_dir }}/html:/var/www/html
|
|
networks:
|
|
- traefik_public
|
|
- nextcloud_internal
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.routers.nextcloud.rule=Host(`{{ domain_nextcloud }}`)"
|
|
- "traefik.http.routers.nextcloud.entrypoints=websecure"
|
|
- "traefik.http.routers.nextcloud.tls.certresolver=letsencrypt"
|
|
- "traefik.http.services.nextcloud.loadbalancer.server.port=80"
|
|
- "traefik.http.routers.nextcloud.middlewares=nextcloud-wellknown,nextcloud-headers"
|
|
# Redirect .well-known CalDAV/CardDAV to the proper Nextcloud endpoint
|
|
- "traefik.http.middlewares.nextcloud-wellknown.redirectregex.regex=^https://([^/]*)/.well-known/(card|cal)dav"
|
|
- "traefik.http.middlewares.nextcloud-wellknown.redirectregex.replacement=https://$$1/remote.php/dav/"
|
|
- "traefik.http.middlewares.nextcloud-wellknown.redirectregex.permanent=true"
|
|
# Security headers recommended by Nextcloud
|
|
- "traefik.http.middlewares.nextcloud-headers.headers.stsSeconds=15552000"
|
|
- "traefik.http.middlewares.nextcloud-headers.headers.stsIncludeSubdomains=true"
|
|
- "traefik.http.middlewares.nextcloud-headers.headers.stsPreload=true"
|
|
depends_on:
|
|
nextcloud-db:
|
|
condition: service_healthy
|
|
nextcloud-redis:
|
|
condition: service_healthy
|
|
|
|
# Runs Nextcloud background jobs on a 5-minute schedule (replaces webcron/ajax cron)
|
|
nextcloud-cron:
|
|
image: nextcloud:{{ nextcloud_version }}
|
|
container_name: nextcloud-cron
|
|
restart: unless-stopped
|
|
entrypoint: /cron.sh
|
|
volumes:
|
|
- {{ nextcloud_data_dir }}/html:/var/www/html
|
|
networks:
|
|
- nextcloud_internal
|
|
depends_on:
|
|
- nextcloud
|
|
|
|
networks:
|
|
traefik_public:
|
|
external: true
|
|
nextcloud_internal:
|
|
internal: true
|