We're using 'beam' for this which is essentially a wrapper for rsync. Beam is an open source deployment tool we developed for deploying websites to servers: https://github.com/heyday/beam - it's great as a standalone deployment tool, but can also be used within CI/CD tools like Buddy. It works with a JSON formatted config file stored in the project where you can store things like file excludes and targets [servers]. A few of the Beam safeguard features don't really apply when running beam within the Buddy environment - like locking a target to a git branch, defaulting to deployments from a temp directory, but these can be overridden with command line params.
To use within a pipeline just add a PHPUnit Docker action which gives you a PHP environment. Then configure as follows:
Add this to the Packages & Setup Commands (you can also delete the phpunit install):
# Install Beam
curl https://getbeam.io/installer -O; php installer
mv beam /usr/local/bin/beam
In the Run Commands section add:
echo "Host *\n\tStrictHostKeyChecking no" >> /root/.ssh/config
beam up [target] --no-prompt --working-copy
You'll also need to generate an SSH key called id_rsa as a Buddy environment variable (either for the pipeline, project or workspace) - this'll allow the SSH access that rsync requires once you've added the associated public key to your server's authorised_keys file.
You can also pass in rsync parameters.
We have it working great for us and file deployments are significantly faster given it's using rsync.