Skip to content

Commit

Permalink
Merge pull request #121 from boxuk/surge
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Jenkins authored Dec 21, 2021
2 parents 07cc9ab + 8a5a9e0 commit bae602d
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 15 deletions.
4 changes: 3 additions & 1 deletion .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
20 changes: 19 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions docker/app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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; \
Expand Down
14 changes: 8 additions & 6 deletions docker/app/Dockerfile_xdebug
Original file line number Diff line number Diff line change
Expand Up @@ -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; \
Expand Down
8 changes: 8 additions & 0 deletions docs/dev/vip.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions site-state.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions wp-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit bae602d

Please sign in to comment.