diff --git a/doc/default-deployer.md b/doc/default-deployer.md index 899f8f8..02396bc 100644 --- a/doc/default-deployer.md +++ b/doc/default-deployer.md @@ -37,6 +37,19 @@ public function configure() } ``` +You can optionaly define the root directory per server: +```php +public function configure() +{ + return $this->getConfigBuilder() + ->server('user@hostname', ['app'], [ + 'deploy_dir' => '/var/www/my-project', + ]) + // ... + ; +} +``` + Then, the following directory structure is created on each remote server: ``` diff --git a/src/Configuration/DefaultConfiguration.php b/src/Configuration/DefaultConfiguration.php index 97c9ac7..cb9d24f 100644 --- a/src/Configuration/DefaultConfiguration.php +++ b/src/Configuration/DefaultConfiguration.php @@ -375,7 +375,7 @@ public function resetOpCacheFor(string $homepageUrl): self protected function getReservedServerProperties(): array { - return [Property::bin_dir, Property::config_dir, Property::console_bin, Property::cache_dir, Property::deploy_dir, Property::log_dir, Property::src_dir, Property::templates_dir, Property::web_dir]; + return [Property::bin_dir, Property::config_dir, Property::console_bin, Property::cache_dir, Property::log_dir, Property::src_dir, Property::templates_dir, Property::web_dir]; } /** diff --git a/src/Deployer/DefaultDeployer.php b/src/Deployer/DefaultDeployer.php index f73a0ae..a946eca 100644 --- a/src/Deployer/DefaultDeployer.php +++ b/src/Deployer/DefaultDeployer.php @@ -194,7 +194,7 @@ private function initializeServerOptions(): void $appServers = $this->getServers()->findByRoles([Server::ROLE_APP]); foreach ($appServers as $server) { $this->log(sprintf('

Setting the %s property for %s server', Property::deploy_dir, $server)); - $server->set(Property::deploy_dir, $this->getConfig(Option::deployDir)); + $server->set(Property::deploy_dir, $server->get(Property::deploy_dir, $this->getConfig(Option::deployDir))); } }