easy-deploy-bundle
easy-deploy-bundle copied to clipboard
{{ project_dir }} resolves to the local project directory in runLocal()
In DefaultDeployer, {{ project_dir }} resolves to the local project directory when it is used inside runLocal(). This may be intended behaviour, but it makes it difficult to copy things to the release directory.
Consider the case of a public/build directory generated by Webpack Encore. I cannot install Webpack Encore on the production server, so I need to copy my public/build folder into the deployment from my local machine. So within beforeFinishingDeploy() I want to do something like:
$this->runLocal('rsync -r public/build/ me@remote:{{ project_dir }}/public/build');
But unfortunately in this case, {{ project_dir }} resolves to the local path of my project, making a nonsense command.
Could we have a {{ remote_project_dir }} available from runLocal()?
Even better, {{ remote_web_dir }}, {{ remote_bin_dir }} etc?
Perhaps you think that a sane deployment should not be copying things manually from the local machine to the server like this. But in that case I think you need to make DefaultDeployer support Webpack Encore managed assets, because this is a recommended solution now in the Symfony docs.
Thank you for considering this. I really like easy-deploy-bundle. It's a great relief not to have to use Capistrano any more.
I have the very same need.
Heres an easy way to get the remote project dir:
$serverRepository = $this->getConfig(Option::servers);
$servers = $serverRepository->findAll();
foreach ($servers as $server) {
$remoteProjectDir = $server->get(\EasyCorp\Bundle\EasyDeployBundle\Server\Property::project_dir);
// $remoteProjectDir points to the release folder.
}
Heres an easy way to get the remote project dir:
$serverRepository = $this->getConfig(Option::servers); $servers = $serverRepository->findAll(); foreach ($servers as $server) { $remoteProjectDir = $server->get(\EasyCorp\Bundle\EasyDeployBundle\Server\Property::project_dir); // $remoteProjectDir points to the release folder. }
Hi, where should we apply this code to?