deployer
deployer copied to clipboard
Add new update_strategy rsync which do not require git repositoryy
- Deployer version: 7.0-rc3
- Deployment OS: MAC OSX Monterey
When configuring rsync for deploying my application: https://deployer.org/docs/7.x/contrib/rsync
The update_code still requires git and that a repository is defined.
Would be nice if the deploy:prepare works with rsync only when its configured and not requires to clone a repository. Maybe I'm misunderstanding and something like a feature for using a update_strategy rsync could be added?
deploy.php from the docs: https://deployer.org/docs/7.x/contrib/rsync
host('hostname')
->hostname('10.10.10.10')
->set('rsync_src', __DIR__)
->set('rsync_dest','{{release_path}}');
task('deploy', [
'deploy:prepare', // prepare fails as it depends on update_code as it depends on repository
'deploy:release',
'rsync',
'deploy:vendors',
'deploy:symlink',
])->desc('Deploy your project');
My current workaround is doing the following:
/** @var GroupTask $deployPrepareTask */
$deployPrepareTask = task('deploy:prepare');
$tasks = [];
foreach ($deployPrepareTask->getGroup() as $key => $value) {
$tasks[$key] = 'deploy:update_code' === $value ? 'rsync' : $value;
}
task('deploy:prepare', $tasks);
Looks like something like update_strategy: rsync is what would be what I'm searching for which does not yet exist. So I will convert this "bug report" to "feature request".
You can also do this:
task('deploy:update_code')->disable();
@antonmedv so I could go with:
task('deploy:update_code')->disable();
after('deploy:update_code', 'rsync');
Or would rsync then not be executed?
You can verify it via:
dep tree deploy
Or
dep deploy all --plan
The --plan it shows only the command which are executed, thats great 👍 .
The tree output was not clear for me as it was listed this way:
│ ├── deploy:update_code // disabled
│ ├── rsync // after deploy:update_code
Personally would not show the disabled commands by default and remove the // after to avoid confusen:
- │ ├── deploy:update_code // disabled
- │ ├── rsync // after deploy:update_code
+ │ ├── rsync
Maybe have a verbose output which would add disabled task and the after comments. But by default I would not show them. Just as an input from my side.
Thanks for create this issue, more than weeks I'm facing the problem with git clone via ssh then rsync come to rescue!
@satyakresna what is your problem with git? Check what you gave deploy_keys, and updated known_hosts.
We use self hosted git server in our company. I already add deploy keys and update known_hosts. But, it doesn't work and our infra team say that there's a problem in git server and still on progress to fix it. So, I choose to use rsync instead of git clone.
Hey everyone! A simple rsync-only example in the docs would be awesome! Came across this when we tried to build a typo3 project fully in bitbucket pipeline (composer, npm) and wanted to rsync the results to the target server. It's work in progress. If some has published an example already, please let me know! :-)
Nevermind, it seems curl -LO https://deployer.org/deployer.phar downloads deployer 6.8.0 and not 7.x
task('deploy:update_code')->disable();
Doesn't seem to work in 7.x
[Error] Call to undefined method Deployer\Task\Task::disable()
You need a 7.* version, there the disable exists: https://github.com/deployphp/deployer/blob/v7.3.3/src/Task/Task.php#L262.
You can download every deployer.phar version directly from the Github Releases Page: https://github.com/deployphp/deployer/releases/download/v7.3.3/deployer.phar
You can download every deployer.phar version directly from the Github Releases Page: https://github.com/deployphp/deployer/releases/download/v7.3.3/deployer.phar
Please check my comment again, I had updated it. It seems the documentation for v7 does not mention the phar releases anymore. Try searching for "phar" at https://deployer.org/docs/7.x/installation
I had looked at the releases page then and found it. After that I had updated my comment.