示例#1
0
 public function copyConfigs()
 {
     // Copy configs
     foreach ($this->configsToCopy() as $fileName) {
         $this->fs->copy($this->resourcesDir . '/conf/' . $fileName, $this->projectPath . '/docker/conf/' . $fileName);
     }
     // Change the default xdebug remote host on Mac, which uses a VM
     if (!Docker::native()) {
         $phpConfFile = $this->projectPath . '/docker/conf/php.ini';
         $phpConf = file_get_contents($phpConfFile);
         $phpConf = str_replace('172.17.42.1', '192.168.99.1', $phpConf);
         file_put_contents($phpConfFile, $phpConf);
     }
     // Quick fix to make nginx PHP_IDE_CONFIG dynamic for now.
     $nginxConfFile = $this->projectPath . '/docker/conf/nginx.conf';
     $nginxConf = file_get_contents($nginxConfFile);
     $nginxConf = str_replace('{{ platform }}', Platform::projectName() . '.' . Platform::projectTld(), $nginxConf);
     file_put_contents($nginxConfFile, $nginxConf);
     // stub in for Solr configs
     $finder = new Finder();
     $finder->in($this->resourcesDir . '/conf/solr')->files()->depth('< 1')->name('*');
     /** @var \SplFileInfo $file */
     foreach ($finder as $file) {
         $this->fs->copy($file->getPathname(), $this->projectPath . '/docker/conf/solr/' . $file->getFilename());
     }
     // copy ssl
     $this->fs->copy($this->resourcesDir . '/ssl/nginx.crt', $this->projectPath . '/docker/ssl/nginx.crt');
     $this->fs->copy($this->resourcesDir . '/ssl/nginx.key', $this->projectPath . '/docker/ssl/nginx.key');
 }
 /**
  * @param \Symfony\Component\Console\Input\InputInterface $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  *
  * @throws \Exception
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     parent::initialize($input, $output);
     if (!Docker::exists()) {
         $this->stdOut->writeln("<error>Cannot find docker command</error>");
         exit(1);
     }
     if (!Compose::exists()) {
         $this->stdOut->writeln("<error>Cannot find docker-compose command</error>");
         exit(1);
     }
     // For Mac OS X we need to ensure a Docker VM is running.
     if (!Docker::native()) {
         $this->validateNonNative();
     } else {
         $this->validateNative();
     }
 }