Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Afterburner support to Local Server #634

Merged
merged 3 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docker/afterburner.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extension=afterburner.so

afterburner.redis_server_info=redis://redis:6379
afterburner.lru_cache_max_items=1000
19 changes: 19 additions & 0 deletions docs/using-afterburner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Using Afterburner

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
{
"extra": {
"altis": {
"modules": {
"local-server": {
"afterburner": true
}
}
}
}
}
```

Afterburner is only enabled on PHP versions later than 7.4.
11 changes: 8 additions & 3 deletions inc/composer/class-docker-compose-generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@
*/
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',
];

Expand Down Expand Up @@ -131,6 +131,10 @@
$volumes[] = "{$this->config_dir}/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini";
}

if ( $this->get_config()['afterburner'] && $version !== "7.4" ) {

Check failure on line 134 in inc/composer/class-docker-compose-generator.php

View check run for this annotation

HM Linter / hmlinter

inc/composer/class-docker-compose-generator.php#L134

String "7.4" does not require double quotes; use single quotes instead
Raw output
{
  "line": 134,
  "column": 65,
  "severity": "error",
  "message": "String \"7.4\" does not require double quotes; use single quotes instead",
  "source": "Squiz.Strings.DoubleQuoteUsage.NotRequired"
}
$volumes[] = "{$this->config_dir}/afterburner.ini:/usr/local/etc/php/conf.d/afterburner.ini";
}

$services = [
'init' => true,
'depends_on' => [
Expand Down Expand Up @@ -881,6 +885,7 @@
'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',
Expand Down