예제 #1
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $composeConfig = new ComposeConfig();
     // Create docker folder in project.
     try {
         $composeConfig->ensureDirectories();
     } catch (IOException $e) {
         $this->stdOut->writeln("<error>Error while trying to create docker-compose directories.</error>");
         exit(1);
     }
     $composeConfig->copyImages();
     $composeConfig->copyConfigs();
     $composeContainers = new ComposeContainers(Platform::rootDir(), Config::get('name'));
     // @todo: With #20 and making tool provider aware, read those configs. Or push those configs to main.
     if (isset(Config::get()['services'])) {
         foreach (Config::get('services') as $service) {
             switch ($service) {
                 case 'redis':
                     $composeContainers->addRedis();
                     break;
                 case 'solr':
                     $composeContainers->addSolr();
                     break;
                 case 'memcached':
                     $composeContainers->addMemcached();
                     break;
             }
         }
     }
     $composeConfig->writeDockerCompose($composeContainers);
     // @todo move this into a static class to run configure based on type.
     $stack = Toolstack::inspect(Platform::webDir());
     if ($stack) {
         $this->stdOut->writeln("<comment>Configuring stack:</comment> " . $stack->type());
         switch ($stack->type()) {
             case Stacks\Drupal::TYPE:
                 $drupal = new Drupal();
                 $drupal->configure();
                 break;
             case Stacks\WordPress::TYPE:
                 $wordpress = new WordPress();
                 $wordpress->configure();
                 break;
         }
     }
     $this->stdOut->writeln('<info>Building the containers</info>');
     Compose::build();
     $this->stdOut->writeln('<info>Bringing up the containers</info>');
     Compose::up(['-d']);
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $composeConfig = new ComposeConfig();
     // Create docker folder in project.
     try {
         $composeConfig->ensureDirectories();
     } catch (IOException $e) {
         $this->stdOut->writeln("<error>Error while trying to create docker-compose directories.</error>");
         exit(1);
     }
     $composeConfig->copyImages();
     $composeConfig->copyConfigs();
     $composeContainers = new ComposeContainers(Platform::rootDir(), Config::get('name'));
     // @todo check if services.yml has redis
     $composeContainers->addRedis();
     // @todo check to make this optional
     $composeContainers->addSolr();
     $composeConfig->writeDockerCompose($composeContainers);
     // @todo move this into a static class to run configure based on type.
     $stack = Toolstack::getStackByDir(Platform::webDir());
     if ($stack) {
         $this->stdOut->writeln("<comment>Configuring stack:</comment> " . $stack->type());
         switch ($stack->type()) {
             case Stacks\Drupal::TYPE:
                 $drupal = new Drupal();
                 $drupal->configure();
                 break;
             case Stacks\WordPress::TYPE:
                 $wordpress = new WordPress();
                 $wordpress->configure();
                 break;
         }
     }
     $this->stdOut->writeln('<info>Building the containers</info>');
     Compose::build();
     $this->stdOut->writeln('<info>Bringing up the containers</info>');
     Compose::up(['-d']);
 }