diff --git a/conf/Caddyfile b/conf/Caddyfile index 2168c9d..40d6ecf 100644 --- a/conf/Caddyfile +++ b/conf/Caddyfile @@ -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 diff --git a/conf/php.ini b/conf/php.ini index 0c0c573..a0e3d0c 100644 --- a/conf/php.ini +++ b/conf/php.ini @@ -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 diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 00c449d..149c5a5 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -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 } diff --git a/scripts/docker-compose.yml b/scripts/docker-compose.yml index d8cbb9b..60f8ddf 100644 --- a/scripts/docker-compose.yml +++ b/scripts/docker-compose.yml @@ -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 diff --git a/scripts/test.sh b/scripts/test.sh index 6d706e5..e9cdd08 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -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 \ No newline at end of file diff --git a/wordpress.nix b/wordpress.nix index e876ca3..9548e8a 100644 --- a/wordpress.nix +++ b/wordpress.nix @@ -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