commit b9e3ee8e528e8544e6e30d5aeec9e00a4ce2a8fe Author: leo <426742@gmail.com> Date: Mon Aug 12 15:27:01 2024 +0500 create diff --git a/README.md b/README.md new file mode 100644 index 0000000..d54f799 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +### blog-wp-install +*docker configuration* + + +Start: `sudo bash install.sh` \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7e484b9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,30 @@ +services: + wp-cli: + container_name: wp-cli + image: wordpress:cli-2.11.0-php8.1 + networks: + - proxynet + env_file: + - /data/secrets/${SERVER_DOMAIN}/${SERVER_DOMAIN}.env + environment: + WORDPRESS_DB_HOST: mariadb + WORDPRESS_DB_USER: ${MARIADB_USER} + WORDPRESS_DB_NAME: ${MARIADB_DB} + WP_CLI_CACHE_DIR: /tmp/.wp-cli/cache + user: '33' + command: > + sh -c 'wp core install \ + --path="/var/www/html" \ + --url="https://${SERVER_DOMAIN}" \ + --title="Rozen Project" \ + --admin_user=Leo \ + --admin_password=${WP_ADMIN_PASSWORD} \ + --admin_email=${ADMIN_EMAIL} && + wp language core install ru_RU && + wp site switch-language ru_RU && + wp theme install sparkling --activate' + volumes: + - /data/appdata/wordpress:/var/www/html +networks: + proxynet: + external: true \ No newline at end of file diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..a873b93 --- /dev/null +++ b/install.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +if [ "$(id -u)" != "0" ]; then + echo -e "\033[31mThis script requires superuser rights.\033[0m" + exit 0 +fi + +SECRETS_PATH=/data/secrets/$SERVER_DOMAIN/$SERVER_DOMAIN.env + +trap 'echo -e "\033[31minstall.sh: Something went wrong\033[0m"; exit 1' ERR +set -e + +export DEBIAN_FRONTEND=noninteractive + +source $SECRETS_PATH + +sudo docker compose --env-file $SECRETS_PATH up + +trap - ERR +echo "Install wp complete" \ No newline at end of file