Compare commits

..

36 Commits

Author SHA1 Message Date
Jean-Christophe Vanhalle
441dc6b371 adds wintercms project type 2024-10-13 17:00:21 +02:00
Jean-Christophe Vanhalle
cde2a715fb adds support for wintercms 2024-10-13 16:59:47 +02:00
Jean-Christophe Vanhalle
c55c46df0d wintercms 2024-10-13 13:00:14 +02:00
Jean-Christophe Vanhalle
4971511309 fixes wp cli crash due to EXTRA PHP for https not being injected correctly 2024-10-13 01:12:05 +02:00
Jean-Christophe Vanhalle
95391a995c adds support for laravel and livewire 2024-10-13 00:11:48 +02:00
Jean-Christophe Vanhalle
6e0719ec50 cleans up code 2024-10-13 00:11:04 +02:00
Jean-Christophe Vanhalle
c1ae487788 cleans up code 2024-10-13 00:09:49 +02:00
Jean-Christophe Vanhalle
d582d4c7f0 adds persistent root volume and shell history for www-data user 2024-10-12 16:35:50 +02:00
Jean-Christophe Vanhalle
f94e7baba5 reuses TRAEFIK_LISTENING_IP env variable 2024-10-11 23:21:23 +02:00
Jean-Christophe Vanhalle
3c22799e47 adds ssh tunneling script to connect remote DB 2024-10-11 23:12:17 +02:00
Jean-Christophe Vanhalle
ba2b4bdaa1 cleans up wording and adds another ssh string variable to use sudo 2024-07-24 00:38:10 +02:00
Jean-Christophe Vanhalle
bbd07933ff adds monitoring instructions for restore db operation 2024-05-31 11:08:41 +02:00
Jean-Christophe Vanhalle
f86fa8b9f3 checks for checksum instead of date when syncing files 2024-05-31 11:07:44 +02:00
Jean-Christophe Vanhalle
d0a70be1b2 adds DNS so the containers can resolve public domain even when resolv.conf was created when a VPN with custom DNS server was active on host 2024-05-31 11:06:04 +02:00
Jean-Christophe Vanhalle
f3afb76350 skips files that are news on remote 2023-12-01 16:59:51 +01:00
Jean-Christophe Vanhalle
f85c57c9b9 fixes wrong deployment path in example 2023-12-01 14:09:01 +01:00
Jean-Christophe Vanhalle
4e845592e2 removes unused file metadata when syncing to remote 2023-11-28 22:47:15 +01:00
Jean-Christophe Vanhalle
12d556d660 updates TODO.md 2023-11-28 08:52:49 +01:00
Jean-Christophe Vanhalle
deb52616bf updates TODO 2023-11-26 10:14:28 +01:00
Jean-Christophe Vanhalle
75298677b0 prints out wp migrate command and asks for go 2023-11-24 08:29:00 +01:00
Jean-Christophe Vanhalle
d71b16e10f fixes wrong ownership for bindfs 2023-11-24 08:28:11 +01:00
Jean-Christophe Vanhalle
623bd1741d prevents migration from failing when migrate-db is already activated 2023-11-24 02:03:31 +01:00
Jean-Christophe Vanhalle
7c72290ccf excludes wp-config.php from remote to local syncing 2023-11-24 02:01:03 +01:00
Jean-Christophe Vanhalle
a48fa2525f adds option to disable deployment backup on remote 2023-11-24 01:09:09 +01:00
Jean-Christophe Vanhalle
bc14e41615 adds an option to prevent running wp-cli when remote is running in a container 2023-11-20 00:41:25 +01:00
Jean-Christophe Vanhalle
77730f0873 syncs any directory with new deployment script 2023-11-19 16:02:28 +01:00
Jean-Christophe Vanhalle
734e6f2824 fixes db migration guid not being updated 2023-09-29 13:43:26 +02:00
Jean-Christophe Vanhalle
27cb4ba4ec fixes missing folder for sql dump 2023-08-18 12:49:21 +02:00
Jean-Christophe Vanhalle
110f8aee3c fixes missing prefix to remote sql migration file 2023-08-18 12:43:25 +02:00
Jean-Christophe Vanhalle
5e1f6753f9 uses DB_NAME for sql backup dump 2023-08-18 12:37:22 +02:00
Jean-Christophe Vanhalle
aec637df6f WIP: tweaks pull-remote-db, it only migrates and pulls for now, does not import 2023-08-18 12:30:44 +02:00
Jean-Christophe Vanhalle
ea9c15f23a fixes output in migrate-db.sh 2023-08-18 12:28:07 +02:00
Jean-Christophe Vanhalle
e807e5ee19 adds mysql dump to backup.sh 2023-08-18 12:25:49 +02:00
Jean-Christophe Vanhalle
297df423c7 adds timestamps to migration process 2023-08-18 12:17:59 +02:00
Jean-Christophe Vanhalle
5d53a19803 adds exclude-list to .gitignore 2023-08-17 20:02:15 +02:00
Jean-Christophe Vanhalle
a46ef7de81 adds traefik.sh to log into traefik container 2023-08-14 15:21:05 +02:00
22 changed files with 268 additions and 60 deletions

View File

@@ -4,6 +4,8 @@ DB_NAME=wordpress
DB_ROOT_PASSWORD=root
DB_USER=user
DB_USER_PASSWORD=password
LARAVEL_VERSION=11.0
LIVEWIRE_VERSION=3.5.10
PHP_POST_MAX_SIZE=10m
PHP_UPLOAD_MAX_FILESIZE=10M
PREFIX=wpdocker

10
.gitignore vendored
View File

@@ -1,10 +1,12 @@
.env
backup-volumes/
env_files/certs.env
env_files/manage.env
env_files/migrate-db.env
env_files/remote.env
exclude-list
root-volume/
tmp/
traefik-volumes/
webroot-remote/
webroot-volume/
/env_files/*
!/env_files/*example*
/deployment/*
!/deployment/*example*

View File

@@ -1,2 +1,5 @@
- [ ] modifier pull-remote-db.sh pour qu'il fasse tourner wp-cli directement sur le conteneur et récupère ensuite le contenu localement
- [ ] ajouter dump sql au backup
- [ ] ajouter un moyen d'accéder à la db via un port
- [ ] ajouter une option pour créer sans traefik et sans adminer (via override compose)
- [ ] remplacer -a par --recursive,etc pour éviter qu'rsync n'affiche un transfert si atime, ctime, mtime a changé pour un fichier

View File

@@ -14,8 +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 \
@@ -25,3 +24,10 @@ for volume in ${volumes}; do
ubuntu \
tar -cvzf "/destination/${volume}.tar.gz" -C "/${volume}" .
done
mkdir -p "${backup_path}/db"
docker exec "${PREFIX}-db" \
/usr/bin/mysqldump \
-u root \
--password="${DB_ROOT_PASSWORD}" \
"${DB_NAME}" > "${backup_path}/db/${DB_NAME}.sql"

View File

@@ -9,18 +9,21 @@ fi
set -a
. "${PWD}/.env"
. "${PWD}/env_files/certs.env"
. "${PWD}/env_files/project.env"
set +a
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"
docker volume create "${PREFIX}-traefik-static"
docker volume create "${PREFIX}-webroot"
docker volume create wp-cli-cache
docker volume create composer-cache
echo "Copying SSL certificates to traefik volume"
if [ ! -f "${SSL_CRT_LOCATION}/${SSL_CRT_NAME}" ] || [ ! -f "${SSL_KEY_LOCATION}/${SSL_KEY_NAME}" ]; then
@@ -110,15 +113,40 @@ while ! docker exec "${PREFIX}-app" /bin/sh -c "mysqladmin ping -h ${PREFIX}-db
sleep 1
done
echo "Downloading WordPress core"
docker exec --user www-data "${PREFIX}-app" /bin/sh -c "
if [ "${PROJECT_TYPE}" = "laravel" ]; then
echo "Installing laravel"
docker exec --user www-data --workdir "/var/www/html" "${PREFIX}-app" /bin/sh -c "composer create-project --prefer-dist laravel/laravel /var/www/html '${LAREVEL_VERSION}'"
fi
if [ "${PROJECT_TYPE}" = "livewire" ]; then
echo "Installing livewire"
docker exec --user www-data --workdir "/var/www/html" "${PREFIX}-app" /bin/sh -c "composer create-project --prefer-dist laravel/laravel /var/www/html '${LARAVEL_VERSION}'"
docker exec --user www-data --workdir "/var/www/html" "${PREFIX}-app" /bin/sh -c "composer require livewire/livewire ${LIVEWIRE_VERSION}"
fi
if [ "${PROJECT_TYPE}" = "wintercms" ]; then
echo "Installing wintercms"
docker exec --user www-data --workdir "/var/www/html" "${PREFIX}-app" /bin/sh -c "composer create-project wintercms/winter /var/www/html"
docker exec --user www-data --workdir "/var/www/html" "${PREFIX}-app" /bin/sh -c "echo ASSET_URL=https://${APP_URL} >> /var/www/html/.env"
docker exec --user www-data --workdir "/var/www/html" "${PREFIX}-app" /bin/sh -c "echo DB_DATABASE=${DB_NAME} >> /var/www/html/.env"
docker exec --user www-data --workdir "/var/www/html" "${PREFIX}-app" /bin/sh -c "echo DB_USERNAME=${DB_USER} >> /var/www/html/.env"
docker exec --user www-data --workdir "/var/www/html" "${PREFIX}-app" /bin/sh -c "echo DB_PASSWORD=${DB_USER_PASSWORD} >> /var/www/html/.env"
docker exec --user www-data --workdir "/var/www/html" "${PREFIX}-app" /bin/sh -c "echo DB_HOST=${PREFIX}-db >> /var/www/html/.env"
docker exec --user root "${PREFIX}-app" /bin/sh -c "sed -i 's|/var/www/html/public|/var/www/html|g' /etc/apache2/sites-available/000-default.conf"
docker restart "${PREFIX}-app"
docker exec --user www-data --workdir "/var/www/html" -it "${PREFIX}-app" /bin/sh -c "php artisan winter:install"
fi
if [ "${PROJECT_TYPE}" = "wordpress" ]; then
echo "Downloading WordPress core"
docker exec --user www-data "${PREFIX}-app" /bin/sh -c "
wp core download \
--locale=${WP_LOCALE} \
--path=/var/www/html \
--version=${WP_VERSION}"
echo "Creating WordPress config"
docker exec --user www-data "${PREFIX}-app" /bin/sh -c '
echo "Creating WordPress config"
docker exec --user www-data "${PREFIX}-app" /bin/sh -c '
wp config create \
--dbhost='"${PREFIX}-db"' \
--dbname='"${DB_NAME}"' \
@@ -132,8 +160,8 @@ if (isset(\$_SERVER["HTTP_X_FORWARDED_PROTO"]) && \$_SERVER["HTTP_X_FORWARDED_PR
EXTRA-PHP
'
echo "Installing WordPress core"
docker exec --user www-data "${PREFIX}-app" /bin/sh -c "
echo "Installing WordPress core"
docker exec --user www-data "${PREFIX}-app" /bin/sh -c "
wp core install \
--admin_email=no@mail.com \
--admin_password=${WP_ADMIN_PASSWORD} \
@@ -143,11 +171,13 @@ docker exec --user www-data "${PREFIX}-app" /bin/sh -c "
--title=${PREFIX} \
--url=${WP_DEFAULT_PROTOCOL}://${APP_URL}"
echo "Installing WordPress "${WP_THEME}" theme"
docker exec --user www-data "${PREFIX}-app" /bin/sh -c "
echo "Installing WordPress "${WP_THEME}" theme"
docker exec --user www-data "${PREFIX}-app" /bin/sh -c "
wp theme install ${WP_THEME} \
--activate \
--path=/var/www/html"
fi
docker compose up -d adminer
docker compose up -d app
docker compose up -d traefik

63
deploy-directory-to-remote.sh Executable file
View File

@@ -0,0 +1,63 @@
#! /bin/sh
#
if [ "$#" -eq 0 ] || [ "$#" -gt 1 ]; then
echo takes only one argument
exit 1
fi
if [ ! -e "${1}" ]; then
echo cannot find "${1}"
exit 1
fi
# shellcheck source=./deployment/deployment-example.env
. "${1}"
if [ "${do_backup}" = "yes" ]; then
if ssh ${remote_ssh_string} "mkdir --parents ${remote_deployment_directory_path}"; then
echo deployment folder successfully created on remote
else
echo deployment folder creation on remote failed
exit 1
fi
if ssh ${remote_ssh_string} "cp --archive --recursive ${remote_directory_path} ${remote_deployment_directory_path}/$(basename ${remote_directory_path}).backup.${now}"; then
echo backup of current remote directory successfully created on remote
else
echo backup of current remote directory failed
exit 1
fi
fi
if [ "${use_maintenance_mode}" = "yes" ]; then
if ssh ${remote_ssh_string} "wp option patch update wpmm_settings general status 1 --path=${remote_wp_path}"; then
echo maintenance mode activated
else
echo something went horribly wrong
exit 1
fi
fi
# --update removed after kartolok-child shenaningans
# --checksum added instead
if rsync --checksum --compress --delete --delete-excluded --exclude-from="${deployment_exclude_file}" --executability --human-readable --progress --recursive "${local_directory_path}/" "${remote_ssh_string}":"${remote_directory_path}"; then
echo syncing OK
else
echo syncing NOK
exit 1
fi
if [ "${use_maintenance_mode}" = "yes" ]; then
if ssh ${remote_ssh_string} "wp option patch update wpmm_settings general status 0 --path=${remote_wp_path}"; then
echo maintenance mode deactivated
else
echo something went horribly wrong
exit 1
fi
fi
if [ "${restart_remote_varnish}" = "yes" ]; then
set -x
ssh "${sudo_remote_ssh_string}" sudo service varnish restart
set +x
fi

View File

@@ -0,0 +1,12 @@
deployment_exclude_file=
local_directory_path=
now="$(date +%Y-%m-%d-%H-%M-%S)"
remote_deployment_directory_path=
remote_directory_path=
remote_ssh_string=
remote_wp_path=
remote_is_docker=
restart_remote_varnish=no
sudo_remote_ssh_string=
use_maintenance_mode=no
do_backup=yes

View File

@@ -6,6 +6,8 @@ networks:
services:
adminer:
container_name: ${PREFIX}-adminer
dns:
- 1.1.1.1
hostname: ${PREFIX}-adminer
image: adminer:4.8.1-standalone
labels:
@@ -16,11 +18,14 @@ services:
- traefik.http.services.${PREFIX}-adminer.loadbalancer.server.port=8080
app:
container_name: ${PREFIX}-app
dns:
- 1.1.1.1
environment:
- PHP_POST_MAX_SIZE=${PHP_POST_MAX_SIZE}
- 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
@@ -32,8 +37,10 @@ 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
- cache:/var/www/.cache
db:
command: --default-authentication-plugin=mysql_native_password
container_name: ${PREFIX}-db
@@ -51,6 +58,8 @@ services:
traefik:
container_name: ${PREFIX}-traefik
command: ["--configFile=/etc/traefik/static/traefik.yml"]
dns:
- 1.1.1.1
image: traefik:2.5.3
labels:
- traefik.enable=true
@@ -72,8 +81,12 @@ services:
version: "3.4"
volumes:
cache:
name: composer-cache
db:
name: ${PREFIX}-db
root:
name: ${PREFIX}-root
traefik-certs:
name: ${PREFIX}-traefik-certs
traefik-dynamic:

View File

@@ -1,4 +1,4 @@
SSL_CRT_LOCATION=<path>
SSL_CRT_NAME<certificate filename>
SSL_CRT_NAME=<certificate filename>
SSL_KEY_LOCATION=<path>
SSL_KEY_NAME=<key filename>

View File

@@ -0,0 +1,4 @@
PROJECT_TYPE=wordpress
PROJECT_TYPE=laravel
PROJECT_TYPE=livewire
PROJECT_TYPE=wintercms

View File

@@ -1,2 +1,2 @@
REMOTE_SSH_STRING=<sshconfig hostname>
REMOTE_WP_PATH=</var/www/example.com.be>
REMOTE_WP_PATH=</var/www/example.com>

View File

@@ -0,0 +1,4 @@
LOCAL_IP_ON_REMOTE=localhost
LOCAL_PORT=5432
LOCAL_PORT_ON_REMOTE=5432
REMOTE_HOST=federal-non-interactive

View File

@@ -6,11 +6,22 @@ set -a
. "${PWD}/env_files/migrate-db.env"
set +a
echo wp migratedb find-replace --find="//${REMOTE_WP_URL}","${REMOTE_WP_PATH}" --replace="//${APP_URL}",/var/www/html
read -p "Do we run the thing ? " REPLY
if [ "$REPLY" != "${REPLY#[YyOo]}" ]; then
echo "we carry on"
else
echo "we stop"
exit 1
fi
date +%H-%M-%S
docker exec --user www-data "${PREFIX}-app" /bin/sh -c '
wp plugin install wp-migrate-db ; wp plugin activate wp-migrate-db ; wp migratedb find-replace \
wp plugin install wp-migrate-db ; \
wp plugin activate wp-migrate-db ; \
wp migratedb find-replace \
--find='"//${REMOTE_WP_URL}"','"${REMOTE_WP_PATH}"' \
--replace='"//${APP_URL}"',/var/www/html \
--skip-replace-guids \
--exclude-post-revisions \
--exclude-spam
--replace='"//${APP_URL}"',/var/www/html
'
date +%H-%M-%S

View File

@@ -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}"
@@ -31,8 +35,8 @@ for volume in ${volumes}; do
fi
echo "mounting ${mount_path}"
sudo /usr/bin/bindfs \
--create-for-group=root \
--create-for-user=root \
--create-for-group=www-data \
--create-for-user=www-data \
--force-group="${MOUNT_USER}" \
--force-user="${MOUNT_USER}" \
"${volume_path}" \

View File

@@ -6,11 +6,23 @@ echo "en attendant: faire un dump de la remote db and utiliser replace-db et mig
exit 0
set -a
. "${PWD}/.env"
. "${PWD}/env_files/migrate-db.env"
. "${PWD}/env_files/remote.env"
set +a
mkdir --parents "${PWD}/tmp"
FILENAME="${REMOTE_ARCHIVE_TMP_NAME_PREFIX}".$(date +%Y-%m-%d-%H-%M-%S).sql
FILENAME="${REMOTE_WP_URL}".$(date +%Y-%m-%d-%H-%M-%S).sql
echo "wp \
migratedb \
export "/tmp/${FILENAME}.gz" \
--find="//${REMOTE_WP_URL},${REMOTE_WP_PATH}" \
--gzip-file \
--path="${REMOTE_WP_PATH}" \
--replace="//${APP_URL},/var/www/html" \
--skip-replace-guids \
--ssh="${REMOTE_SSH_STRING}""
wp \
migratedb \
@@ -18,16 +30,16 @@ wp \
--find="//${REMOTE_WP_URL},${REMOTE_WP_PATH}" \
--gzip-file \
--path="${REMOTE_WP_PATH}" \
--replace="//${WP_URL},/var/www/html" \
--replace="//${APP_URL},/var/www/html" \
--skip-replace-guids \
--ssh="${REMOTE_SSH_STRING}"
if ! scp "${REMOTE_SSH_STRING}:/tmp/${FILENAME}.gz" "${PWD}/tmp"; then
exit 0
if ! scp "${REMOTE_SSH_STRING}:/tmp/${FILENAME}_.gz" "${PWD}/tmp"; then
echo "couldn't get remote db"
exit 1
fi
gunzip "${PWD}/tmp/${FILENAME}.gz"
gunzip "${PWD}/tmp/${FILENAME}_.gz"
exit 0
docker compose up db -d
while ! docker ps -q -f name="${PREFIX}-db"; do
@@ -40,7 +52,6 @@ while ! docker exec "${PREFIX}-db" /bin/sh -c "mysqladmin ping -h 127.0.0.1 -P 3
sleep 1
done
FILENAME=sitefederalnextmove01_vpn_ecolo_be.2023-08-11-16-14-43.sql
docker cp "${PWD}/tmp/${FILENAME}" "${PREFIX}"-db:/tmp
echo "dropping ${DB_NAME}"

View File

@@ -29,6 +29,7 @@ fi
rsync \
--archive \
--delete \
--exclude '/wp-config.php' \
--exclude-from='exclude-list' \
--human-readable \
--progress \

View File

@@ -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"

View File

@@ -36,5 +36,7 @@ echo "dropping ${DB_NAME}"
docker exec "${PREFIX}-db" /bin/sh -c "mysqladmin --force -uroot -p${DB_ROOT_PASSWORD} drop ${DB_NAME}"
echo "creating ${DB_NAME}"
docker exec "${PREFIX}-db" /bin/sh -c "mysqladmin -uroot -p${DB_ROOT_PASSWORD} create ${DB_NAME}"
echo "importing ${dump_filename_path} ({PREFIX}-db/tmp/dump.sql) into ${DB_NAME}"
echo "run this command in another terminal/window to monitor progress:"
echo "docker exec -it watch -n1 ${PREFIX}-db du /var/lib/mysql/${DB_NAME}-sh"
echo "importing ${dump_filename_path} (${PREFIX}-db/tmp/dump.sql) into ${DB_NAME}"
docker exec "${PREFIX}-db" /bin/sh -c "mysql -uroot -p${DB_ROOT_PASSWORD} ${DB_NAME} < /tmp/dump.sql"

24
start-ssh-tunnel.sh Normal file
View File

@@ -0,0 +1,24 @@
#! /bin/sh
#
if [ "$#" -eq 0 ] || [ "$#" -gt 1 ]; then
echo takes only one argument
exit 1
fi
if [ ! -e "${1}" ]; then
echo cannot find "${1}"
exit 1
fi
# shellcheck source=./env_files/ssh-tunnel-example.env
. "${1}"
# shellcheck source=./.env-example
. ./.env
ssh \
-v \
-N \
-L \
"${TRAEFIK_LISTENING_IP}:${LOCAL_PORT}:${LOCAL_IP_ON_REMOTE}:${LOCAL_PORT_ON_REMOTE}" \
"${REMOTE_HOST}"

11
traefik.sh Executable file
View File

@@ -0,0 +1,11 @@
#! /bin/sh
#
set -a;
. "${PWD}/.env";
set +a;
docker exec \
-it \
--user root "${PREFIX}-traefik" \
/bin/ash

View File

@@ -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}"

1
wp.sh
View File

@@ -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