@@ -76,8 +76,9 @@ public static function down_global_containers( $updated_images ) {
7676 foreach ( $ updated_images as $ image_name ) {
7777 $ global_container_name = $ all_global_images [ $ image_name ];
7878 $ global_service_name = ltrim ( $ global_container_name , 'services_ ' );
79- $ global_service_name = rtrim ( $ global_service_name , '_1 ' );
80- EE ::debug ( "Removing $ global_container_name " );
79+ $ remove_suffix = explode ( '_1 ' , $ global_service_name );
80+ $ global_service_name = empty ( $ remove_suffix [0 ] ) ? $ global_service_name : $ remove_suffix [0 ];
81+ EE ::debug ( "Removing $ global_container_name " );
8182
8283 if ( false !== \EE_DOCKER ::container_status ( $ global_container_name ) ) {
8384 if ( ! EE ::exec ( "docker-compose stop $ global_service_name && docker-compose rm -f $ global_service_name " ) ) {
@@ -94,8 +95,11 @@ public static function down_global_containers( $updated_images ) {
9495 * @throws \Exception
9596 */
9697 public static function global_service_up ( $ service_name ) {
98+ $ global_service_name = ltrim ( $ service_name , 'services_ ' );
99+ $ remove_suffix = explode ( '_1 ' , $ global_service_name );
100+ $ global_service_name = empty ( $ remove_suffix [0 ] ) ? $ global_service_name : $ remove_suffix [0 ];
97101 EE ::debug ( 'Start ' . $ service_name . ' container up ' );
98- if ( 'global-nginx-proxy ' === $ service_name ) {
102+ if ( 'global-nginx-proxy ' === $ global_service_name ) {
99103 \EE \Service \Utils \nginx_proxy_check ();
100104 } else {
101105 \EE \Service \Utils \init_global_container ( $ service_name );
@@ -124,8 +128,13 @@ public static function global_service_down( $service_name ) {
124128 * @return array
125129 */
126130 public static function get_all_global_images_with_service_name () {
131+
132+ $ launch = EE ::launch ( sprintf ( 'docker ps -f "id=%s" --format={{.Names}} ' , EE_PROXY_TYPE ) );
133+ if ( 0 === $ launch ->return_code ) {
134+ $ nginx_proxy = trim ( $ launch ->stdout );
135+ }
127136 return [
128- 'easyengine/nginx-proxy ' => EE_PROXY_TYPE ,
137+ 'easyengine/nginx-proxy ' => $ nginx_proxy ,
129138 'easyengine/mariadb ' => GLOBAL_DB_CONTAINER ,
130139 'easyengine/redis ' => GLOBAL_REDIS_CONTAINER ,
131140 // 'easyengine/cron' => EE_CRON_SCHEDULER, //TODO: Add it to global docker-compose.
0 commit comments