Skip to content

Commit 6ebdcd0

Browse files
committed
Add step to remove support containers
1 parent b90b3a6 commit 6ebdcd0

File tree

1 file changed

+35
-9
lines changed

1 file changed

+35
-9
lines changed

migrations/container/20181225063950_service-command_change_global_service_container_names.php

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public function up() {
4646
}
4747
}
4848

49-
5049
/**
5150
* Backup old docker-compose file.
5251
*/
@@ -95,26 +94,26 @@ public function up() {
9594
* Start nginx-proxy container.
9695
*/
9796
self::$rsp->add_step(
98-
'start-nginx-proxy-containers',
99-
'EE\Service\Utils\nginx_proxy_check',
97+
'start-renamed-containers',
98+
'EE\Migration\ChangeGlobalServiceContainerNames::start_global_service_containers',
10099
'EE\Migration\ChangeGlobalServiceContainerNames::stop_default_containers',
101-
null,
100+
[ $running_containers ],
102101
null
103102
);
104103

105104
/**
106105
* Start other service containers.
107106
*/
108107
self::$rsp->add_step(
109-
'start-other-service-containers',
110-
'EE\Migration\ChangeGlobalServiceContainerNames::start_other_service_containers',
108+
'remove-support-containers',
109+
'EE\Migration\GlobalContainers::disable_support_containers',
110+
null,
111111
null,
112-
[ $running_containers ],
113112
null
114113
);
115114

116115
if ( ! self::$rsp->execute() ) {
117-
throw new \Exception( 'Unable run update-index migrations.' );
116+
throw new \Exception( 'Unable run change-global-service-container-name migrations.' );
118117
}
119118

120119
}
@@ -127,6 +126,12 @@ public function up() {
127126
public function down() {
128127
}
129128

129+
/**
130+
* Restore docker-compose.yml and start old ee-containers.
131+
*
132+
* @param $source string path of source file.
133+
* @param $destination string path of destination.
134+
*/
130135
public static function restore_yml_file( $source, $destination ) {
131136
EE\Migration\SiteContainers::backup_restore( $source, $destination );
132137

@@ -135,13 +140,25 @@ public static function restore_yml_file( $source, $destination ) {
135140
EE::exec( 'docker-compose up -d' );
136141
}
137142

143+
/**
144+
* Remove running global ee-containers.
145+
*
146+
* @param $containers array of running global containers.
147+
*
148+
* @throws \Exception
149+
*/
138150
public static function remove_global_ee_containers( $containers ) {
139151
$removable_containers = implode( ' ', $containers );
140152
if ( ! EE::exec( "docker rm -f $removable_containers" ) ) {
141153
throw new \Exception( 'Unable to remove global service containers' );
142154
}
143155
}
144156

157+
/**
158+
* Stop default global containers.
159+
*
160+
* @throws \Exception
161+
*/
145162
public static function stop_default_containers() {
146163

147164
chdir( EE_SERVICE_DIR );
@@ -151,12 +168,21 @@ public static function stop_default_containers() {
151168
}
152169
}
153170

154-
public static function start_other_service_containers( $containers ) {
171+
/**
172+
* Start global services with renamed containers names.
173+
*
174+
* @param $containers array of running global containers.
175+
*
176+
* @throws \Exception
177+
*/
178+
public static function start_global_service_containers( $containers ) {
155179

156180
foreach ( $containers as $container ) {
157181
$service = ltrim( $container, 'ee-' );
158182
GlobalContainers::global_service_up( $service );
159183
}
160184

161185
}
186+
187+
162188
}

0 commit comments

Comments
 (0)