version 1.0.0
This commit is contained in:
parent
b9bc9a7279
commit
425497e0d5
@ -1,4 +0,0 @@
|
||||
HOST_NAME=wp-dev.gmolab.net
|
||||
HOST_IP=172.31.10.15
|
||||
PHPADMIN_IMAGE=arm64v8/phpmyadmin:5.2.3
|
||||
ENVIRONMENT=gmolab
|
||||
@ -1,4 +0,0 @@
|
||||
HOST_NAME=wp.vdglab.net
|
||||
HOST_IP=10.10.8.104
|
||||
PHPADMIN_IMAGE=phpmyadmin/phpmyadmin:latest
|
||||
ENVIRONMENT=vdglab
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
.env
|
||||
dump-db/*.sql
|
||||
79
README.md
79
README.md
@ -4,26 +4,27 @@
|
||||
This docker compose run wordpress on docker
|
||||
|
||||
## Requierments
|
||||
### Folder
|
||||
* GMoTech/GMoLab/VdGLab Linux environment
|
||||
* Rocky Linux 10
|
||||
* Redhat 10
|
||||
* Certificats
|
||||
* Copy crt and key files on `/home/docker/certs/`
|
||||
* Environment file
|
||||
|
||||
## Environment file
|
||||
Copy `env-dist` to `env-<environment_name>` file and adapt as your needs
|
||||
|
||||
## Build
|
||||
```bash
|
||||
sudo mkdir -p /home/docker/wp/wp-site
|
||||
sudo mkdir -p /home/docker/wp/wp-db
|
||||
./manage.sh --env <env_name> --build
|
||||
```
|
||||
### Certificats
|
||||
Copy crt and key files on `/home/docker/certs/`
|
||||
|
||||
## Env file
|
||||
|
||||
## DB
|
||||
Dans le script modifier le sql en fonction de l'environnement
|
||||
A faire
|
||||
|
||||
## Run
|
||||
## Start
|
||||
```bash
|
||||
docker compose up -d
|
||||
./manage.sh --env <env_name> --start
|
||||
```
|
||||
## DB
|
||||
The base DB is ready
|
||||
The database is a dump of wp first install
|
||||
The script adapt the sql file with data from environment file
|
||||
|
||||
## Apache
|
||||
### http-wp-dev.conf
|
||||
@ -74,13 +75,57 @@ The base DB is ready
|
||||
ProxyPassReverse "/" "https://127.0.0.1:8080/"
|
||||
</VirtualHost>
|
||||
```
|
||||
### http-phpmyadmin-dev.conf
|
||||
```
|
||||
<VirtualHost *:80>
|
||||
ServerName phpmyadmin-dev.gmolab.net
|
||||
ServerAlias phpmyadmin-dev
|
||||
CustomLog logs/phpmyadmin-dev_access_log common
|
||||
ErrorLog logs/phpmyadmin-dev_error_log
|
||||
# redirect to https
|
||||
RewriteEngine on
|
||||
RewriteCond %{SERVER_NAME} =wp-dev [OR]
|
||||
RewriteCond %{SERVER_NAME} =phpmyadmin-dev.gmolab.net
|
||||
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
|
||||
</VirtualHost>
|
||||
```
|
||||
### https-phpmyadmin-dev.conf
|
||||
```
|
||||
# General setup for the virtual host
|
||||
<VirtualHost *:443>
|
||||
ServerName phpmyadmin-dev.gmolab.net
|
||||
ServerAlias phpmyadmin-dev
|
||||
CustomLog logs/phpmyadmin-dev_access_log common
|
||||
ErrorLog logs/phpmyadmin-dev_error_log
|
||||
|
||||
# SSL
|
||||
SSLEngine on
|
||||
SSLHonorCipherOrder on
|
||||
SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
|
||||
SSLHonorCipherOrder on
|
||||
SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4
|
||||
# Enable HTTP/2, if available
|
||||
Protocols h2 http/1.1
|
||||
# HTTP Strict Transport Security (mod_headers is required) (63072000 seconds)
|
||||
Header always set Strict-Transport-Security "max-age=63072000"
|
||||
# certificats
|
||||
SSLCertificateFile "/etc/httpd/auth/cert/gmolab.net.crt"
|
||||
SSLCertificateKeyFile "/etc/httpd/auth/cert/gmolab.net.key"
|
||||
SSLCertificateChainFile "/etc/httpd/auth/cert/gmolabCA.crt"
|
||||
# proxy
|
||||
RequestHeader set X-Forwarded-Proto "https"
|
||||
ProxyPreserveHost On
|
||||
ProxyPass "/" "http://127.0.0.1:8180/"
|
||||
ProxyPassReverse "/" "http://127.0.0.1:8180/"
|
||||
</VirtualHost>
|
||||
```
|
||||
|
||||
## Access
|
||||
https://wp-dev.gmolab.net
|
||||
|
||||
https://phpmyadmin-dev.gmolab.net
|
||||
|
||||
### [1.0.0] - 2026-02-06
|
||||
#### Added
|
||||
- initial version by [GMo](mailto:gilles.mouchet@gmail.com)
|
||||
|
||||
|
||||
|
||||
|
||||
412
db-tmpl.sql
Normal file
412
db-tmpl.sql
Normal file
File diff suppressed because one or more lines are too long
@ -3,9 +3,8 @@ services:
|
||||
wordpress:
|
||||
image: wordpress:latest
|
||||
extra_hosts:
|
||||
#- "wp-dev.gmolab.net:172.31.10.15"
|
||||
- "${HOST_NAME}:${HOST_IP}"
|
||||
container_name: wp-site
|
||||
container_name: ${WP_SITE}
|
||||
volumes:
|
||||
- /home/docker/wp/wp-site:/var/www/html
|
||||
- ./config/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
|
||||
@ -17,38 +16,35 @@ services:
|
||||
WORDPRESS_TABLE_PREFIX: wp_
|
||||
depends_on:
|
||||
- db
|
||||
# - phpmyadmin
|
||||
- phpmyadmin
|
||||
restart: always
|
||||
ports:
|
||||
- 8080:80
|
||||
|
||||
db:
|
||||
image: mysql:8.0
|
||||
container_name: wp-db
|
||||
image: mysql:8.4.8
|
||||
container_name: ${WP_DB}
|
||||
volumes:
|
||||
- /home/docker/wp/wp-db:/var/lib/mysql
|
||||
# This is optional!!!
|
||||
- ./dump-db/${ENVIRONMENT}-db:/docker-entrypoint-initdb.d
|
||||
# # #
|
||||
- ./dump-db/:/docker-entrypoint-initdb.d
|
||||
environment:
|
||||
MYSQL_DATABASE: wordpress
|
||||
MYSQL_USER: wpuser
|
||||
MYSQL_PASSWORD: wppassword
|
||||
MYSQL_ROOT_PASSWORD: rootpassword
|
||||
|
||||
# - MYSQL_ROOT_PASSWORD=pa55w0rd
|
||||
# - MYSQL_USER=root
|
||||
# - MYSQL_PASSWORD=pa55w0rd4wp
|
||||
# - MYSQL_DATABASE=wordpress
|
||||
restart: always
|
||||
ports:
|
||||
- 3306:3306
|
||||
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
|
||||
phpmyadmin:
|
||||
depends_on:
|
||||
- db
|
||||
#image: phpmyadmin/phpmyadmin:latest
|
||||
#image: arm64v8/phpmyadmin:5.2.3
|
||||
image: ${PHPADMIN_IMAGE}
|
||||
container_name: wp-phpmyadmin
|
||||
restart: always
|
||||
@ -58,7 +54,7 @@ services:
|
||||
PMA_HOST: db
|
||||
PMA_USER: root
|
||||
PMA_PASSWORD: rootpassword
|
||||
#MYSQL_ROOT_PASSWORD: pa55w0rd
|
||||
|
||||
|
||||
#volumes:
|
||||
# db_data:
|
||||
@ -1,46 +0,0 @@
|
||||
name: gmo
|
||||
services:
|
||||
wp-site:
|
||||
image: wordpress:latest
|
||||
extra_hosts:
|
||||
- "wp.vdglab.net:10.10.8.104"
|
||||
container_name: wp-site
|
||||
volumes:
|
||||
- /home/docker/wp/wp-site:/var/www/html
|
||||
- ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
|
||||
# - ./wp-config.php:/var/www/html/wp-config.php
|
||||
environment:
|
||||
WORDPRESS_DB_HOST: wp-db
|
||||
WORDPRESS_DB_NAME: wordpress
|
||||
WORDPRESS_DB_USER: wpuser
|
||||
WORDPRESS_DB_PASSWORD: wppassword
|
||||
WORDPRESS_TABLE_PREFIX: wp_
|
||||
WORDPRESS_CONFIG_EXTRA: |
|
||||
define('WP_HOME', 'https://wp.vdglab.net');
|
||||
define('WP_SITEURL', 'https://wp.vdglab.net');
|
||||
if (!empty($$_SERVER['HTTP_X_FORWARDED_PROTO']) && $$_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
|
||||
$$_SERVER['HTTPS'] = 'on';
|
||||
}
|
||||
depends_on:
|
||||
- wp-db
|
||||
restart: always
|
||||
ports:
|
||||
- 8008:80
|
||||
|
||||
wp-db:
|
||||
image: mysql:8.0
|
||||
container_name: wp-db
|
||||
volumes:
|
||||
- /home/docker/wp/wp-db:/var/lib/mysql
|
||||
# This is optional!!!
|
||||
- ./dump-db/${ENVIRONMENT}-db:/docker-entrypoint-initdb.d
|
||||
# # #
|
||||
environment:
|
||||
MYSQL_DATABASE: wordpress
|
||||
MYSQL_USER: wpuser
|
||||
MYSQL_PASSWORD: wppassword
|
||||
MYSQL_ROOT_PASSWORD: rootpassword
|
||||
restart: always
|
||||
ports:
|
||||
- 3306:3306
|
||||
|
||||
0
dump-db/.gitkeep
Normal file
0
dump-db/.gitkeep
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
18
env-dist
Normal file
18
env-dist
Normal file
@ -0,0 +1,18 @@
|
||||
# environment
|
||||
ENVIRONMENT=gmolab
|
||||
# site
|
||||
SITE_TITLE="GMo Lab"
|
||||
# container
|
||||
WP_SITE=wp-site
|
||||
WP_DB=wp-db
|
||||
# host
|
||||
HOST_NAME=wp-dev.gmolab.net
|
||||
HOST_IP=172.31.10.15
|
||||
# phpadmin image
|
||||
PHPADMIN_IMAGE=arm64v8/phpmyadmin:latest
|
||||
#PHPADMIN_IMAGE=amd64/phpmyadmin:latest
|
||||
# wp client URL
|
||||
WP_CLI_URL=https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
||||
WP_CLI=wp-cli.phar
|
||||
# gantry theme
|
||||
GANTRY_THEME_HYDROGEN_URL=https://github.com/gantry/gantry5/releases/download/5.5.25/wordpress-tpl_g5_hydrogen_v5.5.25.zip
|
||||
17
env-gmolab
Normal file
17
env-gmolab
Normal file
@ -0,0 +1,17 @@
|
||||
# environment
|
||||
ENVIRONMENT=gmolab
|
||||
# site
|
||||
SITE_TITLE="GMo Lab"
|
||||
# container
|
||||
WP_SITE=wp-site
|
||||
WP_DB=wp-db
|
||||
# host
|
||||
HOST_NAME=wp-dev.gmolab.net
|
||||
HOST_IP=172.31.10.15
|
||||
# phpadmin image
|
||||
PHPADMIN_IMAGE=arm64v8/phpmyadmin:latest
|
||||
# wp client URL
|
||||
WP_CLI_URL=https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
||||
WP_CLI=wp-cli.phar
|
||||
# gantry theme
|
||||
GANTRY_THEME_HYDROGEN_URL=https://github.com/gantry/gantry5/releases/download/5.5.25/wordpress-tpl_g5_hydrogen_v5.5.25.zip
|
||||
17
env-vdglab
Normal file
17
env-vdglab
Normal file
@ -0,0 +1,17 @@
|
||||
# environment
|
||||
ENVIRONMENT=vdglab
|
||||
# site
|
||||
SITE_TITLE="VdG Lab"
|
||||
# container
|
||||
WP_SITE=wp-site
|
||||
WP_DB=wp-db
|
||||
# host
|
||||
HOST_NAME=wp.vdglab.net
|
||||
HOST_IP=10.10.8.104
|
||||
# phpadmin image
|
||||
PHPADMIN_IMAGE=amd64/phpmyadmin:latest
|
||||
# wp client URL
|
||||
WP_CLI_URL=https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
||||
WP_CLI=wp-cli.phar
|
||||
# gantry theme
|
||||
GANTRY_THEME_HYDROGEN_URL=https://github.com/gantry/gantry5/releases/download/5.5.25/wordpress-tpl_g5_hydrogen_v5.5.25.zip
|
||||
@ -1,30 +0,0 @@
|
||||
##
|
||||
## SSL Virtual Host Context
|
||||
##
|
||||
# General setup for the virtual host
|
||||
<VirtualHost *:443>
|
||||
ServerName phpmyadmin-dev.gmolab.net
|
||||
ServerAlias phpmyadmin-dev
|
||||
CustomLog logs/phpmyadmin-dev_access_log common
|
||||
ErrorLog logs/phpmyadmin-dev_error_log
|
||||
|
||||
# SSL
|
||||
SSLEngine on
|
||||
SSLHonorCipherOrder on
|
||||
SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
|
||||
SSLHonorCipherOrder on
|
||||
SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4
|
||||
# Enable HTTP/2, if available
|
||||
Protocols h2 http/1.1
|
||||
# HTTP Strict Transport Security (mod_headers is required) (63072000 seconds)
|
||||
Header always set Strict-Transport-Security "max-age=63072000"
|
||||
# certificats
|
||||
SSLCertificateFile "/etc/httpd/auth/cert/gmolab.net.crt"
|
||||
SSLCertificateKeyFile "/etc/httpd/auth/cert/gmolab.net.key"
|
||||
SSLCertificateChainFile "/etc/httpd/auth/cert/gmolabCA.crt"
|
||||
# proxy
|
||||
RequestHeader set X-Forwarded-Proto "https"
|
||||
ProxyPreserveHost On
|
||||
ProxyPass "/" "http://127.0.0.1:8180/"
|
||||
ProxyPassReverse "/" "http://127.0.0.1:8180/"
|
||||
</VirtualHost>
|
||||
262
manage.sh
Executable file
262
manage.sh
Executable file
@ -0,0 +1,262 @@
|
||||
#!/bin/bash
|
||||
############################################################
|
||||
# Decription: gestion docker compose
|
||||
# Author: Gilles Mouchet (gilles.mouchet@gmail.com)
|
||||
# Creation Date: 08.02.2026
|
||||
# Version actuelle: 1.0.0
|
||||
#
|
||||
# Changelog:
|
||||
# V1.0.0 - 08.02.2026 - GMo
|
||||
# Ajouté
|
||||
# - Création du script
|
||||
#
|
||||
############################################################
|
||||
|
||||
#Constantes
|
||||
SCRIPT_NAME=$(basename "$0")
|
||||
UPDATE_DATE=08.02.2026
|
||||
VERSION=1.0.0
|
||||
|
||||
WP_ROOT_FOLDER=/home/docker/wp
|
||||
WP_SITE_FOLDER=$WP_ROOT_FOLDER/wp-site
|
||||
WP_DB_FOLDER=$WP_ROOT_FOLDER/wp-db
|
||||
|
||||
RED='\e[1;31m'
|
||||
GREEN='\e[0;32m'
|
||||
ORANGE='\e[0;33m'
|
||||
YELLOW='\e[1;33m'
|
||||
BLUE='\e[0;34m'
|
||||
PURPLE='\e[1;35m'
|
||||
CYAN='\e[1;36m'
|
||||
NC='\e[0m'
|
||||
|
||||
# Define functions to display usage information
|
||||
version() {
|
||||
cat<<EOF
|
||||
${SCRIPT_NAME} - Version: $VERSION ($UPDATE_DATE) - Gilles Mouchet (gilles.mouchet@gmail.com)
|
||||
Non-Commercial Use License – See LICENSE for details
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Define functions to display usage information
|
||||
usage() {
|
||||
cat << EOF
|
||||
|
||||
Manage docker compose
|
||||
${SCRIPT_NAME} - Version: $VERSION ($UPDATE_DATE) - Gilles Mouchet (gilles.mouchet@gmail.com)
|
||||
|
||||
Usage: $SCRIPT_NAME <options>
|
||||
|
||||
Options:
|
||||
--bash open shell root in container wp
|
||||
--console start docker compose as console
|
||||
--delete stop and delete container and delete files in ${WP_ROOT_FOLDER}
|
||||
--down stop docker compose and delete container
|
||||
--stop stop docker compose
|
||||
--start start docker compose as daemon
|
||||
--version version
|
||||
--help this help
|
||||
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
inst-wpcli() {
|
||||
# install wp-cli.phar
|
||||
if [ ! -f "$WP_SITE_FOLDER/$WP_CLI" ]; then
|
||||
echo "Install wp-cli.phar."
|
||||
sudo curl -s -o $WP_SITE_FOLDER/$WP_CLI $WP_CLI_URL
|
||||
sudo chmod +x $WP_SITE_FOLDER/$WP_CLI
|
||||
fi
|
||||
}
|
||||
|
||||
check-container-exist(){
|
||||
if [ ! "$(docker ps -aq -f name=^/${WP_SITE}$)" ]; then
|
||||
echo -e "\n${RED}Container '$WP_SITE' do not exist!${NC}"
|
||||
echo -e "Use commande './${SCRIPT_NAME} --build'\n"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! "$(docker ps -aq -f name=^/${WP_DB}$)" ]; then
|
||||
echo -e "\n${RED}Container '$WP_DB' do not exist!${NC}"
|
||||
echo -e "Use commande './${SCRIPT_NAME} --build'\n"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check-container-up(){
|
||||
# check if stack is up ()
|
||||
if [ ! "$(docker inspect -f '{{.State.Status}}' "$WP_SITE" 2>/dev/null)" = "running" ]; then
|
||||
echo -e "\n${RED}$WP_SITE not started${NC}"
|
||||
echo -e "Execute './${SCRIPT_NAME} --up' to start containers\n"
|
||||
exit
|
||||
fi
|
||||
if [ ! "$(docker inspect -f '{{.State.Status}}' "$WP_DB" 2>/dev/null)" = "running" ]; then
|
||||
echo -e "${RED}$WP_DB not started${NC}"
|
||||
echo "Execute './${SCRIPT_NAME} --up' to start containers"
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------
|
||||
# MAIN
|
||||
#-----------------------------------------------------------
|
||||
|
||||
# create destinations folders
|
||||
if [ ! -d "$WP_ROOT_FOLDER" ]; then
|
||||
#echo "create $WP_ROOT_FOLDER"
|
||||
sudo mkdir -p $WP_ROOT_FOLDER
|
||||
fi
|
||||
|
||||
# check param exist
|
||||
if [ -z "$1" ]; then
|
||||
usage
|
||||
exit
|
||||
fi
|
||||
|
||||
# analysis of arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--help)
|
||||
usage
|
||||
;;
|
||||
--version)
|
||||
version
|
||||
;;
|
||||
--env)
|
||||
if [[ -n "$2" && "$2" != -* ]]; then
|
||||
ENV="$2"
|
||||
shift 2
|
||||
else
|
||||
echo -e "\n${RED}Error: --env requires an argument.${NC}"
|
||||
usage
|
||||
fi
|
||||
;;
|
||||
--bash)
|
||||
MODE="bash"
|
||||
shift
|
||||
;;
|
||||
--build)
|
||||
MODE="build"
|
||||
shift
|
||||
;;
|
||||
--console)
|
||||
MODE="console"
|
||||
shift
|
||||
;;
|
||||
--down)
|
||||
MODE="down"
|
||||
shift
|
||||
;;
|
||||
--delete)
|
||||
MODE="delete"
|
||||
shift
|
||||
;;
|
||||
--stop)
|
||||
MODE="stop"
|
||||
shift
|
||||
;;
|
||||
--start)
|
||||
MODE="start"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo -e "\n${RED}Error: Unknown option !${NC}: $1"
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# if we have an ENV but no mode (--bash, --console, ...)
|
||||
if [[ -n "$ENV" && -z "$MODE" ]]; then
|
||||
echo -e "\n${RED}\nError: Missing options${NC}"
|
||||
usage
|
||||
fi
|
||||
|
||||
# if we have a mode but no ENV (since --env is mandatory outside of help/version)
|
||||
if [[ -n "$MODE" && -z "$ENV" ]]; then
|
||||
echo -e "\n${RED}Error: The --env option is required to use --$MODE.${NC}"
|
||||
usage
|
||||
fi
|
||||
|
||||
# if nothing is provided
|
||||
if [[ -z "$ENV" && -z "$MODE" ]]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}------------------------"
|
||||
echo "Environment: $ENV"
|
||||
echo -e "------------------------${NC}"
|
||||
|
||||
# check if env file exist
|
||||
# copy file env
|
||||
if [ -f "env-$ENV" ]; then
|
||||
cp env-$ENV .env
|
||||
. .env
|
||||
sed -e "s/_FQDN_/$HOST_NAME/g" \
|
||||
-e "s/_SITE_TITLE_/$SITE_TITLE/g" < db-tmpl.sql > dump-db/wp-db.sql
|
||||
else
|
||||
echo -e "\n${RED}Error: file env-$ENV do not exist${NC}\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$MODE" in
|
||||
bash)
|
||||
check-container-exist
|
||||
check-container-up
|
||||
docker exec --user root -it wp-site /bin/bash
|
||||
;;
|
||||
build)
|
||||
docker compose up -d
|
||||
echo "Waiting for status 'healthy'... of container $WP_DB"
|
||||
until [ "$(docker inspect -f '{{.State.Health.Status}}' $WP_DB)" == "healthy" ]; do
|
||||
echo -n "."
|
||||
sleep 2
|
||||
done
|
||||
echo " "
|
||||
inst-wpcli
|
||||
docker exec "$WP_SITE" ./wp-cli.phar plugin install gantry5 --activate --allow-root
|
||||
docker exec "$WP_SITE" ./wp-cli.phar theme install $GANTRY_THEME_HYDROGEN_URL --activate --allow-root
|
||||
sudo chown 33:33 $WP_SITE_FOLDER -R
|
||||
docker compose stop
|
||||
;;
|
||||
console)
|
||||
check-container-exist
|
||||
docker compose up
|
||||
#sudo chown 33:33 $WP_SITE_FOLDER -R
|
||||
;;
|
||||
delete)
|
||||
echo -e "${RED}-----------------------------------------------------------------------------------------------------"
|
||||
echo -e "Do you really want to delete the contents of the /home/docker/${root_app} folder [y/N]?"
|
||||
echo -e "----------------------------------------------------------------------------------------------------- ${NC}"
|
||||
|
||||
unset answer
|
||||
read answer
|
||||
if [ "${answer}" != "y" ]; then
|
||||
echo -e "${ORANGE}Operation cancelled!${NC}"
|
||||
exit 1
|
||||
fi
|
||||
docker compose down
|
||||
#sleep 5
|
||||
sudo rm -rf $WP_ROOT_FOLDER
|
||||
exit
|
||||
;;
|
||||
down)
|
||||
docker compose down
|
||||
exit
|
||||
;;
|
||||
stop)
|
||||
docker compose stop
|
||||
exit
|
||||
;;
|
||||
start)
|
||||
check-container-exist
|
||||
docker compose up -d
|
||||
echo "Waiting for status 'healthy'... of container $WP_DB"
|
||||
until [ "$(docker inspect -f '{{.State.Health.Status}}' $WP_DB)" == "healthy" ]; do
|
||||
echo -n "."
|
||||
sleep 2
|
||||
done
|
||||
echo " "
|
||||
;;
|
||||
esac
|
||||
133
script.sh
133
script.sh
@ -1,133 +0,0 @@
|
||||
#!/bin/bash
|
||||
############################################################
|
||||
# Decription: gestion docker compose
|
||||
# Author: Gilles Mouchet (gilles.mouchet@gmail.com)
|
||||
# Creation Date: 02.02.2026
|
||||
# Version actuelle: 1.0.0
|
||||
#
|
||||
# Changelog:
|
||||
# V1.0.0 - 02.02.2026 - GMo
|
||||
# Ajouté
|
||||
# - Création du script
|
||||
#
|
||||
############################################################
|
||||
|
||||
scriptName=$(basename "$0")
|
||||
updateDate=02.02.2026
|
||||
version=1.0.0
|
||||
|
||||
root_app=wp
|
||||
|
||||
RED='\e[1;31m'
|
||||
GREEN='\e[0;32m'
|
||||
ORANGE='\e[0;33m'
|
||||
YELLOW='\e[1;33m'
|
||||
BLUE='\e[0;34m'
|
||||
PURPLE='\e[1;35m'
|
||||
CYAN='\e[1;36m'
|
||||
NC='\e[0m'
|
||||
|
||||
# Define functions to display usage information
|
||||
version() {
|
||||
cat<<EOF
|
||||
${scriptName} - Version: $version ($updateDate) - Gilles Mouchet (gilles.mouchet@gmail.com)
|
||||
Non-Commercial Use License – See LICENSE for details
|
||||
EOF
|
||||
}
|
||||
|
||||
# Define functions to display usage information
|
||||
usage() {
|
||||
cat << EOF
|
||||
|
||||
Manage docker compose
|
||||
${updateDate} - Version: $version - Gilles Mouchet (gilles.mouchet@geneve.ch)
|
||||
|
||||
Usage: $scriptName <options>
|
||||
|
||||
Options:
|
||||
-a|--all stop docker compose, delete container and delete files in /home/docker/${root_app}
|
||||
-b|--bash Ouverture d'un shell 'root' dans le conteneur 'PHP-FPM'
|
||||
-s|--stop stop docker compose
|
||||
-u|--up start docker compose as daemon
|
||||
-c|--console start docker compose as console
|
||||
-d|--down stop docker compose and delete container
|
||||
-v|--version version
|
||||
-h|--help usage
|
||||
EOF
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------
|
||||
# MAIN
|
||||
#-----------------------------------------------------------
|
||||
# check for wich env the script run
|
||||
environment=$(basename "${0%.*}") # delete extension
|
||||
echo $environment
|
||||
|
||||
case $environment in
|
||||
vdglab)
|
||||
echo "environnement vdglab"
|
||||
cp .env-vdglab .env
|
||||
;;
|
||||
gmolab)
|
||||
echo "environnement vdglab"
|
||||
cp .env-gmolab .env
|
||||
;;
|
||||
*)
|
||||
echo "Add $environment in case section"
|
||||
#usage
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
|
||||
# check param exist
|
||||
if [ -z "$1" ]; then
|
||||
usage
|
||||
exit
|
||||
fi
|
||||
|
||||
while [[ "$#" -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-a|--all)
|
||||
echo -e "${RED}-----------------------------------------------------------------------------------------------------"
|
||||
echo -e "Do you really want to delete the contents of the /home/docker/${root_app} folder [y/N]?"
|
||||
echo -e "----------------------------------------------------------------------------------------------------- ${NC}"
|
||||
|
||||
unset answer
|
||||
read answer
|
||||
if [ "${answer}" != "y" ]; then
|
||||
echo -e "${ORANGE}Operation cancelled!${NC}"
|
||||
exit 1
|
||||
fi
|
||||
docker compose down
|
||||
#sleep 5
|
||||
sudo rm -rf /home/docker/${root_app}/*
|
||||
docker compose up -d
|
||||
exit
|
||||
;;
|
||||
-b|--bash)
|
||||
docker exec --user root -it wp-site /bin/bash
|
||||
;;
|
||||
-s|--stop)
|
||||
docker compose stop
|
||||
;;
|
||||
-u|--up)
|
||||
docker compose up -d
|
||||
;;
|
||||
-d|--down)
|
||||
docker compose down
|
||||
;;
|
||||
-c|--console)
|
||||
docker compose up
|
||||
;;
|
||||
-v|--version)
|
||||
version
|
||||
exit
|
||||
;;
|
||||
*|help|-h|--help)
|
||||
usage
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
100
wp-config.php
100
wp-config.php
@ -1,100 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The base configuration for WordPress
|
||||
*
|
||||
* The wp-config.php creation script uses this file during the
|
||||
* installation. You don't have to use the web site, you can
|
||||
* copy this file to "wp-config.php" and fill in the values.
|
||||
*
|
||||
* This file contains the following configurations:
|
||||
*
|
||||
* * MySQL settings
|
||||
* * Secret keys
|
||||
* * Database table prefix
|
||||
* * ABSPATH
|
||||
*
|
||||
* @link https://codex.wordpress.org/Editing_wp-config.php
|
||||
*
|
||||
* @package WordPress
|
||||
*/
|
||||
|
||||
// ** MySQL settings - You can get this info from your web host ** //
|
||||
/** The name of the database for WordPress */
|
||||
//define( 'DB_NAME', '{{ mysql_wp_db }}' );
|
||||
define( 'DB_NAME', 'wordpress' );
|
||||
|
||||
/** MySQL database username */
|
||||
//define( 'DB_USER', '{{ mysql_wp_user }}' );
|
||||
define( 'DB_USER', 'wpuser' );
|
||||
|
||||
/** MySQL database password */
|
||||
//define( 'DB_USER', '{{ mysql_wp_user }}' );
|
||||
define( 'DB_USER', 'wppassword' );
|
||||
|
||||
/** MySQL hostname */
|
||||
define( 'DB_HOST', 'localhost' );
|
||||
|
||||
/** Database Charset to use in creating database tables. */
|
||||
define( 'DB_CHARSET', 'utf8' );
|
||||
|
||||
/** The Database Collate type. Don't change this if in doubt. */
|
||||
define( 'DB_COLLATE', '' );
|
||||
|
||||
/** Filesystem access **/
|
||||
define('FS_METHOD', 'direct');
|
||||
|
||||
/**#@+
|
||||
* Authentication Unique Keys and Salts.
|
||||
*
|
||||
* Change these to different unique phrases!
|
||||
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
|
||||
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
|
||||
*
|
||||
* @since 2.6.0
|
||||
*/
|
||||
define( 'AUTH_KEY', '{{ lookup('password', '/dev/null chars=ascii_letters length=64') }}' );
|
||||
define( 'SECURE_AUTH_KEY', '{{ lookup('password', '/dev/null chars=ascii_letters length=64') }}' );
|
||||
define( 'LOGGED_IN_KEY', '{{ lookup('password', '/dev/null chars=ascii_letters length=64') }}' );
|
||||
define( 'NONCE_KEY', '{{ lookup('password', '/dev/null chars=ascii_letters length=64') }}' );
|
||||
define( 'AUTH_SALT', '{{ lookup('password', '/dev/null chars=ascii_letters length=64') }}' );
|
||||
define( 'SECURE_AUTH_SALT', '{{ lookup('password', '/dev/null chars=ascii_letters length=64') }}' );
|
||||
define( 'LOGGED_IN_SALT', '{{ lookup('password', '/dev/null chars=ascii_letters length=64') }}' );
|
||||
define( 'NONCE_SALT', '{{ lookup('password', '/dev/null chars=ascii_letters length=64') }}' );
|
||||
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* WordPress Database Table prefix.
|
||||
*
|
||||
* You can have multiple installations in one database if you give each
|
||||
* a unique prefix. Only numbers, letters, and underscores please!
|
||||
*/
|
||||
$table_prefix = 'wp_';
|
||||
|
||||
/**
|
||||
* For developers: WordPress debugging mode.
|
||||
*
|
||||
* Change this to true to enable the display of notices during development.
|
||||
* It is strongly recommended that plugin and theme developers use WP_DEBUG
|
||||
* in their development environments.
|
||||
*
|
||||
* For information on other constants that can be used for debugging,
|
||||
* visit the Codex.
|
||||
*
|
||||
* @link https://codex.wordpress.org/Debugging_in_WordPress
|
||||
*/
|
||||
define( 'WP_DEBUG', false );
|
||||
|
||||
/* That's all, stop editing! Happy publishing. */
|
||||
|
||||
/** Absolute path to the WordPress directory. */
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
define( 'ABSPATH', dirname( __FILE__ ) . '/' );
|
||||
}
|
||||
//** behind apache proxy */
|
||||
//if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
|
||||
// $_SERVER['HTTPS'] = 'on';
|
||||
//}
|
||||
|
||||
/** Sets up WordPress vars and included files. */
|
||||
require_once( ABSPATH . 'wp-settings.php' );
|
||||
Loading…
x
Reference in New Issue
Block a user