Пример #1
0
 public function run()
 {
     if (!$this->isCurrentUserInDockerGroup()) {
         $this->userInteraction->writeTitle('Making docker work without sudo');
         $this->processRunner->run('sudo usermod -a -G docker $USER');
     }
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     if (!$this->isUsingDnsDockDnsServer()) {
         $this->userInteraction->writeTitle('Configure routing for direct Docker containers access');
         $this->processRunner->run("sudo sed -i -e '1inameserver " . DnsDock::IP . "\\' /etc/resolv.conf");
     }
 }
Пример #3
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->userInteraction->writeTitle('Configure routing for direct Docker containers access');
     $machineIp = $this->machine->getIp();
     $this->configureRouting($machineIp);
     $this->addPermanentRouting($machineIp);
 }
Пример #4
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     if (!$this->isUsingDnsDockDnsServer()) {
         $this->userInteraction->writeTitle('Configure routing for direct Docker containers access');
         $this->processRunner->run('echo "nameserver ' . DnsDock::IP . '" | sudo tee -a /etc/resolvconf/resolv.conf.d/head');
         $this->processRunner->run('sudo resolvconf -u');
     }
 }
Пример #5
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->userInteraction->writeTitle('Configure DNS resolution for Docker containers');
     $needMachineRestart = $this->configureVirtualMachine();
     $this->configureHostMachineResolution();
     if ($needMachineRestart) {
         $this->restartMachine();
     }
 }
Пример #6
0
 public function run()
 {
     if (!$this->hasDockerOptions()) {
         $this->userInteraction->writeTitle('Configuring DNS resolution for Docker containers');
         $this->processRunner->run('echo \'DOCKER_OPTS="--bip=' . self::IP . '/24 --dns ' . self::IP . '"\' | sudo tee -a /etc/default/docker');
         $this->processRunner->run('sudo service docker restart');
     }
     $this->processRunner->run('sudo docker start dnsdock || sudo docker run -d -v /var/run/docker.sock:/var/run/docker.sock --name dnsdock -p 172.17.42.1:53:53/udp tonistiigi/dnsdock');
 }
Пример #7
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->userInteraction->writeTitle("Pulling image aacebedo/dnsdock");
     $this->userInteraction->write("Check docker machine is running");
     if (!$this->machine->isRunning()) {
         $this->userInteraction->write("Starting machine");
         $this->machine->start();
     }
     $this->userInteraction->write("Setting environment variables");
     $this->processRunner->run($this->machine->getEnvironmentDeclaration());
     $this->userInteraction->write("Pulling image aacebedo/dnsdock, this could take a while when run for the first time");
     $this->processRunner->run('docker pull aacebedo/dnsdock:latest-amd64');
 }
 /**
  * {@inheritdoc}
  */
 public function execute(ChainContext $context)
 {
     try {
         $this->process->execute($context);
     } catch (ProcessFailedException $e) {
         $processOutput = $e->getProcess()->getOutput();
         if (strpos($processOutput, 'Agreeing to the Xcode/iOS license requires admin privileges, please re-run') !== false) {
             $this->userInteraction->writeTitle('You need to agree Xcode license.');
             $this->userInteraction->write('Run `xcode-select --install` to fix the problem and run this command again.');
             throw $e;
         }
     }
 }
Пример #9
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->userInteraction->writeTitle('Checking PHP SSH2 extension');
     if ($this->sshExtensionInstalled()) {
         return;
     }
     $this->userInteraction->write('PHP SSH2 extension is required.');
     $package = $this->promptForPackageName();
     if ($package == 'n') {
         $this->userInteraction->write('Skipping PHP SSH2 extension installation, do it yourself.');
     } else {
         $this->installHomebrewPackage($package);
     }
     throw new \RuntimeException('Please re-run this installation script to have enabled PHP-SSH2 extension');
 }
Пример #10
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->userInteraction->writeTitle('Setting up machine environment variables');
     $this->saveEnvironmentVariables();
 }
Пример #11
0
 /**
  * {@inheritdoc}
  */
 public function run(InstallContext $context)
 {
     $this->userInteraction = $context->getUserInteraction();
     $this->processRunner = $context->getProcessRunner();
     $boot2docker = new Boot2DockerCli($this->processRunner);
     if ($boot2docker->isInstalled()) {
         $this->userInteraction->writeTitle('Boot2Docker seems to be installed, removing it.');
         if (!$boot2docker->uninstall()) {
             $this->userInteraction->writeTitle('Something went wrong while uninstalling Boot2Docker, continuing anyway.');
         } else {
             $this->userInteraction->writeTitle('Successfully uninstalled boot2docker');
         }
     }
     $dinghy = new DinghyCli($context->getProcessRunner());
     if (!$dinghy->isInstalled()) {
         $this->userInteraction->writeTitle('Installing Dinghy');
         $this->installDinghy();
         $this->userInteraction->writeTitle('Successfully installed Dinghy');
     } else {
         $this->userInteraction->writeTitle('Dinghy already installed, skipping.');
     }
     $this->changeDinghyDnsResolverNamespace();
     $this->userInteraction->writeTitle('Starting up Dinghy');
     if (!$dinghy->isRunning()) {
         $dinghy->start();
         $this->userInteraction->writeTitle('Started Dinghy');
     } else {
         $this->userInteraction->writeTitle('Dinghy already started');
     }
     if (!$this->haveDinghyEnvironmentVariables()) {
         $this->userInteraction->writeTitle('Setting up dinghy environment variables');
         $this->setupDinghyEnvironmentVariables();
     }
 }
 /**
  * {@inheritdoc}
  */
 public function stop(Project $project)
 {
     $this->userInteraction->writeTitle('Stopping application containers');
     $this->processRunner->followsUpWith($this->composeExecutableFinder->find(), ['stop']);
 }