Files
docker-compose/nextcloud/docker-compose.yml
T

150 lines
4.7 KiB
YAML
Raw Normal View History

2025-07-14 12:48:15 +05:30
# Nextcloud with PostgreSQL and Valkey Configuration
2025-07-10 16:05:52 +05:30
services:
2025-07-14 12:48:15 +05:30
# PostgreSQL Database Service
2025-07-10 16:05:52 +05:30
nextcloud_db:
2025-07-14 12:48:15 +05:30
# Basic container configuration
2025-07-10 16:05:52 +05:30
container_name: nextcloud_db
2025-07-13 18:35:45 +05:30
image: docker.io/library/postgres:17.5
restart: unless-stopped
2025-07-14 12:48:15 +05:30
# Database credentials
2025-07-10 16:05:52 +05:30
environment:
2025-07-14 12:48:15 +05:30
- POSTGRES_USER=${POSTGRES_USER} # Database username
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD} # Database password
- POSTGRES_DB=${POSTGRES_DB} # Database name
# Persistent storage configuration
2025-07-10 16:05:52 +05:30
volumes:
2025-07-14 12:48:15 +05:30
- ${APPDATA_PATH}/nextcloud/db:/var/lib/postgresql/data # Database files
# Network configuration
2025-07-10 16:05:52 +05:30
ports:
2025-07-14 12:48:15 +05:30
- ${DB_PORT}:5432 # PostgreSQL port
2025-07-10 16:05:52 +05:30
networks:
2025-07-14 12:48:15 +05:30
- backend # Connects to backend network
# Health monitoring
2025-07-10 16:05:52 +05:30
healthcheck:
test: ["CMD-SHELL", "pg_isready -d ${POSTGRES_DB} -U ${POSTGRES_USER}"]
2025-07-14 12:48:15 +05:30
start_period: 10s # Initial delay
interval: 10s # Check frequency
timeout: 5s # Timeout duration
retries: 3 # Retry attempts
2025-07-10 16:05:52 +05:30
2025-07-14 12:48:15 +05:30
# Valkey (Redis-compatible) Cache Service
2025-07-10 16:05:52 +05:30
nextcloud_valkey:
2025-07-14 12:48:15 +05:30
# Basic container configuration
2025-07-10 16:05:52 +05:30
container_name: nextcloud_valkey
2025-07-13 18:35:45 +05:30
image: docker.io/valkey/valkey:8.1.3
restart: unless-stopped
2025-07-14 12:48:15 +05:30
# Runtime configuration
command: valkey-server --save 60 1 --requirepass ${VALKEY_PASSWORD} # Persistence and auth
# Persistent storage configuration
2025-07-10 16:05:52 +05:30
volumes:
2025-07-14 12:48:15 +05:30
- ${APPDATA_PATH}/nextcloud/valkey:/data # Valkey data
# Network configuration
2025-07-10 16:05:52 +05:30
ports:
2025-07-14 12:48:15 +05:30
- ${VALKEY_PORT}:6379 # Valkey port
2025-07-10 16:05:52 +05:30
networks:
2025-07-14 12:48:15 +05:30
- backend # Connects to backend network
# Health monitoring
2025-07-10 16:05:52 +05:30
healthcheck:
test: ["CMD-SHELL", "echo 'auth ${VALKEY_PASSWORD}\nping' | valkey-cli | grep PONG"]
2025-07-14 12:48:15 +05:30
start_period: 20s # Initial delay
interval: 30s # Check frequency
retries: 5 # Retry attempts
timeout: 3s # Timeout duration
2025-07-10 16:05:52 +05:30
2025-07-14 12:48:15 +05:30
# Nextcloud Application Service
2025-07-10 16:05:52 +05:30
nextcloud_app:
image: docker.io/library/nextcloud:31.0.7
2025-07-10 16:05:52 +05:30
container_name: nextcloud_app
2025-07-13 18:35:45 +05:30
restart: unless-stopped
2025-07-10 16:05:52 +05:30
depends_on:
nextcloud_db:
condition: service_healthy
nextcloud_valkey:
condition: service_healthy
2025-07-14 12:48:15 +05:30
# Environment variables
2025-07-10 16:05:52 +05:30
environment:
2025-07-14 12:48:15 +05:30
# 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
2025-07-10 16:05:52 +05:30
volumes:
- ${APPDATA_PATH}/nextcloud/app:/var/www/html
2025-07-14 12:48:15 +05:30
# Network configuration
2025-07-10 16:05:52 +05:30
ports:
- ${APP_PORT}:80
networks:
2025-07-14 12:48:15 +05:30
- frontend # Connects to frontend network
- backend # Connects to backend network
2025-07-10 16:05:52 +05:30
2025-07-14 12:48:15 +05:30
# Nextcloud Cron Service
2025-07-10 16:47:19 +05:30
nextcloud_cron:
image: docker.io/library/nextcloud:31.0.7
2025-07-10 16:47:19 +05:30
container_name: nextcloud_cron
2025-07-13 18:35:45 +05:30
restart: unless-stopped
2025-07-10 16:47:19 +05:30
depends_on:
- nextcloud_app
2025-07-14 12:48:15 +05:30
# Entry point
2025-07-10 16:47:19 +05:30
entrypoint: /cron.sh
2025-07-14 12:48:15 +05:30
# Environment variables
2025-07-10 16:51:02 +05:30
environment:
2025-07-14 12:48:15 +05:30
# 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
2025-07-10 16:47:19 +05:30
volumes:
- ${APPDATA_PATH}/nextcloud/app:/var/www/html
2025-07-14 12:48:15 +05:30
# Network configuration
2025-07-10 16:47:19 +05:30
networks:
2025-07-14 12:48:15 +05:30
- frontend # Connects to frontend network
- backend # Connects to backend network
2025-07-10 16:47:19 +05:30
2025-07-14 12:48:15 +05:30
# External network definitions
2025-07-10 16:05:52 +05:30
networks:
frontend:
2025-07-14 12:48:15 +05:30
external: true # Uses pre-existing network
2025-07-10 16:05:52 +05:30
backend:
2025-07-14 12:48:15 +05:30
external: true # Uses pre-existing network