Skip to content

Commit

Permalink
Merge pull request #1828 from mrrobot47/update/global-migration
Browse files Browse the repository at this point in the history
Remove support containers from global migration
  • Loading branch information
mrrobot47 committed May 1, 2024
2 parents d87a7be + 1dd2874 commit fb40793
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 52 deletions.
22 changes: 0 additions & 22 deletions php/EE/Migration/Containers.php
Expand Up @@ -200,17 +200,6 @@ private static function migrate_global_containers( $updated_images ) {
[ $global_compose_file_backup_path, $global_compose_file_path, $updated_global_images ]
);

/**
* Create support containers.
*/
self::$rsp->add_step(
'create-support-global-containers',
'EE\Migration\GlobalContainers::enable_support_containers',
'EE\Migration\GlobalContainers::disable_support_containers',
null,
null
);

self::$rsp->add_step(
'stop-global-containers',
'EE\Migration\GlobalContainers::down_global_containers',
Expand Down Expand Up @@ -240,17 +229,6 @@ private static function migrate_global_containers( $updated_images ) {
[ $global_service_name ]
);
}

/**
* Remove support containers.
*/
self::$rsp->add_step(
'remove-support-global-containers',
'EE\Migration\GlobalContainers::disable_support_containers',
'EE\Migration\GlobalContainers::enable_support_containers',
null,
null
);
}

/**
Expand Down
30 changes: 0 additions & 30 deletions php/EE/Migration/GlobalContainers.php
Expand Up @@ -137,34 +137,4 @@ public static function get_all_global_images_with_service_name() {
'easyengine/newrelic-daemon' => GLOBAL_NEWRELIC_DAEMON_CONTAINER,
];
}

/**
* Create support containers for global-db and global-redis service.
*/
public static function enable_support_containers() {
if ( ! chdir( EE_SERVICE_DIR ) ) {
throw new \Exception( sprintf( '%s path does not exist', EE_SERVICE_DIR ) );
}

$command = \EE_DOCKER::docker_compose_with_custom() . ' --project-name=ee up -d global-db global-redis';
if ( ! EE::exec( $command ) ) {
throw new \Exception( 'Unable to create support container.' );
}
}

/**
* Remove support containers for global-db and global-redis service.
*/
public static function disable_support_containers() {
if ( ! chdir( EE_SERVICE_DIR ) ) {
throw new \Exception( sprintf( '%s path does not exist', EE_SERVICE_DIR ) );
}

$command = \EE_DOCKER::docker_compose_with_custom() . ' --project-name=ee down';
/**
* Return code can be 1 due to error in removing network. This is expected.
* TODO: Get a fix for global network / make them external so that the return code is not 1.
*/
EE::exec( $command );
}
}

0 comments on commit fb40793

Please sign in to comment.