Skip to content

Commit

Permalink
fix mu-plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
batonac committed Sep 18, 2024
1 parent cdd937f commit 7d7f805
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 66 deletions.
6 changes: 3 additions & 3 deletions conf/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
timeouts {
read_body 10s
read_header 10s
write 30s
idle 60s
write 100s
idle 100s
}
keepalive_interval 2m
keepalive_interval 100s
max_header_size 16KB
trusted_proxies static private_ranges
client_ip_headers X-Forwarded-For
Expand Down
2 changes: 1 addition & 1 deletion conf/php.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; Memory limits
memory_limit = 512M
max_execution_time = 300
max_input_time = 120
max_input_time = 100

; Opcache settings
opcache.enable = 1
Expand Down
8 changes: 1 addition & 7 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,7 @@ install_wordpress() {

# Import database if WORDPRESS_DB_URL is set
if [ -n "${WORDPRESS_DB_URL:-}" ]; then
if command -v wp >/dev/null 2>&1; then
import_db_wp_cli
elif command -v mysql >/dev/null 2>&1; then
import_db_mysql
else
echo "Error: Neither wp-cli nor mysql cli are available. Cannot import database."
fi
import_db_wp_cli
fi
}

Expand Down
45 changes: 11 additions & 34 deletions scripts/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,35 @@
version: '3.8'
x-common-env: &common-env
WORDPRESS_HOME: http://localhost:8080
WORDPRESS_SITE_URL: http://localhost:8080
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpresspassword
WORDPRESS_DB_NAME: wordpress

services:
wordpress:
# image: ghcr.io/avunu/wordpress:latest-php83
image: wordpress-php83:latest
ports:
- "8080:80"
- "9003:9003"
volumes:
- ./wordpress:/var/www/html
environment:
- WORDPRESS_HOME=http://localhost:8080
- WORDPRESS_SITE_URL=http://localhost:8080
- WORDPRESS_DB_HOST=db
- WORDPRESS_DB_USER=wordpress
- WORDPRESS_DB_PASSWORD=wordpresspassword
- WORDPRESS_DB_NAME=wordpress
- WORDPRESS_AUTH_KEY=${WORDPRESS_AUTH_KEY}
- WORDPRESS_SECURE_AUTH_KEY=${WORDPRESS_SECURE_AUTH_KEY}
- WORDPRESS_LOGGED_IN_KEY=${WORDPRESS_LOGGED_IN_KEY}
- WORDPRESS_NONCE_KEY=${WORDPRESS_NONCE_KEY}
- WORDPRESS_AUTH_SALT=${WORDPRESS_AUTH_SALT}
- WORDPRESS_SECURE_AUTH_SALT=${WORDPRESS_SECURE_AUTH_SALT}
- WORDPRESS_LOGGED_IN_SALT=${WORDPRESS_LOGGED_IN_SALT}
- WORDPRESS_NONCE_SALT=${WORDPRESS_NONCE_SALT}
<<: *common-env
depends_on:
- db

worker:
# image: ghcr.io/avunu/wordpress:latest-php83
image: wordpress-php83:latest
volumes:
- ./wordpress:/var/www/html
environment:
- WORDPRESS_HOME=http://localhost:8080
- WORDPRESS_SITE_URL=http://localhost:8080
- WORDPRESS_DB_HOST=db
- WORDPRESS_DB_USER=wordpress
- WORDPRESS_DB_PASSWORD=wordpresspassword
- WORDPRESS_DB_NAME=wordpress
- WORDPRESS_AUTH_KEY=${WORDPRESS_AUTH_KEY}
- WORDPRESS_SECURE_AUTH_KEY=${WORDPRESS_SECURE_AUTH_KEY}
- WORDPRESS_LOGGED_IN_KEY=${WORDPRESS_LOGGED_IN_KEY}
- WORDPRESS_NONCE_KEY=${WORDPRESS_NONCE_KEY}
- WORDPRESS_AUTH_SALT=${WORDPRESS_AUTH_SALT}
- WORDPRESS_SECURE_AUTH_SALT=${WORDPRESS_SECURE_AUTH_SALT}
- WORDPRESS_LOGGED_IN_SALT=${WORDPRESS_LOGGED_IN_SALT}
- WORDPRESS_NONCE_SALT=${WORDPRESS_NONCE_SALT}
- PROC_TYPE=worker
<<: *common-env
PROC_TYPE: worker
depends_on:
- db

db:
image: mysql:8.0
image: mysql:latest
volumes:
- db_data:/var/lib/mysql
restart: always
Expand Down
26 changes: 6 additions & 20 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
#!/bin/sh

# test for the presence of the openssl command, install via nix-shell if not found
if ! command -v openssl &> /dev/null
then
nix-shell -p openssl --command "bash test.sh"
else
# build the latest image
nix build
docker load < result
# Generate random keys and salts
export WORDPRESS_AUTH_KEY=$(openssl rand -base64 32)
export WORDPRESS_SECURE_AUTH_KEY=$(openssl rand -base64 32)
export WORDPRESS_LOGGED_IN_KEY=$(openssl rand -base64 32)
export WORDPRESS_NONCE_KEY=$(openssl rand -base64 32)
export WORDPRESS_AUTH_SALT=$(openssl rand -base64 32)
export WORDPRESS_SECURE_AUTH_SALT=$(openssl rand -base64 32)
export WORDPRESS_LOGGED_IN_SALT=$(openssl rand -base64 32)
export WORDPRESS_NONCE_SALT=$(openssl rand -base64 32)
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # Get the directory of the script

# Run docker-compose
docker-compose up
fi
nix build
docker load < result

# Run docker-compose
cd "$SCRIPT_DIR" && docker-compose up
2 changes: 1 addition & 1 deletion wordpress.nix
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ pkgs.dockerTools.buildLayeredImage {
# copy must-use plugins
mkdir mu-plugins
cp -r ${./mu-plugins/.} mu-plugins/
cp -r ${./mu-plugins}/. mu-plugins/
# Symlink CA certificates
ln -s ${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt etc/ssl/certs/ca-certificates.crt
Expand Down

0 comments on commit 7d7f805

Please sign in to comment.