Пример #1
0
 /**
  * {@inheritdoc}
  *
  * @see PlatformCommand::getCurrentEnvironment()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $process = Docker::inspect(['--format="{{ .State.Running }}"', 'nginx-proxy'], true);
     $url = 'http://' . Platform::projectName() . '.' . Platform::projectTld();
     if (trim($process->getOutput()) != 'true') {
         $port = Docker::getContainerPort(Compose::getContainerName(Platform::projectName(), 'nginx'), 80);
         $url .= ':' . $port;
     }
     $this->openUrl($url);
 }
Пример #2
0
    public function dbFromLocal()
    {
        $hostname = Compose::getContainerName(Platform::projectName(), 'mariadb');
        $name = Platform::projectName();
        $tld = Platform::projectTld();
        $this->string .= <<<EOT
if (empty(\$_SERVER['PLATFORM_DOCKER'])) {
    \$cmd = "docker inspect --format='{{(index (index .NetworkSettings.Ports \\"3306/tcp\\") 0).HostPort}}' {$hostname}";
    \$port = trim(shell_exec(\$cmd));
    define('DB_HOST', "{$name}.{$tld}:\$port");
}
EOT;
    }
Пример #3
0
    /**
     * Builds the settings.local.php file.
     */
    public function __construct()
    {
        $this->projectName = Platform::projectName();
        $this->projectTld = Platform::projectTld();
        $this->containerName = Compose::getContainerName(Platform::projectName(), 'mariadb');
        /** @var DrupalStackHelper $drupalStack */
        $drupalStack = Toolstack::getStackByType('drupal');
        $this->version = $drupalStack->version(Platform::webDir());
        $this->string = "<?php\n\n";
        $this->setSalt();
        $this->dbFromLocal();
        $this->dbFromDocker();
        if ($this->version == DrupalStackHelper::DRUPAL8) {
            $this->string .= <<<EOT
// Configuration directories.
\$config_directories = array(
  CONFIG_ACTIVE_DIRECTORY => '../../../shared/config/active',
  CONFIG_STAGING_DIRECTORY => '../../../shared/config/staging',
);
EOT;
        }
    }
Пример #4
0
 public function copyConfigs()
 {
     // Copy configs
     foreach ($this->configsToCopy() as $fileName) {
         $this->fs->copy($this->resourcesDir . '/conf/' . $fileName, $this->projectPath . '/docker/conf/' . $fileName);
     }
     // 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');
 }
Пример #5
0
 /**
  * {@inheritdoc}
  *
  * @see PlatformCommand::getCurrentEnvironment()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $processBuilder = ProcessBuilder::create(['drush', $input->getArgument('cmd'), '--root=' . Platform::webDir(), '--uri=' . Platform::projectName() . '.' . Platform::projectTld()]);
     passthru($processBuilder->getProcess()->getCommandLine());
 }
 /**
  *
  */
 public function addWebserver()
 {
     $this->config['nginx'] = ['image' => 'nginx:1.9.0', 'volumes' => ['./docker/conf/nginx.conf:/etc/nginx/conf.d/default.conf', './:/var/platform', './docker/ssl/nginx.crt:/etc/nginx/ssl/nginx.crt', './docker/ssl/nginx.key:/etc/nginx/ssl/nginx.key'], 'ports' => ['80', '443'], 'links' => ['phpfpm'], 'environment' => ['VIRTUAL_HOST' => $this->name . '.' . Platform::projectTld(), 'PLATFORM_DOCKER' => $this->name]];
 }