1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-22 15:55:14 +00:00
pixelfed/docker-compose.yml

218 lines
8.6 KiB
YAML
Raw Normal View History

2018-05-20 13:02:29 +00:00
---
2024-01-06 14:19:36 +00:00
###############################################################
# Please see docker/README.md for usage information
###############################################################
2018-05-20 13:02:29 +00:00
services:
2024-01-06 16:43:48 +00:00
# HTTP/HTTPS proxy
#
2024-01-15 15:14:44 +00:00
# Sits in front of the *real* webserver and manages SSL and (optionally)
# load-balancing between multiple web servers
#
2024-01-15 19:56:35 +00:00
# You can disable this service by setting [DOCKER_PROXY_PROFILE="disabled"]
# in your [.env] file - the setting is near the bottom of the file.
#
# This also disables the [proxy-acme] service, if this is not desired, change the
# [DOCKER_PROXY_ACME_PROFILE] setting to an empty string [""]
#
2024-01-06 16:43:48 +00:00
# See: https://github.com/nginx-proxy/nginx-proxy/tree/main/docs
proxy:
image: nginxproxy/nginx-proxy:1.4
container_name: "${DOCKER_ALL_CONTAINER_NAME_PREFIX}-proxy"
2024-01-15 14:42:54 +00:00
restart: unless-stopped
2024-01-15 19:20:22 +00:00
profiles:
2024-01-15 19:56:35 +00:00
- ${DOCKER_PROXY_PROFILE:-}
2024-02-22 14:53:39 +00:00
environment:
DOCKER_SERVICE_NAME: "proxy"
2024-01-06 16:43:48 +00:00
volumes:
- "${DOCKER_PROXY_HOST_DOCKER_SOCKET_PATH}:/tmp/docker.sock:ro"
- "${DOCKER_ALL_HOST_CONFIG_ROOT_PATH}/proxy/conf.d:/etc/nginx/conf.d"
- "${DOCKER_ALL_HOST_CONFIG_ROOT_PATH}/proxy/vhost.d:/etc/nginx/vhost.d"
- "${DOCKER_ALL_HOST_CONFIG_ROOT_PATH}/proxy/certs:/etc/nginx/certs"
- "${DOCKER_ALL_HOST_DATA_ROOT_PATH}/proxy/html:/usr/share/nginx/html"
2024-01-06 16:43:48 +00:00
ports:
- "${DOCKER_PROXY_HOST_PORT_HTTP}:80"
- "${DOCKER_PROXY_HOST_PORT_HTTPS}:443"
2024-01-17 15:47:39 +00:00
healthcheck:
2024-01-17 16:30:40 +00:00
test: "curl --fail https://${APP_DOMAIN}/api/service/health-check"
interval: "${DOCKER_PROXY_HEALTHCHECK_INTERVAL}"
2024-01-17 15:47:39 +00:00
retries: 2
timeout: 5s
2024-01-06 16:43:48 +00:00
# Proxy companion for managing letsencrypt SSL certificates
#
2024-01-15 19:56:35 +00:00
# You can disable this service by setting [DOCKER_PROXY_ACME_PROFILE="disabled"]
# in your [.env] file - the setting is near the bottom of the file.
#
2024-01-06 16:43:48 +00:00
# See: https://github.com/nginx-proxy/acme-companion/tree/main/docs
proxy-acme:
image: nginxproxy/acme-companion
container_name: "${DOCKER_ALL_CONTAINER_NAME_PREFIX}-proxy-acme"
2024-01-15 14:42:54 +00:00
restart: unless-stopped
2024-01-15 19:20:22 +00:00
profiles:
2024-01-15 19:56:35 +00:00
- ${DOCKER_PROXY_ACME_PROFILE:-}
2024-01-06 16:43:48 +00:00
environment:
2024-01-06 18:01:48 +00:00
DEBUG: 0
2024-02-10 20:03:04 +00:00
DEFAULT_EMAIL: "${DOCKER_PROXY_LETSENCRYPT_EMAIL:?error}"
NGINX_PROXY_CONTAINER: "${DOCKER_ALL_CONTAINER_NAME_PREFIX}-proxy"
2024-01-06 16:43:48 +00:00
depends_on:
- proxy
volumes:
- "${DOCKER_ALL_HOST_CONFIG_ROOT_PATH}/proxy-acme:/etc/acme.sh"
- "${DOCKER_ALL_HOST_CONFIG_ROOT_PATH}/proxy/certs:/etc/nginx/certs"
- "${DOCKER_ALL_HOST_CONFIG_ROOT_PATH}/proxy/conf.d:/etc/nginx/conf.d"
- "${DOCKER_ALL_HOST_CONFIG_ROOT_PATH}/proxy/vhost.d:/etc/nginx/vhost.d"
- "${DOCKER_ALL_HOST_DATA_ROOT_PATH}/proxy/html:/usr/share/nginx/html"
- "${DOCKER_PROXY_HOST_DOCKER_SOCKET_PATH}:/var/run/docker.sock:ro"
2024-01-06 16:43:48 +00:00
2024-01-06 14:19:36 +00:00
web:
image: "${DOCKER_APP_IMAGE}:${DOCKER_APP_TAG}"
container_name: "${DOCKER_ALL_CONTAINER_NAME_PREFIX}-web"
2019-06-03 02:53:13 +00:00
restart: unless-stopped
profiles:
- ${DOCKER_WEB_PROFILE:-}
2024-01-06 18:01:48 +00:00
build:
target: ${DOCKER_APP_RUNTIME}-runtime
cache_from:
- "type=registry,ref=${DOCKER_APP_IMAGE}-cache:${DOCKER_APP_TAG}"
2024-01-15 23:50:16 +00:00
args:
2024-02-10 20:03:04 +00:00
APT_PACKAGES_EXTRA: "${DOCKER_APP_APT_PACKAGES_EXTRA:-}"
BUILD_FRONTEND: "${DOCKER_APP_BUILD_FRONTEND:-0}"
PHP_BASE_TYPE: "${DOCKER_APP_BASE_TYPE}"
PHP_DEBIAN_RELEASE: "${DOCKER_APP_DEBIAN_RELEASE}"
PHP_EXTENSIONS_EXTRA: "${DOCKER_APP_PHP_EXTENSIONS_EXTRA:-}"
2024-02-10 20:03:04 +00:00
PHP_PECL_EXTENSIONS_EXTRA: "${DOCKER_APP_PHP_PECL_EXTENSIONS_EXTRA:-}"
PHP_VERSION: "${DOCKER_APP_PHP_VERSION:?error}"
2024-01-06 16:43:48 +00:00
environment:
2024-02-22 14:53:39 +00:00
# Used by Pixelfed Docker init script
DOCKER_SERVICE_NAME: "web"
DOCKER_APP_ENTRYPOINT_DEBUG: ${DOCKER_APP_ENTRYPOINT_DEBUG:-0}
ENTRYPOINT_SKIP_SCRIPTS: ${ENTRYPOINT_SKIP_SCRIPTS:-}
# Used by [proxy] service
2024-02-10 20:03:04 +00:00
LETSENCRYPT_HOST: "${DOCKER_PROXY_LETSENCRYPT_HOST:?error}"
LETSENCRYPT_EMAIL: "${DOCKER_PROXY_LETSENCRYPT_EMAIL:?error}"
LETSENCRYPT_TEST: "${DOCKER_PROXY_LETSENCRYPT_TEST:-}"
2024-01-06 18:01:48 +00:00
VIRTUAL_HOST: "${APP_DOMAIN}"
2024-01-06 16:43:48 +00:00
VIRTUAL_PORT: "80"
2024-02-22 14:53:39 +00:00
volumes:
- "./.env:/var/www/.env"
2024-02-22 15:24:51 +00:00
- "${DOCKER_ALL_HOST_CONFIG_ROOT_PATH}/proxy/conf.d:/shared/proxy/conf.d"
2024-02-22 14:53:39 +00:00
- "${DOCKER_APP_HOST_CACHE_PATH}:/var/www/bootstrap/cache"
- "${DOCKER_APP_HOST_OVERRIDES_PATH}:/docker/overrides:ro"
- "${DOCKER_APP_HOST_STORAGE_PATH}:/var/www/storage"
2024-01-06 16:43:48 +00:00
labels:
com.github.nginx-proxy.nginx-proxy.keepalive: 30
com.github.nginx-proxy.nginx-proxy.http2.enable: true
com.github.nginx-proxy.nginx-proxy.http3.enable: true
2024-01-15 19:39:59 +00:00
ports:
- "${DOCKER_WEB_PORT_EXTERNAL_HTTP}:80"
2020-04-11 15:48:02 +00:00
depends_on:
2020-04-11 15:52:05 +00:00
- db
2020-04-11 15:48:02 +00:00
- redis
2024-01-17 15:47:39 +00:00
healthcheck:
2024-01-17 16:30:40 +00:00
test: 'curl --header "Host: ${APP_DOMAIN}" --fail http://localhost/api/service/health-check'
interval: "${DOCKER_WEB_HEALTHCHECK_INTERVAL}"
2024-01-17 15:47:39 +00:00
retries: 2
timeout: 5s
2020-04-11 15:48:02 +00:00
worker:
image: "${DOCKER_APP_IMAGE}:${DOCKER_APP_TAG}"
container_name: "${DOCKER_ALL_CONTAINER_NAME_PREFIX}-worker"
2024-01-06 14:19:36 +00:00
command: gosu www-data php artisan horizon
2019-06-03 02:53:13 +00:00
restart: unless-stopped
2024-02-22 14:53:39 +00:00
stop_signal: SIGTERM
profiles:
- ${DOCKER_WORKER_PROFILE:-}
2024-01-06 18:01:48 +00:00
build:
target: ${DOCKER_APP_RUNTIME}-runtime
cache_from:
- "type=registry,ref=${DOCKER_APP_IMAGE}-cache:${DOCKER_APP_TAG}"
2024-01-15 23:50:16 +00:00
args:
2024-02-10 20:03:04 +00:00
APT_PACKAGES_EXTRA: "${DOCKER_APP_APT_PACKAGES_EXTRA:-}"
BUILD_FRONTEND: "${DOCKER_APP_BUILD_FRONTEND:-0}"
PHP_BASE_TYPE: "${DOCKER_APP_BASE_TYPE}"
PHP_DEBIAN_RELEASE: "${DOCKER_APP_DEBIAN_RELEASE}"
PHP_EXTENSIONS_EXTRA: "${DOCKER_APP_PHP_EXTENSIONS_EXTRA:-}"
2024-02-10 20:03:04 +00:00
PHP_PECL_EXTENSIONS_EXTRA: "${DOCKER_APP_PHP_PECL_EXTENSIONS_EXTRA:-}"
PHP_VERSION: "${DOCKER_APP_PHP_VERSION:?error}"
2024-02-22 14:53:39 +00:00
environment:
# Used by Pixelfed Docker init script
DOCKER_SERVICE_NAME: "worker"
DOCKER_APP_ENTRYPOINT_DEBUG: ${DOCKER_APP_ENTRYPOINT_DEBUG:-0}
ENTRYPOINT_SKIP_SCRIPTS: ${ENTRYPOINT_SKIP_SCRIPTS:-}
2019-04-22 02:40:32 +00:00
volumes:
2024-01-06 14:19:36 +00:00
- "./.env:/var/www/.env"
2024-02-22 15:24:51 +00:00
- "${DOCKER_ALL_HOST_CONFIG_ROOT_PATH}/proxy/conf.d:/shared/proxy/conf.d"
- "${DOCKER_APP_HOST_CACHE_PATH}:/var/www/bootstrap/cache"
- "${DOCKER_APP_HOST_OVERRIDES_PATH}:/docker/overrides:ro"
2024-02-22 14:53:39 +00:00
- "${DOCKER_APP_HOST_STORAGE_PATH}:/var/www/storage"
2020-04-11 15:48:02 +00:00
depends_on:
2020-04-11 15:52:05 +00:00
- db
2020-04-11 15:48:02 +00:00
- redis
2024-01-17 15:47:39 +00:00
healthcheck:
test: gosu www-data php artisan horizon:status | grep running
2024-02-10 20:03:04 +00:00
interval: "${DOCKER_WORKER_HEALTHCHECK_INTERVAL:?error}"
2024-01-17 15:47:39 +00:00
timeout: 5s
retries: 2
2020-04-11 15:48:02 +00:00
db:
2024-02-10 20:03:04 +00:00
image: ${DOCKER_DB_IMAGE:?error}
container_name: "${DOCKER_ALL_CONTAINER_NAME_PREFIX}-db"
2024-02-10 20:03:04 +00:00
command: ${DOCKER_DB_COMMAND:-}
2024-01-06 14:19:36 +00:00
restart: unless-stopped
profiles:
- ${DOCKER_DB_PROFILE:-}
2024-02-10 20:03:04 +00:00
environment:
TZ: "${TZ:?error}"
# MySQL (Oracle) - "Environment Variables" at https://hub.docker.com/_/mysql
MYSQL_ROOT_PASSWORD: "${DOCKER_DB_ROOT_PASSWORD:?error}"
2024-02-10 20:03:04 +00:00
MYSQL_USER: "${DB_USERNAME:?error}"
MYSQL_PASSWORD: "${DB_PASSWORD:?error}"
MYSQL_DATABASE: "${DB_DATABASE:?error}"
# MySQL (MariaDB) - "Start a mariadb server instance with user, password and database" at https://hub.docker.com/_/mariadb
MARIADB_ROOT_PASSWORD: "${DOCKER_DB_ROOT_PASSWORD:?error}"
2024-02-10 20:03:04 +00:00
MARIADB_USER: "${DB_USERNAME:?error}"
MARIADB_PASSWORD: "${DB_PASSWORD:?error}"
MARIADB_DATABASE: "${DB_DATABASE:?error}"
# PostgreSQL - "Environment Variables" at https://hub.docker.com/_/postgres
POSTGRES_USER: "${DB_USERNAME:?error}"
POSTGRES_PASSWORD: "${DB_PASSWORD:?error}"
POSTGRES_DB: "${DB_DATABASE:?error}"
2018-05-20 13:02:29 +00:00
volumes:
2024-02-10 20:03:04 +00:00
- "${DOCKER_DB_HOST_DATA_PATH:?error}:${DOCKER_DB_CONTAINER_DATA_PATH:?error}"
2024-01-06 14:19:36 +00:00
ports:
2024-02-10 20:03:04 +00:00
- "${DOCKER_DB_HOST_PORT:?error}:${DOCKER_DB_CONTAINER_PORT:?error}"
2024-01-17 15:47:39 +00:00
healthcheck:
test:
[
"CMD",
"healthcheck.sh",
"--su-mysql",
"--connect",
"--innodb_initialized",
]
2024-02-10 20:03:04 +00:00
interval: "${DOCKER_DB_HEALTHCHECK_INTERVAL:?error}"
2024-01-17 15:47:39 +00:00
retries: 2
timeout: 5s
2018-05-20 13:02:29 +00:00
redis:
image: redis:${DOCKER_REDIS_VERSION}
container_name: "${DOCKER_ALL_CONTAINER_NAME_PREFIX}-redis"
2019-06-03 02:53:13 +00:00
restart: unless-stopped
2024-02-22 14:53:39 +00:00
command: "${DOCKER_REDIS_CONFIG_FILE:-} --requirepass '${REDIS_PASSWORD:-}'"
2024-02-21 21:52:59 +00:00
profiles:
- ${DOCKER_REDIS_PROFILE:-}
2024-01-17 14:13:38 +00:00
environment:
2024-02-10 20:03:04 +00:00
TZ: "${TZ:?error}"
REDISCLI_AUTH: ${REDIS_PASSWORD:-}
2018-05-20 13:02:29 +00:00
volumes:
- "${DOCKER_ALL_HOST_CONFIG_ROOT_PATH}/redis:/etc/redis"
- "${DOCKER_REDIS_HOST_DATA_PATH}:/data"
2024-01-06 14:19:36 +00:00
ports:
- "${DOCKER_REDIS_HOST_PORT}:6379"
2024-01-06 14:19:36 +00:00
healthcheck:
2024-01-17 15:47:39 +00:00
test: ["CMD", "redis-cli", "-p", "6379", "ping"]
2024-02-10 20:03:04 +00:00
interval: "${DOCKER_REDIS_HEALTHCHECK_INTERVAL:?error}"
2024-01-06 14:19:36 +00:00
retries: 2
2024-01-17 15:47:39 +00:00
timeout: 5s