Compare commits
11 Commits
test
...
a5f9006e33
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a5f9006e33 | ||
|
|
32666edcdc | ||
|
|
062c764c9b | ||
|
|
c5716b8f7a | ||
|
|
7331fcf2d0 | ||
|
|
8997df6327 | ||
|
|
fbcba7cde4 | ||
|
|
07368aff02 | ||
|
|
e61b00b184 | ||
|
|
22a6286487 | ||
|
|
a51f2ae8f3 |
@@ -1,5 +1,6 @@
|
|||||||
APP_IMAGE_TAG=mywp:8.2.8-apache
|
APP_IMAGE_TAG=mywp:8.2.8-apache
|
||||||
APP_URL=wpdocker.test
|
APP_URL=wpdocker.test
|
||||||
|
COLLECTIVEACCESS_VERSION=1.7.8
|
||||||
DB_NAME=wordpress
|
DB_NAME=wordpress
|
||||||
DB_ROOT_PASSWORD=root
|
DB_ROOT_PASSWORD=root
|
||||||
DB_USER=user
|
DB_USER=user
|
||||||
|
|||||||
8
TODO.md
8
TODO.md
@@ -3,3 +3,11 @@
|
|||||||
- [ ] ajouter un moyen d'accéder à la db via un port
|
- [ ] 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)
|
- [ ] 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
|
- [ ] remplacer -a par --recursive,etc pour éviter qu'rsync n'affiche un transfert si atime, ctime, mtime a changé pour un fichier
|
||||||
|
|
||||||
|
# wintercms
|
||||||
|
|
||||||
|
- [ ] configurer l'écran de login du back-end en HTTPS
|
||||||
|
|
||||||
|
# wordpress
|
||||||
|
|
||||||
|
- [ ] documenter wppb-cli
|
||||||
|
|||||||
20
backup.sh
20
backup.sh
@@ -10,11 +10,14 @@ set -a
|
|||||||
. "${PWD}/.env"
|
. "${PWD}/.env"
|
||||||
set +a
|
set +a
|
||||||
|
|
||||||
now="$(date +%Y-%m_%d-%H-%M-%S)"
|
docker compose stop
|
||||||
|
|
||||||
|
now="$(date +%Y-%m-%d_%H-%M-%S)"
|
||||||
backup_path="${PWD}/backup-volumes/${now}"
|
backup_path="${PWD}/backup-volumes/${now}"
|
||||||
mkdir -p "${backup_path}"
|
mkdir -p "${backup_path}"
|
||||||
|
|
||||||
volumes="db root traefik-dynamic traefik-certs traefik-logs traefik-static webroot"
|
volumes="db root traefik-dynamic traefik-certs traefik-logs traefik-static webroot"
|
||||||
|
volumes="db"
|
||||||
for volume in ${volumes}; do
|
for volume in ${volumes}; do
|
||||||
mkdir -p "${backup_path}/${volume}"
|
mkdir -p "${backup_path}/${volume}"
|
||||||
docker run \
|
docker run \
|
||||||
@@ -25,9 +28,24 @@ for volume in ${volumes}; do
|
|||||||
tar -cvzf "/destination/${volume}.tar.gz" -C "/${volume}" .
|
tar -cvzf "/destination/${volume}.tar.gz" -C "/${volume}" .
|
||||||
done
|
done
|
||||||
|
|
||||||
|
docker compose restart db
|
||||||
|
docker compose restart app
|
||||||
|
while ! docker ps -q -f name="${PREFIX}-db"; do
|
||||||
|
echo "Waiting for the db container to be up and running..."
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
while ! docker exec "${PREFIX}-app" /bin/sh -c "mysqladmin ping -h ${PREFIX}-db -P 3306 --protocol=tcp -u user -puser --silent"; do
|
||||||
|
echo "Waiting for the mysql server in the db container to be up and running and reachable from the app container..."
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
mkdir -p "${backup_path}/db"
|
mkdir -p "${backup_path}/db"
|
||||||
docker exec "${PREFIX}-db" \
|
docker exec "${PREFIX}-db" \
|
||||||
/usr/bin/mysqldump \
|
/usr/bin/mysqldump \
|
||||||
-u root \
|
-u root \
|
||||||
--password="${DB_ROOT_PASSWORD}" \
|
--password="${DB_ROOT_PASSWORD}" \
|
||||||
"${DB_NAME}" > "${backup_path}/db/${DB_NAME}.sql"
|
"${DB_NAME}" > "${backup_path}/db/${DB_NAME}.sql"
|
||||||
|
|
||||||
|
docker compose stop db
|
||||||
|
docker compose stop app
|
||||||
|
|||||||
35
check-diff.sh
Normal file
35
check-diff.sh
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
#
|
||||||
|
|
||||||
|
set -x
|
||||||
|
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/checkdiff-example.env
|
||||||
|
. "${1}"
|
||||||
|
|
||||||
|
remote_copy_path=$(mktemp -d)
|
||||||
|
rsync \
|
||||||
|
--archive \
|
||||||
|
--checksum \
|
||||||
|
--human-readable \
|
||||||
|
"${REMOTE_SSH_STRING}":"${REMOTE_ROOT_PATH}${FOLDER_PATH}/" \
|
||||||
|
"${remote_copy_path}"
|
||||||
|
|
||||||
|
local_copy_path=$(mktemp -d)
|
||||||
|
rsync \
|
||||||
|
--archive \
|
||||||
|
--checksum \
|
||||||
|
--exclude-from="${EXCLUDEFILE_PATH}" \
|
||||||
|
--human-readable \
|
||||||
|
"${LOCAL_ROOT_PATH}${FOLDER_PATH}/" \
|
||||||
|
"${local_copy_path}"
|
||||||
|
|
||||||
|
kdiff3 "${local_copy_path}" "${remote_copy_path}"
|
||||||
81
create.sh
81
create.sh
@@ -137,7 +137,88 @@ if [ "${PROJECT_TYPE}" = "wintercms" ]; then
|
|||||||
docker exec --user www-data --workdir "/var/www/html" -it "${PREFIX}-app" /bin/sh -c "php artisan winter:install"
|
docker exec --user www-data --workdir "/var/www/html" -it "${PREFIX}-app" /bin/sh -c "php artisan winter:install"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "${PROJECT_TYPE}" = "laravel" ] || [ "${PROJECT_TYPE}" = "livewire" ] || [ "${PROJECT_TYPE}" = "php" ]; then
|
||||||
|
echo "Generating vscode launch.json file"
|
||||||
|
cat << EOF > /tmp/${PREFIX}/launch.json
|
||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"hostname": "${TRAEFIK_LISTENING_IP}",
|
||||||
|
"name": "Listen for Xdebug (${TRAEFIK_LISTENING_IP})",
|
||||||
|
"pathMappings": {
|
||||||
|
"/var/www/html/": "\${workspaceRoot}/",
|
||||||
|
},
|
||||||
|
"port": 9003,
|
||||||
|
"request": "launch",
|
||||||
|
"type": "php"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
docker run \
|
||||||
|
--rm \
|
||||||
|
--user www-data \
|
||||||
|
--volume "${PREFIX}-app":/destination \
|
||||||
|
ubuntu \
|
||||||
|
mkdir --parents /destination/.vscode
|
||||||
|
docker run \
|
||||||
|
--rm \
|
||||||
|
--user www-data \
|
||||||
|
--volume "${PREFIX}-app":/destination \
|
||||||
|
ubuntu \
|
||||||
|
cp /source/launch.json /destination/.vscode
|
||||||
|
docker run \
|
||||||
|
--rm \
|
||||||
|
--user root \
|
||||||
|
--volume "${PREFIX}-app":/destination \
|
||||||
|
ubuntu \
|
||||||
|
chown www-data:www-data /destination/.vscode -r
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${PROJECT_TYPE}" = "collectiveaccess" ]; then
|
||||||
|
echo "Installing collective-access"
|
||||||
|
docker exec --user www-data "${PREFIX}-app" /bin/sh -c "
|
||||||
|
git clone \
|
||||||
|
--branch ${COLLECTIVEACCESS_VERSION} \
|
||||||
|
--single-branch \
|
||||||
|
https://github.com/collectiveaccess/providence.git \
|
||||||
|
/var/www/html
|
||||||
|
"
|
||||||
|
docker exec --user www-data "${PREFIX}-app" /bin/sh -c "
|
||||||
|
mkdir /var/www/html/media/collectiveaccess && \
|
||||||
|
chown 33:33 /var/www/html/media/collectiveaccess && \
|
||||||
|
chown 33:33 /var/www/html/media/collectiveaccess --recursive
|
||||||
|
"
|
||||||
|
cat << EOF > /tmp/${PREFIX}/setup.php
|
||||||
|
<?php
|
||||||
|
define("__CA_DB_HOST__", '${PREFIX}-db');
|
||||||
|
define("__CA_DB_USER__", '${DB_USER}');
|
||||||
|
define("__CA_DB_PASSWORD__", '${DB_USER_PASSWORD}');
|
||||||
|
define("__CA_DB_DATABASE__", '${DB_NAME}');
|
||||||
|
define("__CA_DEFAULT_LOCALE__", "fr_FR");
|
||||||
|
define("__CA_APP_DISPLAY_NAME__", "My First CollectiveAccess System");
|
||||||
|
define("__CA_ADMIN_EMAIL__", 'info@put-your-domain-here.com');
|
||||||
|
date_default_timezone_set('Europe/Paris');
|
||||||
|
define("__CA_QUEUE_ENABLED__", 0);
|
||||||
|
define("__CA_USE_CLEAN_URLS__", 0);
|
||||||
|
define("__CA_APP_NAME__", "collectiveaccess");
|
||||||
|
define("__CA_GOOGLE_MAPS_KEY__", "");
|
||||||
|
define('__CA_CACHE_BACKEND__', 'file');
|
||||||
|
define('__CA_ALLOW_INSTALLER_TO_OVERWRITE_EXISTING_INSTALLS__', false);
|
||||||
|
define('__CA_STACKTRACE_ON_EXCEPTION__', false);
|
||||||
|
require(__DIR__."/app/helpers/post-setup.php");
|
||||||
|
EOF
|
||||||
|
docker cp "/tmp/${PREFIX}/setup.php" "${PREFIX}-app":/var/www/html
|
||||||
|
docker exec --user root "${PREFIX}-app" /bin/sh -c "
|
||||||
|
chown 33:33 /var/www/html/setup.php
|
||||||
|
"
|
||||||
|
docker cp "/home/vanhalleje/CARHOP/Collective Access/mappings/default/profile.xml" "${PREFIX}-app":/var/www/html/install/profiles/xml/sample_profile.xml
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "${PROJECT_TYPE}" = "wordpress" ]; then
|
if [ "${PROJECT_TYPE}" = "wordpress" ]; then
|
||||||
|
echo "Installing wppb-cli"
|
||||||
|
composer global require tmeister/wppb-cli
|
||||||
echo "Downloading WordPress core"
|
echo "Downloading WordPress core"
|
||||||
docker exec --user www-data "${PREFIX}-app" /bin/sh -c "
|
docker exec --user www-data "${PREFIX}-app" /bin/sh -c "
|
||||||
wp core download \
|
wp core download \
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ services:
|
|||||||
- PHP_UPLOAD_MAX_FILESIZE=${PHP_UPLOAD_MAX_FILESIZE}
|
- PHP_UPLOAD_MAX_FILESIZE=${PHP_UPLOAD_MAX_FILESIZE}
|
||||||
- XDEBUG_CLIENT_HOST=${XDEBUG_CLIENT_HOST}
|
- XDEBUG_CLIENT_HOST=${XDEBUG_CLIENT_HOST}
|
||||||
- XDEBUG_MODE=${XDEBUG_MODE}
|
- XDEBUG_MODE=${XDEBUG_MODE}
|
||||||
|
extra_hosts:
|
||||||
|
- "${APP_URL}:${TRAEFIK_LISTENING_IP}"
|
||||||
hostname: ${PREFIX}-app
|
hostname: ${PREFIX}-app
|
||||||
image: ${APP_IMAGE_TAG}
|
image: ${APP_IMAGE_TAG}
|
||||||
labels:
|
labels:
|
||||||
@@ -60,7 +62,7 @@ services:
|
|||||||
command: ["--configFile=/etc/traefik/static/traefik.yml"]
|
command: ["--configFile=/etc/traefik/static/traefik.yml"]
|
||||||
dns:
|
dns:
|
||||||
- 1.1.1.1
|
- 1.1.1.1
|
||||||
image: traefik:2.5.3
|
image: traefik:2.11.31
|
||||||
labels:
|
labels:
|
||||||
- traefik.enable=true
|
- traefik.enable=true
|
||||||
- traefik.http.routers.${PREFIX}-traefik.entrypoints=https
|
- traefik.http.routers.${PREFIX}-traefik.entrypoints=https
|
||||||
@@ -78,24 +80,31 @@ services:
|
|||||||
- traefik-logs:/logs
|
- traefik-logs:/logs
|
||||||
- traefik-static:/etc/traefik/static:ro
|
- traefik-static:/etc/traefik/static:ro
|
||||||
|
|
||||||
version: "3.4"
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
cache:
|
cache:
|
||||||
|
external: true
|
||||||
name: composer-cache
|
name: composer-cache
|
||||||
db:
|
db:
|
||||||
|
external: true
|
||||||
name: ${PREFIX}-db
|
name: ${PREFIX}-db
|
||||||
root:
|
root:
|
||||||
|
external: true
|
||||||
name: ${PREFIX}-root
|
name: ${PREFIX}-root
|
||||||
traefik-certs:
|
traefik-certs:
|
||||||
|
external: true
|
||||||
name: ${PREFIX}-traefik-certs
|
name: ${PREFIX}-traefik-certs
|
||||||
traefik-dynamic:
|
traefik-dynamic:
|
||||||
|
external: true
|
||||||
name: ${PREFIX}-traefik-dynamic
|
name: ${PREFIX}-traefik-dynamic
|
||||||
traefik-logs:
|
traefik-logs:
|
||||||
|
external: true
|
||||||
name: ${PREFIX}-traefik-logs
|
name: ${PREFIX}-traefik-logs
|
||||||
traefik-static:
|
traefik-static:
|
||||||
|
external: true
|
||||||
name: ${PREFIX}-traefik-static
|
name: ${PREFIX}-traefik-static
|
||||||
webroot:
|
webroot:
|
||||||
|
external: true
|
||||||
name: ${PREFIX}-webroot
|
name: ${PREFIX}-webroot
|
||||||
wp-cli-cache:
|
wp-cli-cache:
|
||||||
|
external: true
|
||||||
name: wp-cli-cache
|
name: wp-cli-cache
|
||||||
|
|||||||
5
env_files/checkdiff-example.env
Normal file
5
env_files/checkdiff-example.env
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
REMOTE_SSH_STRING=<sshconfig hostname>
|
||||||
|
REMOTE_ROOT_PATH=</var/www/example.com/www>
|
||||||
|
LOCAL_ROOT_PATH=</home/user/dev/www>
|
||||||
|
FOLDER_PATH=</wp-content/themes/bar>
|
||||||
|
EXCLUDEFILE_PATH=<./deployment/example.com.bar.exclude>
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
PROJECT_TYPE=wordpress
|
|
||||||
PROJECT_TYPE=laravel
|
PROJECT_TYPE=laravel
|
||||||
PROJECT_TYPE=livewire
|
PROJECT_TYPE=livewire
|
||||||
|
PROJECT_TYPE=php
|
||||||
PROJECT_TYPE=wintercms
|
PROJECT_TYPE=wintercms
|
||||||
|
PROJECT_TYPE=wordpress
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ set -a
|
|||||||
set +a
|
set +a
|
||||||
|
|
||||||
docker exec \
|
docker exec \
|
||||||
-e SHELLOPTS=vi \
|
|
||||||
-e HISTFILE=/var/www/html/.bash_history \
|
-e HISTFILE=/var/www/html/.bash_history \
|
||||||
|
-e SHELLOPTS=vi \
|
||||||
-it --user www-data \
|
-it --user www-data \
|
||||||
"${PREFIX}-app" \
|
"${PREFIX}-app" \
|
||||||
/bin/bash
|
/bin/bash
|
||||||
Reference in New Issue
Block a user