# /opt/stacks/nextcloud/docker-compose.yml services: # ── PostgreSQL per a Nextcloud ─────────── db: container_name: nextcloud-db image: postgres:16-alpine restart: unless-stopped environment: TZ: Europe/Madrid POSTGRES_DB: nextcloud POSTGRES_USER: nextcloud POSTGRES_PASSWORD: '${POSTGRES_PASSWORD}' volumes: - nc_db:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U nextcloud -d nextcloud"] interval: 10s timeout: 5s retries: 5 start_period: 30s networks: [nc_net] # ── Redis per a cache i sessions ───────── redis: container_name: nextcloud-redis image: redis:7.4-alpine restart: unless-stopped command: redis-server --requirepass '${REDIS_PASSWORD}' healthcheck: test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"] interval: 10s timeout: 5s retries: 5 start_period: 15s networks: [nc_net] # ── Nextcloud ──────────────────────────── nextcloud: container_name: nextcloud image: nextcloud:33-apache # Actualitzat a darrera versió estable restart: unless-stopped environment: TZ: Europe/Madrid # Connexió a PostgreSQL POSTGRES_HOST: db POSTGRES_DB: nextcloud POSTGRES_USER: nextcloud POSTGRES_PASSWORD: '${POSTGRES_PASSWORD}' # Connexió a Redis REDIS_HOST: redis REDIS_HOST_PASSWORD: '${REDIS_PASSWORD}' # Compte administrador inicial (només s'usa en la primera instal·lació) NEXTCLOUD_ADMIN_USER: '${NC_ADMIN_USER}' NEXTCLOUD_ADMIN_PASSWORD: '${NC_ADMIN_PASSWORD}' # Domini de confiança (obligatori!) NEXTCLOUD_TRUSTED_DOMAINS: 'cloud.el-meu-domini.com' # Configuració per a reverse proxy — genera URLs correctes OVERWRITEPROTOCOL: https OVERWRITECLIURL: 'https://cloud.el-meu-domini.com' TRUSTED_PROXIES: '172.16.0.0/12' # Rang de xarxes Docker internes # PHP — memòria i temps màxim PHP_MEMORY_LIMIT: 512M PHP_UPLOAD_LIMIT: 10G volumes: - nc_html:/var/www/html - nc_data:/var/www/html/data ports: - "127.0.0.1:8081:80" # Només local → via Nginx Proxy Manager healthcheck: test: ["CMD", "curl", "-f", "http://localhost/status.php"] interval: 30s timeout: 10s retries: 5 start_period: 60s # Nextcloud triga a instal·lar-se la 1a vegada depends_on: db: condition: service_healthy redis: condition: service_healthy networks: [nc_net, shared_net] # ── Cron: tasques programades de Nextcloud ── cron: container_name: nextcloud-cron image: nextcloud:33-apache # Mateixa versió que nextcloud! restart: unless-stopped entrypoint: /cron.sh environment: TZ: Europe/Madrid volumes: - nc_html:/var/www/html - nc_data:/var/www/html/data depends_on: nextcloud: condition: service_healthy # Espera que Nextcloud estigui llest networks: [nc_net] volumes: nc_db: nc_html: nc_data: networks: nc_net: driver: bridge shared_net: external: true name: shared_net