Skip to content

Commit

Permalink
Merge branch 'develop' for v1.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mrrobot47 committed May 14, 2024
2 parents cd3b6a8 + bd2d589 commit a66f460
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
14 changes: 8 additions & 6 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 @@ -64,8 +65,9 @@ public function generate_docker_compose_yml( array $filters = [], $volumes ) {
$db['sysctls'] = sysctl_parameters();
$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 @@ -108,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 @@ -170,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 @@ -195,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
15 changes: 8 additions & 7 deletions src/WordPress.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ public function __construct() {
* : Set custom source directory for site inside htdocs.
*
* [--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
* default: 8.2
* options:
* - 5.6
* - 7.0
Expand All @@ -142,6 +142,8 @@ public function __construct() {
* - 7.4
* - 8.0
* - 8.1
* - 8.2
* - 8.3
* - latest
* ---
*
Expand Down Expand Up @@ -301,7 +303,7 @@ public function create( $args, $assoc_args ) {
$this->cache_type = \EE\Utils\get_flag_value( $assoc_args, 'cache' );
$wildcard_flag = \EE\Utils\get_flag_value( $assoc_args, 'wildcard' );
$this->site_data['site_ssl_wildcard'] = 'subdom' === $this->site_data['app_sub_type'] || $wildcard_flag ? true : false;
$this->site_data['php_version'] = \EE\Utils\get_flag_value( $assoc_args, 'php', 'latest' );
$this->site_data['php_version'] = \EE\Utils\get_flag_value( $assoc_args, 'php', '8.2' );
$this->site_data['app_admin_url'] = \EE\Utils\get_flag_value( $assoc_args, 'title', $this->site_data['site_url'] );
$this->site_data['app_admin_username'] = \EE\Utils\get_flag_value( $assoc_args, 'admin-user', \EE\Utils\random_name_generator() );
$this->site_data['app_admin_password'] = \EE\Utils\get_flag_value( $assoc_args, 'admin-pass', '' );
Expand Down Expand Up @@ -368,7 +370,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 @@ -378,16 +380,14 @@ 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'] ), $assoc_args );
}

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

if ( \EE\Utils\get_flag_value( $assoc_args, 'local-db' ) ) {
$this->site_data['db_host'] = 'db';
}
Expand Down Expand Up @@ -801,6 +801,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
2 changes: 1 addition & 1 deletion templates/config/nginx/main.conf.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ server {
log_not_found off;
}
# Cache static files
location ~* \.(ogg|ogv|svg|svgz|eot|otf|woff|woff2|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|swf)$ {
location ~* \.(ogg|ogv|svg|svgz|eot|otf|woff|woff2|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|swf|webp)$ {
add_header "Access-Control-Allow-Origin" "*";
access_log off;
log_not_found off;
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 a66f460

Please sign in to comment.