allora il mio intento è quello di avere una docker image/docker file e dopo un docker compose che contenga
Wordpress ultima versione (6 o superiore) php 8.2 Maria db ultima versione 11.4 (stabile) PhpMyAdmin ultima versione openlitespeed ultima versione relay ultima versione redis ultima versione(volendo redis possiamo agganciarla a wordpress senza includerla nella docker compose grazie al plugin di lightspeed stesso)
cè l'immagine di openlightspeed litespeedtech/openlitespeed:1.8.2-lsphp82 del solo server Component Version Linux Ubuntu 24.04 OpenLiteSpeed Latest stable version PHP Latest stable version
che andrebbe combinata poi con mariadb e wordpress
relay per installarlo via docker dalla doc ufficiale dice
Using Docker We have various Docker examples on GitHub. If you’re using the official PHP Docker images you can install Relay using the php-extension-installer:
FROM php:8.1-cli(ovviamente cambiando la versione di php) COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ RUN install-php-extensions relay
relay per open litespeed suggerisce COME ESEMPIO questo
FROM litespeedtech/openlitespeed:1.7.16-lsphp81(ovviamente cambiando la versione di php e openlitespeed)
ENV PHP_EXT_DIR=/usr/local/lsws/lsphp81/lib/php/20210902 (va usato php8.2) ENV PHP_INI_DIR=/usr/local/lsws/lsphp81/etc/php/8.1/mods-available/ (va usato php8.2)
ARG RELAY=v0.8.1
RUN PLATFORM=$(uname -m | sed 's/_/-/')
&& curl -L "https://builds.r2.relay.so/$RELAY/relay-$RELAY-php8.1-debian-$PLATFORM%2Blibssl3.tar.gz" | tar xz -C /tmp ( va usato il file relay-v0.8.1-php8.2-debian-aarch64+libssl3.tar.gz)
RUN PLATFORM=$(uname -m | sed 's/_/-/')
&& cp "/tmp/relay-$RELAY-php8.1-debian-$PLATFORM+libssl3/relay.ini" "$PHP_INI_DIR/60-relay.ini" \ (va cambiato il nome della directory in base alla versione del file di relay)
&& cp "/tmp/relay-$RELAY-php8.1-debian-$PLATFORM+libssl3/relay-pkg.so" "$PHP_EXT_DIR/relay.so" (va cambiato il nome della directory in base alla versione del file di relay)
RUN sed -i "s/00000000-0000-0000-0000-000000000000/$(cat /proc/sys/kernel/random/uuid)/" "$PHP_EXT_DIR/relay.so"
ENTRYPOINT [""]
poi ci deve essere un file php ini ottimizzato per wordpress con molti plugin e builder visuali come elementor e simili (non so se questo va nella docker compose) il php ini deve essere ottimizzato per openlitespeed e con tutti i moduli necessari per cache e simili
inoltre in futuro potrei voler aggiungere lightspeed enterprise litespeedtech/litespeed:6.3.1-lsphp82 e quindi dovro sostituire openlitespeed con lightspeed enterprise nella docker compose in quel caso anche relay andrebbe installato cosi come nell'esempio
docker build --pull --tag relay-litespeed --file litespeed.Dockerfile . docker run -it relay-litespeed bash $ php --ri relay
unesempio di compose quasi completo comprendente tutto fatto da lightspeed qui ci sono altre info e dati https://github.com/litespeedtech/ols-docker-env?tab=readme-ov-file
services:
mysql:
image: mariadb:11.4
logging:
driver: none
command: ["--max-allowed-packet=512M"]
volumes: - "./data/db:/var/lib/mysql:delegated"
environment:
MYSQL_ROOT_PASSWORD:
├── acme
├── bin │ └── container ├── data │ └── db ├── logs │ ├── access.log │ ├── error.log │ ├── lsrestart.log │ └── stderr.log ├── lsws │ ├── admin-conf │ └── conf ├── sites │ └── localhost ├── LICENSE ├── README.md └── docker-compose.yml acme contains all applied certificates from Lets Encrypt
bin contains multiple CLI scripts to allow you add or delete virtual hosts, install applications, upgrade, etc
data stores the MySQL database
logs contains all of the web server logs and virtual host access logs
lsws contains all web server configuration files
sites contains the document roots (the WordPress application will install here)
FINE ESEMPIO COMPOSE
ESEMPIO SCRIPT BASH PER INSTALLARE WORDPRESS E DATABASE E DOMINIO
domain.sh #!/usr/bin/env bash CONT_NAME='litespeed' EPACE=' '
echow(){ FLAG=${1} shift echo -e "\033[1m${EPACE}${FLAG}\033[0m${@}" }
help_message(){
echo -e "\033[1mOPTIONS\033[0m"
echow "-A, --add [domain_name]"
echo "${EPACE}${EPACE}Example: domain.sh -A example.com, will add the domain to Listener and auto create a new virtual host."
echow "-D, --del [domain_name]"
echo "${EPACE}${EPACE}Example: domain.sh -D example.com, will delete the domain from Listener."
echow '-H, --help'
echo "${EPACE}${EPACE}Display help and exit."
}
check_input(){ if [ -z "${1}" ]; then help_message exit 1 fi }
add_domain(){
check_input
del_domain(){
check_input
check_input
*)
help_message
;;
esac
shift
done
database.sh #!/usr/bin/env bash source .env
DOMAIN='' SQL_DB='' SQL_USER='' SQL_PASS='' ANY="'%'" SET_OK=0 EPACE=' ' METHOD=0
echow(){ FLAG=${1} shift echo -e "\033[1m${EPACE}${FLAG}\033[0m${@}" }
help_message(){
echo -e "\033[1mOPTIONS\033[0m"
echow '-D, --domain [DOMAIN_NAME]'
echo "${EPACE}${EPACE}Example: database.sh -D example.com"
echo "${EPACE}${EPACE}Will auto-generate Database/username/password for the domain"
echow '-D, --domain [DOMAIN_NAME] -U, --user [xxx] -P, --password [xxx] -DB, --database [xxx]'
echo "${EPACE}${EPACE}Example: database.sh -D example.com -U USERNAME -P PASSWORD -DB DATABASENAME"
echo "${EPACE}${EPACE}Will create Database/username/password by given"
echow '-R, --delete -DB, --database [xxx] -U, --user [xxx]'
echo "${EPACE}${EPACE}Example: database.sh -r -DB DATABASENAME -U USERNAME"
echo "${EPACE}${EPACE}Will delete the database (require) and username (optional) by given"
echow '-H, --help'
echo "${EPACE}${EPACE}Display help and exit."
exit 0
}
check_input(){ if [ -z "${1}" ]; then help_message exit 1 fi }
specify_name(){
check_input
auto_name(){ SQL_DB="${TRANSNAME}" SQL_USER="${TRANSNAME}" SQL_PASS="'${RANDOM_PASS}'" }
gen_pass(){ RANDOM_PASS="$(openssl rand -base64 12)" }
trans_name(){ TRANSNAME=$(echo ${1} | tr -d '.&&-') }
display_credential(){
if [
}
store_credential(){
if [ -d "./sites/${1}" ]; then
if [ -f ./sites/${1}/.db_pass ]; then
mv ./sites/${1}/.db_pass ./sites/${1}/.db_pass.bk
fi
cat > "./sites/${1}/.db_pass" << EOT
"Database":"${SQL_DB}"
"Username":"${SQL_USER}"
"Password":"$(echo
}
check_db_access(){
docker compose exec -T mysql su -c "mysql -uroot -p${MYSQL_ROOT_PASSWORD} -e 'status'" >/dev/null 2>&1
if [ ${?} != 0 ]; then
echo '[X] DB access failed, please check!'
exit 1
fi
}
check_db_exist(){
docker compose exec -T mysql su -c "test -e /var/lib/mysql/${1}"
if [
fi
}
check_db_not_exist(){
docker compose exec -T mysql su -c "test -e /var/lib/mysql/${1}"
if [
db_setup(){
docker compose exec -T mysql su -c 'mysql -uroot -p${MYSQL_ROOT_PASSWORD}
-e "CREATE DATABASE '${SQL_DB}';"
-e "GRANT ALL PRIVILEGES ON '${SQL_DB}'.* TO '${SQL_USER}'@'${ANY}' IDENTIFIED BY '${SQL_PASS}';"
-e "FLUSH PRIVILEGES;"'
SET_OK=${?}
}
db_delete(){
if [ "${SQL_DB}" == '' ]; then
echo "Database parameter is required!"
exit 0
fi
if [ "${SQL_USER}" == '' ]; then
SQL_USER="${SQL_DB}"
fi
check_db_not_exist
-e "DROP DATABASE IF EXISTS '${SQL_DB}';"
-e "DROP USER IF EXISTS '${SQL_USER}'@'${ANY}';"
-e "FLUSH PRIVILEGES;"'
echo "Database ${SQL_DB} and User ${SQL_USER} are deleted!"
}
auto_setup_main(){
check_input
specify_setup_main(){
specify_name
check_db_exist
main(){
if [
check_input
-db | -DB | -database| --database) shift
SQL_DB="${1}"
;; -[rR] | -del | --del | --delete)
METHOD=1
;;
*)
help_message
;;
esac
shift
done
main
appinstall.sh
#!/usr/bin/env bash APP_NAME='' DOMAIN='' EPACE=' '
echow(){ FLAG=${1} shift echo -e "\033[1m${EPACE}${FLAG}\033[0m${@}" }
help_message(){ echo -e "\033[1mOPTIONS\033[0m" echow '-A, --app [app_name] -D, --domain [DOMAIN_NAME]' echo "${EPACE}${EPACE}Example: appinstall.sh -A wordpress -D example.com" echo "${EPACE}${EPACE}Will install WordPress CMS under the example.com domain" echow '-H, --help' echo "${EPACE}${EPACE}Display help and exit." exit 0 }
check_input(){ if [ -z "${1}" ]; then help_message exit 1 fi }
app_download(){ docker compose exec litespeed su -c "appinstallctl.sh --app ${1} --domain ${2}" bash bin/webadmin.sh -r exit 0 }
main(){ app_download ${APP_NAME} ${DOMAIN} }
check_input
*)
help_message
;;
esac
shift
done
main
FINE ESEMPIO SCRIPT BASH
CONSIDERAZIONI: questo compose di lightspeed che utilizza poi dei bash per installare database e wordpress andrebbe anche bene se non che mi rallenterebbe l'installazione di wordpress e database e salvo rari casi non lo utilizzerei mai per piu wordpress insieme e inoltre mancherebbe relay
Tieni conto che QUESTO E SOLO UN ESEMPIO, inoltre io installerò tutto tramite coolify 4 quindi questo esempio di lightspeed prevede che wordpress venga installato tramite script bash e che quindi questa stessa compose di lightspeed serve come contenitorte per piu database o wordpress, invece a me serve che wordpress sia incluso nella docker compose perche intendo installare un singolo wordpress e un singolo database per ogni dominio inoltre coolify gia include traefik e caddy per gestire il dominio e il certificato ssl
E come detto redis sarà agganciato a wordpress tramite plugin e non sarà incluso nella docker compose
come possiamo sistemare il tutto? anche perche non so come gestire poi i domini e i certificati ssl visto che coolify 4 li gestisce tramite traefik e caddy a monte