more docker config tuning

This commit is contained in:
Christian Winther 2024-01-17 16:11:36 +00:00
parent cc9f673eea
commit ead7c33275
2 changed files with 37 additions and 7 deletions

View file

@ -260,6 +260,11 @@ LETSENCRYPT_EMAIL="__CHANGE_ME__"
# Database configuration # Database configuration
################################################################################ ################################################################################
# Database version to use (as Docker tag)
#
# See: https://hub.docker.com/_/mariadb
#DB_VERSION="11.2"
# Here you may specify which of the database connections below # Here you may specify which of the database connections below
# you wish to use as your default connection for all database work. # you wish to use as your default connection for all database work.
# #
@ -376,6 +381,11 @@ MAIL_FROM_NAME="Pixelfed @ ${APP_DOMAIN}"
# Redis configuration # Redis configuration
################################################################################ ################################################################################
# Redis version to use as Docker tag
#
# See: https://hub.docker.com/_/redis
#REDIS_VERSION="7.2"
# Defaults to "phpredis". # Defaults to "phpredis".
# #
# See: https://docs.pixelfed.org/technical-documentation/config/#redis_client # See: https://docs.pixelfed.org/technical-documentation/config/#redis_client
@ -992,6 +1002,11 @@ DOCKER_APP_STORAGE_PATH="${DOCKER_DATA_ROOT}/pixelfed/storage"
# Path is relative (./some/other/path) to the docker-compose.yml or absolute (/some/other/path) # Path is relative (./some/other/path) to the docker-compose.yml or absolute (/some/other/path)
DOCKER_APP_CACHE_PATH="${DOCKER_DATA_ROOT}/pixelfed/cache" DOCKER_APP_CACHE_PATH="${DOCKER_DATA_ROOT}/pixelfed/cache"
# How often Docker health check should run for all services
#
# Can be overridden by individual [DOCKER_*_HEALTHCHECK_INTERVAL] settings further down
DOCKER_DEFAULT_HEALTHCHECK_INTERVAL="10s"
# Port that Redis will listen on *outside* the container (e.g. the host machine) # Port that Redis will listen on *outside* the container (e.g. the host machine)
DOCKER_REDIS_PORT_EXTERNAL="${REDIS_PORT:-6379}" DOCKER_REDIS_PORT_EXTERNAL="${REDIS_PORT:-6379}"
@ -1004,11 +1019,17 @@ DOCKER_REDIS_PORT_EXTERNAL="${REDIS_PORT:-6379}"
# Defaults to "" # Defaults to ""
#DOCKER_REDIS_CONFIG_FILE="/etc/redis/redis.conf" #DOCKER_REDIS_CONFIG_FILE="/etc/redis/redis.conf"
# How often Docker health check should run for [redis] service
DOCKER_REDIS_HEALTHCHECK_INTERVAL="${DOCKER_DEFAULT_HEALTHCHECK_INTERVAL}"
# Port that the database will listen on *outside* the container (e.g. the host machine) # Port that the database will listen on *outside* the container (e.g. the host machine)
# #
# Use "3306" for MySQL/MariaDB and "5432" for PostgreeSQL # Use "3306" for MySQL/MariaDB and "5432" for PostgreeSQL
DOCKER_DB_PORT_EXTERNAL="${DB_PORT}" DOCKER_DB_PORT_EXTERNAL="${DB_PORT}"
# How often Docker health check should run for [db] service
DOCKER_DB_HEALTHCHECK_INTERVAL="${DOCKER_DEFAULT_HEALTHCHECK_INTERVAL}"
# Port that the [proxy] will listen on *outside* the container (e.g. the host machine) for HTTP traffic # Port that the [proxy] will listen on *outside* the container (e.g. the host machine) for HTTP traffic
DOCKER_PROXY_PORT_EXTERNAL_HTTP="80" DOCKER_PROXY_PORT_EXTERNAL_HTTP="80"
@ -1018,6 +1039,12 @@ DOCKER_PROXY_PORT_EXTERNAL_HTTPS="443"
# Port to expose [web] container will listen on *outside* the container (e.g. the host machine) for *HTTP* traffic only # Port to expose [web] container will listen on *outside* the container (e.g. the host machine) for *HTTP* traffic only
DOCKER_WEB_PORT_EXTERNAL_HTTP="8080" DOCKER_WEB_PORT_EXTERNAL_HTTP="8080"
# How often Docker health check should run for [web] service
DOCKER_WEB_HEALTHCHECK_INTERVAL="${DOCKER_DEFAULT_HEALTHCHECK_INTERVAL}"
# How often Docker health check should run for [worker] service
DOCKER_WORKER_HEALTHCHECK_INTERVAL="${DOCKER_DEFAULT_HEALTHCHECK_INTERVAL}"
# Path to the Docker socket on the *host* # Path to the Docker socket on the *host*
DOCKER_HOST_SOCKET_PATH="/var/run/docker.sock" DOCKER_HOST_SOCKET_PATH="/var/run/docker.sock"
@ -1030,6 +1057,9 @@ DOCKER_PROXY_PROFILE=""
# Set this to a non-empty value (e.g. "disabled") to disable the [proxy-acme] service # Set this to a non-empty value (e.g. "disabled") to disable the [proxy-acme] service
DOCKER_PROXY_ACME_PROFILE="${DOCKER_PROXY_PROFILE}" DOCKER_PROXY_ACME_PROFILE="${DOCKER_PROXY_PROFILE}"
# How often Docker health check should run for [proxy] service
DOCKER_PROXY_HEALTHCHECK_INTERVAL="${DOCKER_DEFAULT_HEALTHCHECK_INTERVAL}"
# Automatically run "One-time setup tasks" commands. # Automatically run "One-time setup tasks" commands.
# #
# If you are migrating to this docker-compose setup or have manually run the "One time seutp" # If you are migrating to this docker-compose setup or have manually run the "One time seutp"

View file

@ -35,7 +35,7 @@ services:
- "${DOCKER_PROXY_PORT_EXTERNAL_HTTPS}:443" - "${DOCKER_PROXY_PORT_EXTERNAL_HTTPS}:443"
healthcheck: healthcheck:
test: "curl --fail https://$[APP_DOMAIN}/api/service/health-check" test: "curl --fail https://$[APP_DOMAIN}/api/service/health-check"
interval: 10s interval: "${DOCKER_PROXY_HEALTHCHECK_INTERVAL:-10s}"
retries: 2 retries: 2
timeout: 5s timeout: 5s
@ -99,7 +99,7 @@ services:
- redis - redis
healthcheck: healthcheck:
test: 'curl --header "Host: $[APP_DOMAIN}" --fail http://localhost/api/service/health-check' test: 'curl --header "Host: $[APP_DOMAIN}" --fail http://localhost/api/service/health-check'
interval: 10s interval: "${DOCKER_WEB_HEALTHCHECK_INTERVAL:-10s}"
retries: 2 retries: 2
timeout: 5s timeout: 5s
@ -126,12 +126,12 @@ services:
- redis - redis
healthcheck: healthcheck:
test: gosu www-data php artisan horizon:status | grep running test: gosu www-data php artisan horizon:status | grep running
interval: 10s interval: "${DOCKER_WORKER_HEALTHCHECK_INTERVAL}"
timeout: 5s timeout: 5s
retries: 2 retries: 2
db: db:
image: mariadb:11.2 image: mariadb:${DB_VERSION:-11.2}
container_name: "${DOCKER_CONTAINER_NAME_PREFIX}-db" container_name: "${DOCKER_CONTAINER_NAME_PREFIX}-db"
command: --default-authentication-plugin=mysql_native_password command: --default-authentication-plugin=mysql_native_password
restart: unless-stopped restart: unless-stopped
@ -150,12 +150,12 @@ services:
"--connect", "--connect",
"--innodb_initialized", "--innodb_initialized",
] ]
interval: 10s interval: "${DOCKER_DB_HEALTHCHECK_INTERVAL:-10s}"
retries: 2 retries: 2
timeout: 5s timeout: 5s
redis: redis:
image: redis:7.2 image: redis:${REDIS_VERSION:-7.2}
container_name: "${DOCKER_CONTAINER_NAME_PREFIX}-redis" container_name: "${DOCKER_CONTAINER_NAME_PREFIX}-redis"
restart: unless-stopped restart: unless-stopped
command: "${DOCKER_REDIS_CONFIG_FILE:-} --requirepass '${REDIS_PASSWORD:-}'" command: "${DOCKER_REDIS_CONFIG_FILE:-} --requirepass '${REDIS_PASSWORD:-}'"
@ -170,6 +170,6 @@ services:
- "${DOCKER_REDIS_PORT_EXTERNAL}:6379" - "${DOCKER_REDIS_PORT_EXTERNAL}:6379"
healthcheck: healthcheck:
test: ["CMD", "redis-cli", "-p", "6379", "ping"] test: ["CMD", "redis-cli", "-p", "6379", "ping"]
interval: 10s interval: "${DOCKER_REDIS_HEALTHCHECK_INTERVAL}"
retries: 2 retries: 2
timeout: 5s timeout: 5s