From 793982e5c0bc8e57e5c2e3c1ad6fb76c06292d23 Mon Sep 17 00:00:00 2001 From: Joe Hoyle Date: Wed, 25 Oct 2023 16:04:21 +0200 Subject: [PATCH 1/3] Add Afterburner support to Local Server --- docker/afterburner.ini | 4 ++++ docs/using-afterburner.md | 19 +++++++++++++++++++ .../class-docker-compose-generator.php | 11 ++++++++--- 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 docker/afterburner.ini create mode 100644 docs/using-afterburner.md diff --git a/docker/afterburner.ini b/docker/afterburner.ini new file mode 100644 index 00000000..98dca708 --- /dev/null +++ b/docker/afterburner.ini @@ -0,0 +1,4 @@ +extension=afterburner.so + +afterburner.redis_server_info=redis://redis:6379 +afterburner.lru_cache_max_items=1000 diff --git a/docs/using-afterburner.md b/docs/using-afterburner.md new file mode 100644 index 00000000..165b26dc --- /dev/null +++ b/docs/using-afterburner.md @@ -0,0 +1,19 @@ +# Using Afterburner + +If your project uses Afterburner in Altis Cloud, you can enabled it in Altis Local Service by setting the `altis.modules.local-server.afterburner` value to `true`: + +```json +{ + "extra": { + "altis": { + "modules": { + "local-server": { + "afterburner": true + } + } + } + } +} +``` + +Afterburner is only enabled on PHP versions later than 7.4. diff --git a/inc/composer/class-docker-compose-generator.php b/inc/composer/class-docker-compose-generator.php index 3452fcbc..b8e802fc 100644 --- a/inc/composer/class-docker-compose-generator.php +++ b/inc/composer/class-docker-compose-generator.php @@ -98,9 +98,9 @@ public function __construct( string $root_dir, string $project_name, string $tld */ protected function get_php_reusable() : array { $version_map = [ - '8.2' => 'humanmade/altis-local-server-php:8.2.5', - '8.1' => 'humanmade/altis-local-server-php:6.0.7', - '8.0' => 'humanmade/altis-local-server-php:5.0.7', + '8.2' => 'humanmade/altis-local-server-php:8.2.9', + '8.1' => 'humanmade/altis-local-server-php:6.0.10', + '8.0' => 'humanmade/altis-local-server-php:5.0.10', '7.4' => 'humanmade/altis-local-server-php:4.2.5', ]; @@ -131,6 +131,10 @@ protected function get_php_reusable() : array { $volumes[] = "{$this->config_dir}/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini"; } + if ( $this->get_config()['afterburner'] && $version !== "7.4" ) { + $volumes[] = "{$this->config_dir}/afterburner.ini:/usr/local/etc/php/conf.d/afterburner.ini"; + } + $services = [ 'init' => true, 'depends_on' => [ @@ -881,6 +885,7 @@ protected function get_config() : array { 'cavalcade' => $modules['cloud']['cavalcade'] ?? true, 'elasticsearch' => ( $analytics_enabled || $search_enabled ) ? '7' : false, 'kibana' => ( $analytics_enabled || $search_enabled ), + 'afterburner' => false, 'xray' => $modules['cloud']['xray'] ?? true, 'ignore-paths' => [], 'php' => '8.1', From 4fd7933dfa3b50c37b2999fbec44ece99e1a8627 Mon Sep 17 00:00:00 2001 From: Joe Hoyle Date: Wed, 25 Oct 2023 16:55:07 +0200 Subject: [PATCH 2/3] Fix typo --- docs/using-afterburner.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/using-afterburner.md b/docs/using-afterburner.md index 165b26dc..027b3ddd 100644 --- a/docs/using-afterburner.md +++ b/docs/using-afterburner.md @@ -1,6 +1,6 @@ # Using Afterburner -If your project uses Afterburner in Altis Cloud, you can enabled it in Altis Local Service by setting the `altis.modules.local-server.afterburner` value to `true`: +If your project uses Afterburner in Altis Cloud, you can enable it in Altis Local Service by setting the `altis.modules.local-server.afterburner` value to `true`: ```json { From 9c11880e396e3f51c00e9572b0b38d2f9202cd99 Mon Sep 17 00:00:00 2001 From: Joe Hoyle Date: Thu, 2 Nov 2023 20:00:30 +0100 Subject: [PATCH 3/3] FIx phpcs --- inc/composer/class-docker-compose-generator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/composer/class-docker-compose-generator.php b/inc/composer/class-docker-compose-generator.php index b8e802fc..654e917a 100644 --- a/inc/composer/class-docker-compose-generator.php +++ b/inc/composer/class-docker-compose-generator.php @@ -131,7 +131,7 @@ protected function get_php_reusable() : array { $volumes[] = "{$this->config_dir}/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini"; } - if ( $this->get_config()['afterburner'] && $version !== "7.4" ) { + if ( $this->get_config()['afterburner'] && $version !== '7.4' ) { $volumes[] = "{$this->config_dir}/afterburner.ini:/usr/local/etc/php/conf.d/afterburner.ini"; }