app/RancherAccess/RancherService.php
public function upgrade(string $directory, string $stackName, string $activeService, string $replacementService) {

		$baseCommand = [
			$this->account->getRancherCompose(), "-f", "$directory/docker-compose.yml", '-r', "$directory/rancher-compose.yml", '-p', $stackName
		];

		$commands = [
			'upgrade' => array_merge($baseCommand, ['upgrade', '-w', '-c', $activeService, $replacementService]),
			'up' => array_merge($baseCommand, ['up', '-d', '-c']),
		];

		$usedCommand = 'upgrade';
		if($activeService === $replacementService)
			$usedCommand = 'up';


		$url = $this->getUrl();
		$process = ProcessBuilder::create( $commands[$usedCommand] )
			->setTimeout(null)
			->addEnvironmentVariables([
				'RANCHER_URL' => $url,
				'RANCHER_ACCESS_KEY' => $this->account->getKey(),
				'RANCHER_SECRET_KEY' => $this->account->getSecret(),
			])->getProcess();

		$ran = $this->processHelper->run($this->output, $process, null, null, OutputInterface::VERBOSITY_NORMAL);
		if( $ran->getExitCode() != 0 )
			throw new UpgradeFailedException("Command ".$ran->getCommandLine());
	}
public function upgrade(string $directory, string $stackName, string $activeService, string $replacementService) {

		$baseCommand = [
			$this->account->getRancherCompose(), "-f", "$directory/docker-compose.yml", '-r', "$directory/rancher-compose.yml", '-p', $stackName
		];

		$commands = [
			'upgrade' => array_merge($baseCommand, ['upgrade', '-w', '-c', $activeService, $replacementService]),
			'up' => array_merge($baseCommand, ['up', '-d', '-c']),
		];

		$usedCommand = 'upgrade';
		if($activeService === $replacementService)
			$usedCommand = 'up';


		$url = $this->getUrl();
		$process = ProcessBuilder::create( $commands[$usedCommand] )
			->setTimeout(null)
			->addEnvironmentVariables([
				'RANCHER_URL' => $url,
				'RANCHER_ACCESS_KEY' => $this->account->getKey(),
				'RANCHER_SECRET_KEY' => $this->account->getSecret(),
			])->getProcess();

		$ran = $this->processHelper->run($this->output, $process, null, null, OutputInterface::VERBOSITY_NORMAL);
		if( $ran->getExitCode() != 0 )
			throw new UpgradeFailedException("Command ".$ran->getCommandLine());
	}
public function upgrade ( string $ directory , string $ stackName , string $ activeService , string $ replacementService ) { $ baseCommand = [ $ this -> account -> getRancherCompose ( ) , "-f" , "$directory/docker-compose.yml" , '-r' , "$directory/rancher-compose.yml" , '-p' , $ stackName ] ; $ commands = [ 'upgrade' => array_merge ( $ baseCommand , [ 'upgrade' , '-w' , '-c' , $ activeService , $ replacementService ] ) , 'up' => array_merge ( $ baseCommand , [ 'up' , '-d' , '-c' ] ) , ] ; $ usedCommand = 'upgrade' ; if ( $ activeService === $ replacementService ) $ usedCommand = 'up' ; $ url = $ this -> getUrl ( ) ; $ process = ProcessBuilder :: create ( $ commands [ $ usedCommand ] ) -> setTimeout ( null ) -> addEnvironmentVariables ( [ 'RANCHER_URL' => $ url , 'RANCHER_ACCESS_KEY' => $ this -> account -> getKey ( ) , 'RANCHER_SECRET_KEY' => $ this -> account -> getSecret ( ) , ] ) -> getProcess ( ) ; $ ran = $ this -> processHelper -> run ( $ this -> output , $ process , null , null , OutputInterface :: VERBOSITY_NORMAL ) ; if ( $ ran -> getExitCode ( ) != 0 ) throw new UpgradeFailedException ( "Command " . $ ran -> getCommandLine ( ) ) ; }
Upgrade the given activeService to the replacementService within the given stack, using the currently built
configuration in directory

@param string $directory
@param string $stackName
@param string $activeService
@param string $replacementService
Upgrade the given activeService to the replacementService within the given stack using the currently built configuration in directory