Skip to content

Commit

Permalink
Merge branch 'develop' into fix/admin-email
Browse files Browse the repository at this point in the history
  • Loading branch information
mrrobot47 authored Sep 16, 2024
2 parents a2bf5f8 + bd0ce5c commit dc09b8f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ public function checkLocalRedisCacheOfSite($site)
$site_root_folder = EE_SITE_ROOT . '/' . $site;
exec("cd $site_root_folder && docker-compose exec redis redis-cli set 'easyengine' 'rocks'");
$output = exec("cd $site_root_folder && docker-compose exec redis redis-cli get 'easyengine'");
if ( '"rocks"' !== $output ) {
if ( 'rocks' !== $output ) {
throw new Exception("Local redis not working for $site site. Getting '$output' instead of 'rocks'.");
}
exec("cd $site_root_folder && docker-compose exec redis redis-cli del 'easyengine'");
Expand Down
11 changes: 7 additions & 4 deletions src/PHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function __construct() {
* : Create separate db container instead of using global db.
*
* [--php=<php-version>]
* : PHP version for site. Currently only supports PHP 5.6, 7.0, 7.2, 7.3, 7.4, 8.0, 8.1 and latest.
* : PHP version for site. Currently only supports PHP 5.6, 7.0, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, and latest.
* ---
* default: latest
* options:
Expand All @@ -92,6 +92,8 @@ public function __construct() {
* - 7.4
* - 8.0
* - 8.1
* - 8.2
* - 8.3
* - latest
* ---
*
Expand Down Expand Up @@ -226,7 +228,7 @@ public function create( $args, $assoc_args ) {
}
$this->site_data['alias_domains'] = substr( $this->site_data['alias_domains'], 0, - 1 );

$supported_php_versions = [ 5.6, 7.0, 7.2, 7.3, 7.4, 8.0, 8.1, 'latest' ];
$supported_php_versions = [ 5.6, 7.0, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 'latest' ];
if ( ! in_array( $this->site_data['php_version'], $supported_php_versions ) ) {
$old_version = $this->site_data['php_version'];
$floor = (int) floor( $this->site_data['php_version'] );
Expand All @@ -236,15 +238,15 @@ public function create( $args, $assoc_args ) {
$this->site_data['php_version'] = 7.4;
$old_version .= ' yet';
} elseif ( 8 === $floor ) {
$this->site_data['php_version'] = 8.0;
$this->site_data['php_version'] = 8.2;
$old_version .= ' yet';
} else {
EE::error( 'Unsupported PHP version: ' . $this->site_data['php_version'] );
}
\EE::confirm( sprintf( 'EEv4 does not support PHP %s. Continue with PHP %s?', $old_version, $this->site_data['php_version'] ) );
}

$this->site_data['php_version'] = ( 7.4 === (double) $this->site_data['php_version'] ) ? 'latest' : $this->site_data['php_version'];
$this->site_data['php_version'] = ( 8.0 === (double) $this->site_data['php_version'] ) ? 'latest' : $this->site_data['php_version'];

if ( $this->cache_type && ! $local_cache ) {
\EE\Service\Utils\init_global_container( GLOBAL_REDIS );
Expand Down Expand Up @@ -619,6 +621,7 @@ public function dump_docker_compose_yml( $additional_filters = [] ) {

$filter = [];
$filter[] = $this->site_data['cache_host'];
$filter['site_url'] = $this->site_data['site_url'];
$filter['site_prefix'] = \EE_DOCKER::get_docker_style_prefix( $this->site_data['site_url'] );
$filter['is_ssl'] = $this->site_data['site_ssl'];
$filter['php_version'] = ( string ) $this->site_data['php_version'];
Expand Down
11 changes: 6 additions & 5 deletions src/Site_PHP_Docker.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ public function generate_docker_compose_yml( array $filters = [], $volumes ) {
$restart_default = [ 'name' => 'always' ];
$network_default = [
'net' => [
[ 'name' => 'site-network' ],
[ 'name' => $filters['site_url'] ],
],
];

$network = [
'name' => $filters['site_url'],
'networks_labels' => [
'label' => [
[ 'name' => 'org.label-schema.vendor=EasyEngine' ],
Expand Down Expand Up @@ -64,7 +65,7 @@ public function generate_docker_compose_yml( array $filters = [], $volumes ) {
$db['networks'] = $network_default;
}
// PHP configuration.
$php_image_key = ( 'latest' === $filters['php_version'] ? 'easyengine/php' : 'easyengine/php' . $filters['php_version'] );
$php_image_key = ( 'latest' === $filters['php_version'] ? 'easyengine/php8.2' : 'easyengine/php' . $filters['php_version'] );

$php['service_name'] = [ 'name' => 'php' ];
$php['image'] = [ 'name' => $php_image_key . ':' . $img_versions[ $php_image_key ] ];
Expand Down Expand Up @@ -101,7 +102,7 @@ public function generate_docker_compose_yml( array $filters = [], $volumes ) {
$php['networks'] = [
'net' => [
[
'name' => 'site-network',
'name' => $filters['site_url'],
'aliases' => [
'alias' => [
'name' => '${VIRTUAL_HOST}_php',
Expand Down Expand Up @@ -160,7 +161,7 @@ public function generate_docker_compose_yml( array $filters = [], $volumes ) {
$nginx['networks'] = [
'net' => [
[ 'name' => 'global-frontend-network' ],
[ 'name' => 'site-network' ],
[ 'name' => $filters['site_url'] ],
],
];
if ( in_array( GLOBAL_REDIS, $filters, true ) ) {
Expand All @@ -186,7 +187,7 @@ public function generate_docker_compose_yml( array $filters = [], $volumes ) {
];
$mailhog['networks'] = [
'net' => [
[ 'name' => 'site-network' ],
[ 'name' => $filters['site_url'] ],
[ 'name' => 'global-frontend-network' ],
],
];
Expand Down
17 changes: 7 additions & 10 deletions templates/docker-compose.mustache
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.5'

services:

{{#services}}
Expand Down Expand Up @@ -69,27 +67,26 @@ services:
volumes:
{{#external_vols}}
{{ext_vol_name}}:
external:
name: {{prefix}}_{{ext_vol_name}}
external: true
name: {{prefix}}_{{ext_vol_name}}
{{/external_vols}}
{{/created_volumes}}

{{#network}}
networks:
site-network:
name: ${VIRTUAL_HOST}
{{name}}:
{{#networks_labels}}
labels:
{{#label}}
- "{{name}}"
{{/label}}
{{/networks_labels}}
global-frontend-network:
external:
name: ee-global-frontend-network
external: true
name: ee-global-frontend-network
{{#enable_backend_network}}
global-backend-network:
external:
name: ee-global-backend-network
external: true
name: ee-global-backend-network
{{/enable_backend_network}}
{{/network}}

0 comments on commit dc09b8f

Please sign in to comment.