Skip to content

Commit

Permalink
Merge pull request #227 from humanmade/backport-226-to-v4-branch
Browse files Browse the repository at this point in the history
[Backporting v4-branch] Fix proxy restart, stop and destroy commands
  • Loading branch information
roborourke authored Oct 23, 2020
2 parents fde417a + 777549d commit 37b538d
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions inc/composer/class-command.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,16 @@ protected function start( InputInterface $input, OutputInterface $output ) {
protected function stop( InputInterface $input, OutputInterface $output ) {
$output->writeln( '<info>Stopping...</>' );

$proxy = new Process( 'docker-compose stop', 'vendor/altis/local-server/docker', $this->get_env() );
$proxy->run();

$compose = new Process( 'docker-compose stop', 'vendor/altis/local-server/docker', $this->get_env() );
$return_val = $compose->run( function ( $type, $buffer ) {
echo $buffer;
} );

$proxy = new Process( 'docker-compose -f proxy.yml stop', 'vendor/altis/local-server/docker' );
$proxy->run( function ( $type, $buffer ) {
echo $buffer;
} );

if ( $return_val === 0 ) {
$output->writeln( '<info>Stopped.</>' );
} else {
Expand All @@ -272,14 +274,16 @@ protected function stop( InputInterface $input, OutputInterface $output ) {
protected function destroy( InputInterface $input, OutputInterface $output ) {
$output->writeln( '<error>Destroying...</>' );

$proxy = new Process( 'docker-compose down -v', 'vendor/altis/local-server/docker', $this->get_env() );
$proxy->run();

$compose = new Process( 'docker-compose down -v', 'vendor/altis/local-server/docker', $this->get_env() );
$return_val = $compose->run( function ( $type, $buffer ) {
echo $buffer;
} );

$proxy = new Process( 'docker-compose -f proxy.yml down -v', 'vendor/altis/local-server/docker' );
$proxy->run( function ( $type, $buffer ) {
echo $buffer;
} );

if ( $return_val === 0 ) {
$output->writeln( '<error>Destroyed.</>' );
} else {
Expand All @@ -299,8 +303,10 @@ protected function destroy( InputInterface $input, OutputInterface $output ) {
protected function restart( InputInterface $input, OutputInterface $output ) {
$output->writeln( '<info>Restarting...</>' );

$proxy = new Process( 'docker-compose restart', 'vendor/altis/local-server/docker', $this->get_env() );
$proxy->run();
$proxy = new Process( 'docker-compose -f proxy.yml restart', 'vendor/altis/local-server/docker' );
$proxy->run( function ( $type, $buffer ) {
echo $buffer;
} );

$options = $input->getArgument( 'options' );
if ( isset( $options[0] ) ) {
Expand Down

0 comments on commit 37b538d

Please sign in to comment.