diff --git a/.env.dist b/.env.dist index 28080ebb..4ca6a8f8 100644 --- a/.env.dist +++ b/.env.dist @@ -54,10 +54,12 @@ NONCE_SALT=__SECRET__ WP_DEBUG=true WP_DEBUG_DISPLAY=true +# Caching Flags +WP_CACHE=true + # Should always be true in production DISALLOW_FILE_EDIT=true - # Docker compose vars # Linux only diff --git a/.gitignore b/.gitignore index 4629a13e..a58744a3 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,8 @@ /wp-content/vendor /wp-content/db.php /wp-content/object-cache.php +/wp-content/advanced-cache.php +/wp-content/cache /wp-content/mu-plugins/000-boxuk/cache/* !/wp-content/mu-plugins/000-boxuk/cache/.gitkeep diff --git a/composer.json b/composer.json index 4cc393a5..a1761d72 100644 --- a/composer.json +++ b/composer.json @@ -48,7 +48,8 @@ "symfony/yaml": "^5.0", "wpackagist-plugin/advanced-caching": "@dev", "wpackagist-plugin/memcached": "^4.0", - "wpackagist-plugin/query-monitor": "^3.5" + "wpackagist-plugin/query-monitor": "^3.5", + "wpackagist-plugin/surge": "^1.0" }, "require-dev": { "jenko/wp-plugin-trouble-detector": "^0.1.0", diff --git a/composer.lock b/composer.lock index 031d99f8..20b29589 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ab7bd070d9032febde0509ae15d3eac5", + "content-hash": "6a69c2eafaf3d873ff97096af63c6ab2", "packages": [ { "name": "boxuk/dictator", @@ -1509,6 +1509,24 @@ }, "type": "wordpress-plugin", "homepage": "https://wordpress.org/plugins/query-monitor/" + }, + { + "name": "wpackagist-plugin/surge", + "version": "1.0.1", + "source": { + "type": "svn", + "url": "https://plugins.svn.wordpress.org/surge/", + "reference": "trunk" + }, + "dist": { + "type": "zip", + "url": "https://downloads.wordpress.org/plugin/surge.zip?timestamp=1639386086" + }, + "require": { + "composer/installers": "^1.0 || ^2.0" + }, + "type": "wordpress-plugin", + "homepage": "https://wordpress.org/plugins/surge/" } ], "packages-dev": [ diff --git a/docker/app/Dockerfile b/docker/app/Dockerfile index 910240cf..37a72ec5 100644 --- a/docker/app/Dockerfile +++ b/docker/app/Dockerfile @@ -26,12 +26,14 @@ RUN set -eux; \ # Blackfire # https://blackfire.io/docs/integrations/docker/php-docker RUN set -eux; \ - version="$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;")"; \ - curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s "https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$version"; \ - mkdir -p /tmp/blackfire; \ - tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire; \ - mv /tmp/blackfire/blackfire-*.so "$(php -r "echo ini_get('extension_dir');")"/blackfire.so; \ - rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz; + version="$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;")" \ + && architecture="$(uname -m)" \ + && curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s "https://blackfire.io/api/v1/releases/probe/php/linux/$architecture/$version" \ + && mkdir -p /tmp/blackfire \ + && tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \ + && mv /tmp/blackfire/blackfire-*.so "$(php -r "echo ini_get ('extension_dir');")/blackfire.so" \ + && printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8307\n" > "$PHP_INI_DIR/conf.d/blackfire.ini" \ + && rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz; # Set groups and user when on linux RUN set -eux; \ diff --git a/docker/app/Dockerfile_xdebug b/docker/app/Dockerfile_xdebug index b6a649e0..6d66a51f 100644 --- a/docker/app/Dockerfile_xdebug +++ b/docker/app/Dockerfile_xdebug @@ -27,12 +27,14 @@ RUN set -eux; \ # Blackfire # https://blackfire.io/docs/integrations/docker/php-docker RUN set -eux; \ - version="$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;")"; \ - curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s "https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$version"; \ - mkdir -p /tmp/blackfire; \ - tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire; \ - mv /tmp/blackfire/blackfire-*.so "$(php -r "echo ini_get('extension_dir');")"/blackfire.so; \ - rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz; + version="$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;")" \ + && architecture="$(uname -m)" \ + && curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s "https://blackfire.io/api/v1/releases/probe/php/linux/$architecture/$version" \ + && mkdir -p /tmp/blackfire \ + && tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \ + && mv /tmp/blackfire/blackfire-*.so "$(php -r "echo ini_get ('extension_dir');")/blackfire.so" \ + && printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8307\n" > "$PHP_INI_DIR/conf.d/blackfire.ini" \ + && rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz; # Set groups and user when on linux RUN set -eux; \ diff --git a/docs/dev/vip.md b/docs/dev/vip.md index 7410a07e..6e5edd88 100644 --- a/docs/dev/vip.md +++ b/docs/dev/vip.md @@ -68,6 +68,14 @@ add_filter('timber/cache/mode', function() { add_filter( 'timber/allow_fs_write', '__return_false' ); ``` +## Remove surge plugin and related files/folders + +Surge won't work on VIP environments as it needs the ability to write to the file system. [VIP has its own page caching anyhow](https://docs.wpvip.com/technical-references/caching/page-cache/). + +`composer remove wpackagist-plugin/surge` + +> Remember to remove any related files or folders too, such as `wp-content/advanced-cache.php` and the `wp-content/cache` directory. + ## Ordering of initialisation files VIP uses a [000-vip-init.php](https://github.com/Automattic/vip-go-mu-plugins/blob/master/000-vip-init.php) file to initialise diff --git a/site-state.yml b/site-state.yml index ae30891e..28643a14 100644 --- a/site-state.yml +++ b/site-state.yml @@ -16,6 +16,7 @@ settings: active_plugins: - advanced-caching/advanced-caching.php - query-monitor/query-monitor.php + - surge/surge.php users: admin: display_name: admin diff --git a/wp-config.php b/wp-config.php index 256ff87f..9f722a28 100644 --- a/wp-config.php +++ b/wp-config.php @@ -110,6 +110,9 @@ define( 'DISALLOW_FILE_EDIT', ! empty( $_ENV['DISALLOW_FILE_EDIT'] ) ? filter_var( $_ENV['DISALLOW_FILE_EDIT'], FILTER_VALIDATE_BOOLEAN ) : true ); +// Enable cache by default. +define( 'WP_CACHE', isset( $_ENV['WP_CACHE'] ) ? filter_var( $_ENV['WP_CACHE'], FILTER_VALIDATE_BOOLEAN ) : true ); + /** * Memcached servers */