diff --git a/.env.docker b/.env.docker index dd7a06887..5dfd766bb 100644 --- a/.env.docker +++ b/.env.docker @@ -1,8 +1,8 @@ +# shellcheck disable=SC2034,SC2148 + # -*- mode: bash -*- # vi: ft=bash -# shellcheck disable=SC2034 - ############################################################### # Docker-wide configuration ############################################################### @@ -31,9 +31,6 @@ DOCKER_TAG="branch-jippi-fork-apache-8.1" # See: https://www.php.net/manual/en/timezones.php TZ="UTC" -# Automatically run [artisan migrate --force] if new migrations are detected. -DOCKER_APPLY_NEW_MIGRATIONS_AUTOMATICALLY="0" - # Automatically run "One-time setup tasks" commands. # # If you are migrating to this docker-compose setup or have manually run the "One time seutp" @@ -315,6 +312,9 @@ DB_DATABASE="pixelfed_prod" # See: https://docs.pixelfed.org/technical-documentation/config/#db_port DB_PORT="3306" +# Automatically run [artisan migrate --force] if new migrations are detected. +DB_APPLY_NEW_MIGRATIONS_AUTOMATICALLY="0" + ############################################################### # Mail configuration ############################################################### @@ -970,3 +970,31 @@ DOCKER_PROXY_PROFILE="" # Set this to a non-empty value (e.g. "disabled") to disable the [proxy-acme] service DOCKER_PROXY_ACME_PROFILE="${DOCKER_PROXY_PROFILE}" + +# Path (relative to the docker-compose.yml) or absolute (/some/other/path) where containers will store their data +DOCKER_DATA_ROOT="./docker-compose-state/data" + +# Path (relative to the docker-compose.yml) or absolute (/some/other/path) where containers will store their confguration +DOCKER_CONFIG_ROOT="./docker-compose-state/config" + +# Path (on host system) where the [db] container will store its data +# +# Path is relative (./some/other/path) to the docker-compose.yml or absolute (/some/other/path) +DB_DATA_PATH="${DOCKER_DATA_ROOT}/db" + +# Path (on host system) where the [redis] container will store its data +# +# Path is relative (./some/other/path) to the docker-compose.yml or absolute (/some/other/path) +REDIS_DATA_PATH="${DOCKER_DATA_ROOT}/redis" + +# Path (on host system) where the [app] + [worker] container will write +# its [storage] data (e.g uploads/images/profile pictures etc.). +# +# Path is relative (./some/other/path) to the docker-compose.yml or absolute (/some/other/path) +APP_STORAGE_PATH="${DOCKER_DATA_ROOT}/pixelfed/storage" + +# Path (on host system) where the [app] + [worker] container will write +# its [cache] data. +# +# Path is relative (./some/other/path) to the docker-compose.yml or absolute (/some/other/path) +APP_CACHE_PATH="${DOCKER_DATA_ROOT}/pixelfed/cache" diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 591c9d22a..64978070a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -50,8 +50,7 @@ jobs: SHELLCHECK_OPTS: --shell=bash --external-sources with: version: v0.9.0 - scandir: ./docker/ - additional_files: "*.envsh" + additional_files: "*.envsh .env .env.docker .env.example .env.testing" build: runs-on: ubuntu-latest diff --git a/docker/.shellcheckrc b/.shellcheckrc similarity index 100% rename from docker/.shellcheckrc rename to .shellcheckrc diff --git a/docker-compose.yml b/docker-compose.yml index 0e5d2bb19..614d3954a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -68,8 +68,8 @@ services: target: apache-runtime volumes: - "./.env:/var/www/.env" - - "${DOCKER_DATA_ROOT}/pixelfed/cache:/var/www/bootstrap/cache" - - "${DOCKER_DATA_ROOT}/pixelfed/storage:/var/www/storage" + - "${APP_CACHE_PATH}:/var/www/bootstrap/cache" + - "${APP_STORAGE_PATH}:/var/www/storage" environment: LETSENCRYPT_HOST: "${LETSENCRYPT_HOST}" LETSENCRYPT_EMAIL: "${LETSENCRYPT_EMAIL}" @@ -98,8 +98,8 @@ services: target: apache-runtime volumes: - "./.env:/var/www/.env" - - "${DOCKER_DATA_ROOT}/pixelfed/cache:/var/www/bootstrap/cache" - - "${DOCKER_DATA_ROOT}/pixelfed/storage:/var/www/storage" + - "${APP_CACHE_PATH}:/var/www/bootstrap/cache" + - "${APP_STORAGE_PATH}:/var/www/storage" depends_on: - db - redis @@ -112,7 +112,7 @@ services: env_file: - ".env" volumes: - - "${DOCKER_DATA_ROOT}/db:/var/lib/mysql" + - "${DB_DATA_PATH}:/var/lib/mysql" ports: - "${DOCKER_DB_PORT_EXTERNAL}:3306" @@ -124,7 +124,7 @@ services: - ".env" volumes: - "${DOCKER_CONFIG_ROOT}/redis:/etc/redis" - - "${DOCKER_DATA_ROOT}/redis:/data" + - "${REDIS_DATA_PATH}:/data" ports: - "${DOCKER_REDIS_PORT_EXTERNAL}:6399" healthcheck: diff --git a/docker/shared/root/docker/entrypoint.d/12-migrations.sh b/docker/shared/root/docker/entrypoint.d/12-migrations.sh index b10e34c18..1fb49f393 100755 --- a/docker/shared/root/docker/entrypoint.d/12-migrations.sh +++ b/docker/shared/root/docker/entrypoint.d/12-migrations.sh @@ -7,7 +7,7 @@ source "${ENTRYPOINT_ROOT}/helpers.sh" entrypoint-set-script-name "$0" # Allow automatic applying of outstanding/new migrations on startup -: "${DOCKER_APPLY_NEW_MIGRATIONS_AUTOMATICALLY:=0}" +: "${DB_APPLY_NEW_MIGRATIONS_AUTOMATICALLY:=0}" # Wait for the database to be ready await-database-ready @@ -24,9 +24,9 @@ fi log-warning "New migrations available, will automatically apply them now" -if is-false "${DOCKER_APPLY_NEW_MIGRATIONS_AUTOMATICALLY}"; then +if is-false "${DB_APPLY_NEW_MIGRATIONS_AUTOMATICALLY}"; then log-info "Automatic applying of new database migrations is disabled" - log-info "Please set [DOCKER_APPLY_NEW_MIGRATIONS_AUTOMATICALLY=1] in your [.env] file to enable this." + log-info "Please set [DB_APPLY_NEW_MIGRATIONS_AUTOMATICALLY=1] in your [.env] file to enable this." exit 0 fi