This commit is contained in:
2026-02-12 17:09:40 +01:00
parent 232159984c
commit 58856844ce
4 changed files with 82 additions and 10 deletions

View File

@@ -4,11 +4,22 @@
# Einrichten
```
echo "MYSQL_ROOT_PASSWORD=$( openssl rand -hex 16 )" > .env
MYSQL_DATABASE=wordpress >> .env
MYSQL_USER=wordpress >> .env
echo "MYSQL_DATABASE=wordpress" >> .env
echo "MYSQL_USER=wordpress" >> .env
echo "MYSQL_PASSWORD=$( openssl rand -hex 16 )" >> .env
echo "WP_PORT=8080" >> .env
echo "STATIC_PORT=8081" >> .env
```
## Redis Object Cache
After first `docker compose up`, install the **Redis Object Cache** plugin in WP Admin:
1. Plugins → Add New → search "Redis Object Cache" (by Till Krüss)
2. Install & Activate
3. Settings → Redis → "Enable Object Cache"
The `wp-config.php` already has the `WP_REDIS_HOST` and `WP_REDIS_PORT` constants set.
## Cron
Backup script in Cron einbinden nicht vergessen

View File

@@ -11,24 +11,75 @@ services:
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
networks:
- backend
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
redis:
image: redis:7-alpine
restart: unless-stopped
command: redis-server --maxmemory 128mb --maxmemory-policy allkeys-lru
volumes:
- redis_data:/data
networks:
- backend
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 5s
retries: 3
wordpress:
image: wordpress:latest
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- ./wp:/var/www/html
- ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
- ./opcache.ini:/usr/local/etc/php/conf.d/opcache.ini
- ./static:/export
ports:
- 8080:80
- ${WP_PORT:-8080}:80
restart: unless-stopped
environment:
- WORDPRESS_DB_HOST=db
- WORDPRESS_DB_USER=${MYSQL_USER}
- WORDPRESS_DB_PASSWORD=${MYSQL_PASSWORD}
- WORDPRESS_DB_NAME=${MYSQL_DATABASE}
- WORDPRESS_CONFIG_EXTRA=
define('WP_REDIS_HOST', 'redis');
define('WP_REDIS_PORT', 6379);
define('WP_REDIS_TIMEOUT', 1);
define('WP_REDIS_READ_TIMEOUT', 1);
define('DISALLOW_FILE_EDIT', true);
define('WP_AUTO_UPDATE_CORE', 'minor');
define('AUTOMATIC_UPDATER_DISABLED', false);
networks:
- frontend
- backend
static:
image: caddy:latest
restart: unless-stopped
volumes:
- ./static:/usr/share/caddy
ports:
- 8081:80
image: caddy:latest
restart: unless-stopped
volumes:
- ./static:/usr/share/caddy
ports:
- ${STATIC_PORT:-8081}:80
networks:
- frontend
networks:
frontend:
backend:
internal: true
volumes:
redis_data:

View File

@@ -1,4 +1,6 @@
MYSQL_ROOT_PASSWORD=$( openssl rand -hex 16 )
MYSQL_DATABASE=wordpress
MYSQL_USER=wordpress
MYSQL_PASSWORD=$( openssl rand -hex 16 )
MYSQL_PASSWORD=$( openssl rand -hex 16 )
WP_PORT=8080
STATIC_PORT=8081

8
opcache.ini Normal file
View File

@@ -0,0 +1,8 @@
; OPcache caches compiled PHP for major speed gains
opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=10000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=0