| 1234567891011121314151617181920212223242526272829303132333435363738 |
- #! /bin/bash
- #
-
- set -o allexport;
- source .env;
- set +o allexport
-
- echo "Setting up docker volume and network...";
- docker volume create $PREFIX-web;
- docker volume create $PREFIX-db;
- docker network create $PREFIX;
- docker network connect $PREFIX traefik;
-
- docker-compose up -d web;
- while ! docker ps -q -f name=$PREFIX-web; do
- echo "Waiting for the web container to be up and running...";
- sleep 1;
- done
-
- docker-compose up -d db;
- 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 wptest-web /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...";
- sleep 1;
- done
-
- echo "Installing WordPress"
- docker exec --user www-data $PREFIX-web /bin/sh -c "wp core download --version=$WP_VERSION --locale=$WP_LOCALE --path=/var/www/html";
- docker exec --user www-data $PREFIX-web /bin/sh -c 'wp config create --skip-check --dbname='"$PREFIX"' --dbuser='"$DB_USER"' --dbpass='"$DB_USER_PASSWORD"' --dbhost='"$PREFIX-db"' --path=/var/www/html --force --extra-php <<PHP
- if (isset(\$_SERVER["HTTP_X_FORWARDED_PROTO"]) && \$_SERVER["HTTP_X_FORWARDED_PROTO"] == "https") \$_SERVER["HTTPS"]="on";
- PHP
- '
- docker exec --user www-data $PREFIX-web /bin/sh -c "wp core install --path=/var/www/html --url=https://www.$PREFIX.localhost --title=$PREFIX --admin_user=admin --admin_password=admin --admin_email=no@mail.com --skip-email";
- docker exec --user www-data $PREFIX-web /bin/sh -c 'wp theme install twentyseventeen --activate --path=/var/www/html';
|