소스 검색

tweaking configs

Christian Winther 1 년 전
부모
커밋
72b454143b
5개의 변경된 파일43개의 추가작업 그리고 16개의 파일을 삭제
  1. 33 5
      .env.docker
  2. 1 2
      .github/workflows/docker.yml
  3. 0 0
      .shellcheckrc
  4. 6 6
      docker-compose.yml
  5. 3 3
      docker/shared/root/docker/entrypoint.d/12-migrations.sh

+ 33 - 5
.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"

+ 1 - 2
.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

+ 0 - 0
docker/.shellcheckrc → .shellcheckrc


+ 6 - 6
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:

+ 3 - 3
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