diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php index 4b84e82..fb9448d 100644 --- a/features/bootstrap/FeatureContext.php +++ b/features/bootstrap/FeatureContext.php @@ -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'"); diff --git a/src/PHP.php b/src/PHP.php index 7f1fdaf..53aba72 100644 --- a/src/PHP.php +++ b/src/PHP.php @@ -81,7 +81,7 @@ public function __construct() { * : Create separate db container instead of using global db. * * [--php=] - * : 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: @@ -92,6 +92,8 @@ public function __construct() { * - 7.4 * - 8.0 * - 8.1 + * - 8.2 + * - 8.3 * - latest * --- * @@ -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'] ); @@ -236,7 +238,7 @@ 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'] ); @@ -244,7 +246,7 @@ public function create( $args, $assoc_args ) { \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 ); @@ -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']; diff --git a/src/Site_PHP_Docker.php b/src/Site_PHP_Docker.php index 2e6a4c0..05880ee 100644 --- a/src/Site_PHP_Docker.php +++ b/src/Site_PHP_Docker.php @@ -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' ], @@ -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 ] ]; @@ -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', @@ -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 ) ) { @@ -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' ], ], ]; diff --git a/templates/docker-compose.mustache b/templates/docker-compose.mustache index c5aa5fe..16ff8f4 100644 --- a/templates/docker-compose.mustache +++ b/templates/docker-compose.mustache @@ -1,5 +1,3 @@ -version: '3.5' - services: {{#services}} @@ -69,15 +67,14 @@ 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}} @@ -85,11 +82,11 @@ networks: {{/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}}