diff --git a/src/PHP.php b/src/PHP.php index 85ab16d..639625e 100644 --- a/src/PHP.php +++ b/src/PHP.php @@ -220,7 +220,7 @@ public function create( $args, $assoc_args ) { if ( ! empty( $alias_domains ) ) { $comma_seprated_domains = explode( ',', $alias_domains ); foreach ( $comma_seprated_domains as $domain ) { - $trimmed_domain = trim( $domain ); + $trimmed_domain = trim( $domain ); $this->site_data['alias_domains'] .= $trimmed_domain . ','; } } @@ -234,10 +234,10 @@ public function create( $args, $assoc_args ) { $this->site_data['php_version'] = 5.6; } elseif ( 7 === $floor ) { $this->site_data['php_version'] = 7.4; - $old_version .= ' yet'; + $old_version .= ' yet'; } elseif ( 8 === $floor ) { $this->site_data['php_version'] = 8.0; - $old_version .= ' yet'; + $old_version .= ' yet'; } else { EE::error( 'Unsupported PHP version: ' . $this->site_data['php_version'] ); } @@ -254,12 +254,15 @@ public function create( $args, $assoc_args ) { $this->site_data['db_host'] = ''; if ( ! empty( $assoc_args['with-db'] ) ) { - $this->site_data['app_sub_type'] = 'mysql'; - $this->site_data['db_name'] = \EE\Utils\get_flag_value( $assoc_args, 'dbname', str_replace( [ '.', '-' ], '_', $this->site_data['site_url'] ) ); - $this->site_data['db_host'] = \EE\Utils\get_flag_value( $assoc_args, 'dbhost', GLOBAL_DB ); - $this->site_data['db_port'] = '3306'; - $this->site_data['db_user'] = \EE\Utils\get_flag_value( $assoc_args, 'dbuser', $this->create_site_db_user( $this->site_data['site_url'] ) ); - $this->site_data['db_password'] = \EE\Utils\get_flag_value( $assoc_args, 'dbpass', \EE\Utils\random_password() ); + $this->site_data['app_sub_type'] = 'mysql'; + $this->site_data['db_name'] = \EE\Utils\get_flag_value( $assoc_args, 'dbname', str_replace( [ + '.', + '-' + ], '_', $this->site_data['site_url'] ) ); + $this->site_data['db_host'] = \EE\Utils\get_flag_value( $assoc_args, 'dbhost', GLOBAL_DB ); + $this->site_data['db_port'] = '3306'; + $this->site_data['db_user'] = \EE\Utils\get_flag_value( $assoc_args, 'dbuser', $this->create_site_db_user( $this->site_data['site_url'] ) ); + $this->site_data['db_password'] = \EE\Utils\get_flag_value( $assoc_args, 'dbpass', \EE\Utils\random_password() ); if ( $this->cache_type && ! $local_cache ) { \EE\Service\Utils\init_global_container( GLOBAL_REDIS ); @@ -356,6 +359,7 @@ public function info( $args, $assoc_args ) { $site = (array) Site::find( $this->site_data['site_url'] ); $site = reset( $site ); EE::log( json_encode( $site ) ); + return; } @@ -419,8 +423,8 @@ private function configure_site_files() { ]; if ( 'mysql' === $this->site_data['app_sub_type'] ) { - $local = ( 'db' === $this->site_data['db_host'] ) ? true : false; - $db_host = $local ? $this->site_data['db_host'] : $this->site_data['db_host'] . ':' . $this->site_data['db_port']; + $local = ( 'db' === $this->site_data['db_host'] ) ? true : false; + $db_host = $local ? $this->site_data['db_host'] : $this->site_data['db_host'] . ':' . $this->site_data['db_port']; $env_data['local'] = $local; $env_data['root_password'] = $this->site_data['db_root_password']; @@ -429,8 +433,8 @@ private function configure_site_files() { $env_data['user_password'] = $this->site_data['db_password']; } - $server_name = implode( ' ', explode( ',', $this->site_data['alias_domains'] ) ); - $default_conf_content = $this->generate_default_conf( $this->cache_type, $server_name ); + $server_name = implode( ' ', explode( ',', $this->site_data['alias_domains'] ) ); + $default_conf_content = $this->generate_default_conf( $this->cache_type, $server_name ); $custom_ini = '5.6' === (string) $this->site_data['php_version'] ? 'php.ini-56.mustache' : 'php.ini.mustache'; $env_content = \EE\Utils\mustache_render( SITE_WP_TEMPLATE_ROOT . '/config/.env.mustache', $env_data ); @@ -482,6 +486,7 @@ private function configure_site_files() { * Generate and place docker-compose.yml file. * * @param array $additional_filters Filters to alter docker-compose file. + * * @ignorecommand */ public function dump_docker_compose_yml( $additional_filters = [] ) { @@ -790,7 +795,7 @@ private function maybe_verify_remote_db_connection() { */ private function create_site( $assoc_args ) { - $this->level = 1; + $this->level = 1; try { if ( 'inherit' === $this->site_data['site_ssl'] ) { $this->check_parent_site_certs( $this->site_data['site_url'] ); diff --git a/src/Site_PHP_Docker.php b/src/Site_PHP_Docker.php index 1c4e5bd..2e6a4c0 100644 --- a/src/Site_PHP_Docker.php +++ b/src/Site_PHP_Docker.php @@ -196,6 +196,12 @@ public function generate_docker_compose_yml( array $filters = [], $volumes ) { $postfix['image'] = [ 'name' => 'easyengine/postfix:' . $img_versions['easyengine/postfix'] ]; $postfix['hostname'] = [ 'name' => '${VIRTUAL_HOST}' ]; $postfix['restart'] = $restart_default; + $postfix['environment'] = [ + 'env' => [ + [ 'name' => 'RELAY_HOST' ], + [ 'name' => 'REPLY_EMAIL' ], + ], + ]; $postfix['labels'] = [ 'label' => [ 'name' => 'io.easyengine.site=${VIRTUAL_HOST}', @@ -252,8 +258,8 @@ public function generate_docker_compose_yml( array $filters = [], $volumes ) { } $binding = [ - 'services' => $base, - 'network' => $network, + 'services' => $base, + 'network' => $network, ]; if ( ! IS_DARWIN ) { diff --git a/templates/config/.env.mustache b/templates/config/.env.mustache index 6eb00c2..267ed9d 100644 --- a/templates/config/.env.mustache +++ b/templates/config/.env.mustache @@ -9,3 +9,5 @@ VIRTUAL_HOST_EMAIL=example@{{virtual_host}} USER_ID={{user_id}} GROUP_ID={{group_id}} NEWRELIC_LICENSE_KEY= +RELAY_HOST= +REPLY_EMAIL= diff --git a/templates/config/php-fpm/php.ini-56.mustache b/templates/config/php-fpm/php.ini-56.mustache index f91a8ec..91ea378 100644 --- a/templates/config/php-fpm/php.ini-56.mustache +++ b/templates/config/php-fpm/php.ini-56.mustache @@ -4,4 +4,4 @@ upload_max_filesize = 100M post_max_size = 100M [mail function] -sendmail_path = /usr/sbin/sendmail -t -i -f ee4@easyengine.io +sendmail_path = /usr/sbin/sendmail -t -i -f no-reply@example.com