| @@ -1,6 +1,7 @@ | |||
| .env | |||
| backup-volumes/ | |||
| exclude-list | |||
| root-volume/ | |||
| tmp/ | |||
| traefik-volumes/ | |||
| webroot-remote/ | |||
| @@ -14,7 +14,7 @@ now="$(date +%Y-%m_%d-%H-%M-%S)" | |||
| backup_path="${PWD}/backup-volumes/${now}" | |||
| mkdir -p "${backup_path}" | |||
| volumes="db traefik-dynamic traefik-certs traefik-logs traefik-static webroot" | |||
| volumes="db root traefik-dynamic traefik-certs traefik-logs traefik-static webroot" | |||
| for volume in ${volumes}; do | |||
| mkdir -p "${backup_path}/${volume}" | |||
| docker run \ | |||
| @@ -15,6 +15,7 @@ mkdir -p "/tmp/${PREFIX}" | |||
| echo "Setting up docker volumes" | |||
| docker volume create "${PREFIX}-db" | |||
| docker volume create "${PREFIX}-root" | |||
| docker volume create "${PREFIX}-traefik-certs" | |||
| docker volume create "${PREFIX}-traefik-dynamic" | |||
| docker volume create "${PREFIX}-traefik-logs" | |||
| @@ -25,6 +25,7 @@ services: | |||
| - PHP_UPLOAD_MAX_FILESIZE=${PHP_UPLOAD_MAX_FILESIZE} | |||
| - XDEBUG_CLIENT_HOST=${XDEBUG_CLIENT_HOST} | |||
| - XDEBUG_MODE=${XDEBUG_MODE} | |||
| hostname: ${PREFIX}-app | |||
| image: ${APP_IMAGE_TAG} | |||
| labels: | |||
| - traefik.enable=true | |||
| @@ -36,6 +37,7 @@ services: | |||
| - traefik.http.routers.${PREFIX}-webssl.tls=true | |||
| - traefik.http.services.${PREFIX}-webssl.loadbalancer.server.port=80 | |||
| volumes: | |||
| - root:/root | |||
| - webroot:/var/www/html | |||
| - wp-cli-cache:/var/www/.wp-cli | |||
| db: | |||
| @@ -80,6 +82,8 @@ version: "3.4" | |||
| volumes: | |||
| db: | |||
| name: ${PREFIX}-db | |||
| root: | |||
| name: ${PREFIX}-root | |||
| traefik-certs: | |||
| name: ${PREFIX}-traefik-certs | |||
| traefik-dynamic: | |||
| @@ -11,7 +11,7 @@ set -a | |||
| . "${PWD}/env_files/manage.env" | |||
| set +a | |||
| volumes="certs dynamic logs static webroot" | |||
| volumes="certs dynamic logs root static webroot" | |||
| for volume in ${volumes}; do | |||
| mount_path="${PWD}/traefik-volumes/${volume}" | |||
| volume_path="${DOCKER_VOLUMES_PATH}/${PREFIX}-traefik-${volume}/_data" | |||
| @@ -19,6 +19,10 @@ for volume in ${volumes}; do | |||
| mount_path="${PWD}/${volume}-volume" | |||
| volume_path="${DOCKER_VOLUMES_PATH}/${PREFIX}-${volume}/_data" | |||
| fi | |||
| if [ "${volume}" = "root" ]; then | |||
| mount_path="${PWD}/${volume}-volume" | |||
| volume_path="${DOCKER_VOLUMES_PATH}/${PREFIX}-${volume}/_data" | |||
| fi | |||
| sudo -u "${MOUNT_USER}" mkdir -p "${mount_path}" | |||
| if mountpoint "${mount_path}" -q; then | |||
| echo "exiting because something is mounted at ${mount_path}" | |||
| @@ -12,6 +12,7 @@ if [ "$REPLY" != "${REPLY#[YyOo]}" ]; then | |||
| docker compose rm | |||
| docker network rm "${PREFIX}" | |||
| docker volume rm "${PREFIX}-db" | |||
| docker volume rm "${PREFIX}-root" | |||
| docker volume rm "${PREFIX}-traefik-certs" | |||
| docker volume rm "${PREFIX}-traefik-dynamic" | |||
| docker volume rm "${PREFIX}-traefik-logs" | |||
| @@ -6,12 +6,15 @@ if [ "$(id -u)" -ne 0 ]; then | |||
| exit 1 | |||
| fi | |||
| volumes="certs dynamic logs static webroot" | |||
| volumes="certs dynamic logs root static webroot" | |||
| for volume in ${volumes}; do | |||
| mount_path="${PWD}/traefik-volumes/${volume}" | |||
| if [ "${volume}" = "webroot" ]; then | |||
| mount_path="${PWD}/${volume}-volume" | |||
| fi | |||
| if [ "${volume}" = "root" ]; then | |||
| mount_path="${PWD}/${volume}-volume" | |||
| fi | |||
| if mountpoint "${mount_path}" -q; then | |||
| echo "umounting ${mount_path}" | |||
| umount "${mount_path}" | |||
| @@ -7,6 +7,7 @@ set +a | |||
| docker exec \ | |||
| -e SHELLOPTS=vi \ | |||
| -e HISTFILE=/var/www/html/.bash_history \ | |||
| -it --user www-data \ | |||
| "${PREFIX}-app" \ | |||
| /bin/bash | |||