Added basic_redis files

This commit is contained in:
Jose Miguel López Coronado 2020-11-12 15:57:12 +01:00
parent 49665f1e70
commit 366b8e8836
3 changed files with 65 additions and 0 deletions

7
basic_redis/.env_default Normal file
View File

@ -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

21
basic_redis/README.md Normal file
View File

@ -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.

View File

@ -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