Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add redis to docker-compose #4

Closed
DjordjeVucinac82 opened this issue Jan 20, 2022 · 5 comments
Closed

Add redis to docker-compose #4

DjordjeVucinac82 opened this issue Jan 20, 2022 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@DjordjeVucinac82
Copy link
Owner

Find which case is best to add redux to docker-compose, check version compatibility with other images

@DjordjeVucinac82 DjordjeVucinac82 self-assigned this Jan 20, 2022
@DjordjeVucinac82 DjordjeVucinac82 added the enhancement New feature or request label Jan 20, 2022
@DjordjeVucinac82
Copy link
Owner Author

redis:
restart: always
image: redis:latest
volumes:
- ./sites/wp1/redis:/data

@DjordjeVucinac82
Copy link
Owner Author

wp-fpm:
tty: true
stdin_open: true
image: emcniece/wordpress:latest
volumes:
- wproot:/var/www/html
environment:
WORDPRESS_DB_HOST: mysql
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
WPFPM_WP_REDIS_HOST: redis
WPFPM_RT_WP_NGINX_HELPER_CACHE_PATH: "/tmp/cache"
#WP_PLUGINS: "nginx-helper redis-cache"
#ENABLE_HYPERDB: "true"
#ENABLE_CRON: "true"
#CRON_CMD: "*/1 * * * * /usr/bin/curl -silent -A 'Mozilla' 'https://google.com' > /dev/null 2>&1"

mysql:
image: mariadb
command: mysqld --innodb-buffer-pool-size=20M
environment:
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
MYSQL_USER: wordpress
MYSQL_DATABASE: wordpress
MYSQL_PASSWORD: wordpress

redis:
image: redis:3-alpine

@DjordjeVucinac82
Copy link
Owner Author

redis:
image: redis:6
restart: always
logging:
options:
max-size: "10m"
max-file: "3"
ports:
- "6379:6379"
networks:
- backend
# launch Redis in cache mode with :
# - max memory up to 50% of your RAM if needed (--maxmemory 512mb)
# - deleting oldest data when max memory is reached (--maxmemory-policy allkeys-lru)
entrypoint: redis-server --maxmemory 512mb -maxmemory-policy allkeys-lru

@DjordjeVucinac82
Copy link
Owner Author

define( 'WP_REDIS_HOST', 'redis-cluster' );
define( 'WP_CACHE', true );
// define( 'WP_REDIS_CLIENT', 'pecl' );
define( 'WP_REDIS_PASSWORD', 'SOMEPASSWORD' );
define( 'WP_REDIS_DATABASE', '0' );
define( 'WP_CACHE_KEY_SALT', 'SOMESALTHERE' );
define( 'WP_REDIS_SELECTIVE_FLUSH', true );
define( 'WP_REDIS_DISABLE_BANNERS', true );

@DjordjeVucinac82
Copy link
Owner Author

Add the following in the db-config.php file in the ini directory of the w3-total-cache plugin directory

//
// redis config cache
//
define( 'W3TC_CONFIG_CACHE_ENGINE', 'redis');
define( 'W3TC_CONFIG_CACHE_REDIS_SERVERS', 'redis_hostname::6379' );

// optional redis settings
define( 'W3TC_CONFIG_CACHE_REDIS_PERSISTENT', true );
define( 'W3TC_CONFIG_CACHE_REDIS_DBID', 0 );
define( 'W3TC_CONFIG_CACHE_REDIS_PASSWORD', '' );

Enable the following in the Performance menu in the WP Admin

General > Page Cache > Redis -- This provides the most bang for the buck
General > Database Cache > Redis
General > Object Cache > Redis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant