From fc0e8691d815404027b36442ec11628a2d83e4ee Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Wed, 1 May 2024 12:11:59 +0530 Subject: [PATCH] Changes for updated compose compatibility Signed-off-by: Riddhesh Sanghvi --- src/PHP.php | 1 + src/Site_PHP_Docker.php | 9 +++++---- templates/docker-compose.mustache | 17 +++++++---------- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/PHP.php b/src/PHP.php index 38eb063..ca133f0 100644 --- a/src/PHP.php +++ b/src/PHP.php @@ -621,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 a4029f2..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' ], @@ -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}}