Skip to content

Commit

Permalink
Changes for updated compose compatibility
Browse files Browse the repository at this point in the history
Signed-off-by: Riddhesh Sanghvi <[email protected]>
  • Loading branch information
mrrobot47 committed May 1, 2024
1 parent 3d0a182 commit fc0e869
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/PHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down
9 changes: 5 additions & 4 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 @@ -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 fc0e869

Please sign in to comment.