From 366b8e88369cb8748ac8770a1e0a84dfd6fee9e7 Mon Sep 17 00:00:00 2001 From: Jose Miguel Lopez Coronado Date: Thu, 12 Nov 2020 15:57:12 +0100 Subject: [PATCH] Added basic_redis files --- basic_redis/.env_default | 7 +++++++ basic_redis/README.md | 21 +++++++++++++++++++ basic_redis/docker-compose.yml | 37 ++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 basic_redis/.env_default create mode 100644 basic_redis/README.md create mode 100644 basic_redis/docker-compose.yml diff --git a/basic_redis/.env_default b/basic_redis/.env_default new file mode 100644 index 0000000..a3c1c98 --- /dev/null +++ b/basic_redis/.env_default @@ -0,0 +1,7 @@ +CONTAINER_NAME=TheNameOfYourContainer +MYSQL_ROOT_PASSWORD=YourMySQLRootPasswordHere +MYSQL_USER=wpuser +MYSQL_PASSWORD=The_wpuser_password_here +MYSQL_WP_DATABASE=wordpressdb +EX_PORT=8000 + diff --git a/basic_redis/README.md b/basic_redis/README.md new file mode 100644 index 0000000..e9ffc6f --- /dev/null +++ b/basic_redis/README.md @@ -0,0 +1,21 @@ +INSTRUCTIONS + +1. Copy (and edit) .env_default to .env +2. Run docker-compose +3. Access the system in http://hostname:$EX_PORT +4. Follow the system instructions to install WP +5. Have fun! + +.env VARIABLES + +The variables in the .env file are the common ones shown in the parent directory README.md + +REDIS CONFIGURATION IN WORDPRESS + +Install the Redis Object Cache plugin in WordPress and Activate it +Then, in Settings -> Redis click Enable Object Cache +For the plugin to function you must add the following in your wp-config.php file: +define('WP_REDIS_HOST', 'redis'); +define('WP_CACHE_KEY_SALT', 'wp-docker-5DknvYepdjyJMo8gDqrLhrpAJUQ'); + +The WP_CACHE_KEY_SALT must be unique, so do your best in adapting it. diff --git a/basic_redis/docker-compose.yml b/basic_redis/docker-compose.yml new file mode 100644 index 0000000..81ebe70 --- /dev/null +++ b/basic_redis/docker-compose.yml @@ -0,0 +1,37 @@ +version: '3' + +services: + db: + image: mysql:8.0 + container_name: "${CONTAINER_NAME}_db" + restart: unless-stopped + env_file: .env + environment: + - MYSQL_DATABASE=$MYSQL_WP_DATABASE + volumes: + - ./dbdata:/var/lib/mysql + command: '--default-authentication-plugin=mysql_native_password' + + redis: + image: redis + container_name: "${CONTAINER_NAME}_redis" + restart: unless-stopped + + wordpress: + depends_on: + - db + - redis + image: wordpress + container_name: "${CONTAINER_NAME}_wp" + restart: unless-stopped + env_file: .env + ports: + - $EX_PORT:80 + environment: + - WORDPRESS_DB_HOST=db:3306 + - WORDPRESS_DB_USER=$MYSQL_USER + - WORDPRESS_DB_PASSWORD=$MYSQL_PASSWORD + - WORDPRESS_DB_NAME=$MYSQL_WP_DATABASE + volumes: + - ./wordpress:/var/www/html + - ./php/user.ini:/usr/local/etc/php/conf.d/user.ini