Skip to content

Commit

Permalink
Merge pull request #223 from mrrobot47/update/compose-template
Browse files Browse the repository at this point in the history
Changes for updated compose compatibility
  • Loading branch information
mrrobot47 authored May 1, 2024
2 parents 38da882 + e97fcae commit d06b839
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
11 changes: 6 additions & 5 deletions src/Site_WP_Docker.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,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 @@ -109,7 +110,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 @@ -171,7 +172,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 @@ -196,9 +197,9 @@ public function generate_docker_compose_yml( array $filters = [], $volumes ) {
'name' => 'io.easyengine.site=${VIRTUAL_HOST}',
],
];
$mailhog['networks'] = [
$mailhog['networks'] = [
'net' => [
[ 'name' => 'site-network' ],
[ 'name' => $filters['site_url'] ],
[ 'name' => 'global-frontend-network' ],
],
];
Expand Down
1 change: 1 addition & 0 deletions src/WordPress.php
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,7 @@ public function dump_docker_compose_yml( $additional_filters = [] ) {
$filter[] = $this->site_data['cache_host'];
$filter[] = $this->site_data['db_host'];
$filter['is_ssl'] = $this->site_data['site_ssl'];
$filter['site_url'] = $this->site_data['site_url'];
$filter['site_prefix'] = \EE_DOCKER::get_docker_style_prefix( $this->site_data['site_url'] );
$filter['php_version'] = ( string ) $this->site_data['php_version'];
$filter['alias_domains'] = implode( ',', array_diff( explode( ',', $this->site_data['alias_domains'] ), [ $this->site_data['site_url'] ] ) );
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 d06b839

Please sign in to comment.