Adding comprehensive comments

This commit is contained in:
2025-07-14 12:48:15 +05:30
parent e57dfa763e
commit ff5ae47bef
22 changed files with 683 additions and 329 deletions

View File

@@ -1,43 +1,65 @@
# 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}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
- 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
- ${APPDATA_PATH}/nextcloud/db:/var/lib/postgresql/data # Database files
# Network configuration
ports:
- ${DB_PORT}:5432
- ${DB_PORT}:5432 # PostgreSQL port
networks:
- backend
- backend # Connects to backend network
# Health monitoring
healthcheck:
test: ["CMD-SHELL", "pg_isready -d ${POSTGRES_DB} -U ${POSTGRES_USER}"]
start_period: 10s
interval: 10s
timeout: 5s
retries: 3
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
command: valkey-server --save 60 1 --requirepass ${VALKEY_PASSWORD}
# Runtime configuration
command: valkey-server --save 60 1 --requirepass ${VALKEY_PASSWORD} # Persistence and auth
# Persistent storage configuration
volumes:
- ${APPDATA_PATH}/nextcloud/valkey:/data
- ${APPDATA_PATH}/nextcloud/valkey:/data # Valkey data
# Network configuration
ports:
- ${VALKEY_PORT}:6379
- ${VALKEY_PORT}:6379 # Valkey port
networks:
- backend
- backend # Connects to backend network
# Health monitoring
healthcheck:
test: ["CMD-SHELL", "echo 'auth ${VALKEY_PASSWORD}\nping' | valkey-cli | grep PONG"]
start_period: 20s
interval: 30s
retries: 5
timeout: 3s
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
@@ -47,51 +69,81 @@ services:
condition: service_healthy
nextcloud_valkey:
condition: service_healthy
# Environment variables
environment:
- POSTGRES_HOST=nextcloud_db:5432
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- REDIS_HOST=nextcloud_valkey
- REDIS_HOST_PORT=6379
- REDIS_HOST_PASSWORD=${VALKEY_PASSWORD}
- PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT}
- PHP_UPLOAD_LIMIT=${PHP_UPLOAD_LIMIT}
- APACHE_DISABLE_REWRITE_IP=${APACHE_DISABLE_REWRITE_IP}
# 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
networks:
- frontend
- backend
- frontend # Connects to frontend network
- backend # Connects to backend network
# 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:
- POSTGRES_HOST=nextcloud_db:5432
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- REDIS_HOST=nextcloud_valkey
- REDIS_HOST_PORT=6379
- REDIS_HOST_PASSWORD=${VALKEY_PASSWORD}
- PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT}
- PHP_UPLOAD_LIMIT=${PHP_UPLOAD_LIMIT}
- APACHE_DISABLE_REWRITE_IP=${APACHE_DISABLE_REWRITE_IP}
# 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
networks:
- frontend
- backend
- frontend # Connects to frontend network
- backend # Connects to backend network
# External network definitions
networks:
frontend:
external: true
external: true # Uses pre-existing network
backend:
external: true
external: true # Uses pre-existing network