131 lines
4.2 KiB
YAML
131 lines
4.2 KiB
YAML
# Nextcloud with PostgreSQL and Valkey Configuration
|
|
services:
|
|
# PostgreSQL Database Service
|
|
nextcloud_db:
|
|
# Basic container configuration
|
|
container_name: nextcloud_db
|
|
image: docker.io/library/postgres:17.5
|
|
restart: unless-stopped
|
|
|
|
# Database credentials
|
|
environment:
|
|
- POSTGRES_USER=${POSTGRES_USER} # Database username
|
|
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD} # Database password
|
|
- POSTGRES_DB=${POSTGRES_DB} # Database name
|
|
|
|
# Persistent storage configuration
|
|
volumes:
|
|
- ${APPDATA_PATH}/nextcloud/db:/var/lib/postgresql/data # Database files
|
|
|
|
# Network configuration
|
|
ports:
|
|
- ${DB_PORT}:5432 # PostgreSQL port
|
|
|
|
# Health monitoring
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -d ${POSTGRES_DB} -U ${POSTGRES_USER}"]
|
|
start_period: 10s # Initial delay
|
|
interval: 10s # Check frequency
|
|
timeout: 5s # Timeout duration
|
|
retries: 3 # Retry attempts
|
|
|
|
# Valkey (Redis-compatible) Cache Service
|
|
nextcloud_valkey:
|
|
# Basic container configuration
|
|
container_name: nextcloud_valkey
|
|
image: docker.io/valkey/valkey:8.1.3
|
|
restart: unless-stopped
|
|
|
|
# Runtime configuration
|
|
command: valkey-server --save 60 1 --requirepass ${VALKEY_PASSWORD} # Persistence and auth
|
|
|
|
# Persistent storage configuration
|
|
volumes:
|
|
- ${APPDATA_PATH}/nextcloud/valkey:/data # Valkey data
|
|
|
|
# Network configuration
|
|
ports:
|
|
- ${VALKEY_PORT}:6379 # Valkey port
|
|
|
|
# Health monitoring
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "echo 'auth ${VALKEY_PASSWORD}\nping' | valkey-cli | grep PONG"]
|
|
start_period: 20s # Initial delay
|
|
interval: 30s # Check frequency
|
|
retries: 5 # Retry attempts
|
|
timeout: 3s # Timeout duration
|
|
|
|
# Nextcloud Application Service
|
|
nextcloud_app:
|
|
image: docker.io/library/nextcloud:31.0.7
|
|
container_name: nextcloud_app
|
|
restart: unless-stopped
|
|
depends_on:
|
|
nextcloud_db:
|
|
condition: service_healthy
|
|
nextcloud_valkey:
|
|
condition: service_healthy
|
|
|
|
# Environment variables
|
|
environment:
|
|
# Database configuration
|
|
- POSTGRES_HOST=nextcloud_db:5432 # PostgreSQL host and port
|
|
- POSTGRES_DB=${POSTGRES_DB} # Database name
|
|
- POSTGRES_USER=${POSTGRES_USER} # Database username
|
|
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD} # Database password
|
|
|
|
# Redis/Valkey cache configuration
|
|
- REDIS_HOST=nextcloud_valkey # Valkey hostname
|
|
- REDIS_HOST_PORT=6379 # Valkey port
|
|
- REDIS_HOST_PASSWORD=${VALKEY_PASSWORD} # Valkey authentication
|
|
|
|
# PHP performance tuning
|
|
- PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT} # Memory allocation
|
|
- PHP_UPLOAD_LIMIT=${PHP_UPLOAD_LIMIT} # Max upload size
|
|
|
|
# Security settings
|
|
- APACHE_DISABLE_REWRITE_IP=${APACHE_DISABLE_REWRITE_IP} # IP address handling
|
|
|
|
# Persistent storage configuration
|
|
volumes:
|
|
- ${APPDATA_PATH}/nextcloud/app:/var/www/html
|
|
|
|
# Network configuration
|
|
ports:
|
|
- ${APP_PORT}:80
|
|
|
|
# Nextcloud Cron Service
|
|
nextcloud_cron:
|
|
image: docker.io/library/nextcloud:31.0.7
|
|
container_name: nextcloud_cron
|
|
restart: unless-stopped
|
|
depends_on:
|
|
- nextcloud_app
|
|
|
|
# Entry point
|
|
entrypoint: /cron.sh
|
|
|
|
# Environment variables
|
|
environment:
|
|
# Database configuration
|
|
- POSTGRES_HOST=nextcloud_db:5432 # PostgreSQL host and port
|
|
- POSTGRES_DB=${POSTGRES_DB} # Database name
|
|
- POSTGRES_USER=${POSTGRES_USER} # Database username
|
|
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD} # Database password
|
|
|
|
# Redis/Valkey cache configuration
|
|
- REDIS_HOST=nextcloud_valkey # Valkey hostname
|
|
- REDIS_HOST_PORT=6379 # Valkey port
|
|
- REDIS_HOST_PASSWORD=${VALKEY_PASSWORD} # Valkey authentication
|
|
|
|
# PHP performance tuning
|
|
- PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT} # Memory allocation
|
|
- PHP_UPLOAD_LIMIT=${PHP_UPLOAD_LIMIT} # Max upload size
|
|
|
|
# Security settings
|
|
- APACHE_DISABLE_REWRITE_IP=${APACHE_DISABLE_REWRITE_IP} # IP address handling
|
|
|
|
# Persistent storage configuration
|
|
volumes:
|
|
- ${APPDATA_PATH}/nextcloud/app:/var/www/html
|