-
-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Add rsync
command
#109
Comments
I wonder if we could get most of these benefits just by using SSH aliases? Example: if we generated aliases like
|
@tangrufus related roots/trellis#1259 I'm liking the idea of supporting this more, but ideally we could get remote <-> remote working easily too 🤔 # copy from local to remote
trellis copy production source/uploads {site}/shared/uploads
# copy from remote to remote
trellis copy production admin@old_host:{site}/shared/uploads {site}/shared/uploads
# sync from remote to remote
trellis copy --sync production admin@old_host:{site}/shared/uploads {site}/shared/uploads
# maybe we could omit the last path as well and it would use the same dest as the source path?
trellis copy --sync production admin@old_host:{site}/shared/uploads I'd prefer just one top-level command with the best default. So here the default is rsync's
And also shown here is an idea to easily support remote <-> remote. We'd detect if the pattern What do you think? |
Love it!
I'm not clear what
I'm not understanding what those would be for.
Would users need to have
Yes, since the Exciting. |
Just so people wouldn't have to type out
Not 100% sure yet, but full ssh strings should work I'd think. |
The trellis rsync push [--sync] <env> <site> <source> <destation>
trellis rsync pull [--sync] <env> <site> <source> <destation> To tackle the templating variables problem, I suggest we do not run rsync directly, but use ansible's synchronize module: # copy from local to remote
# trellis rsync push production example source/uploads {site}/shared/uploads
- name: Synchronization of src on the control machine to dest on the remote hosts
ansible.posix.synchronize:
src: source/uploads
dest: "{{site}}/shared/uploads"
# copy from remote to local
# trellis rsync pull production example {site}/shared/uploads source/uploads
- name: Synchronization of src on the inventory host to the dest on the localhost in pull mode
ansible.posix.synchronize:
mode: pull
src: "{{site}}/shared/uploads"
dest: source/uploads But, 2 issues:
|
I may be missing the obvious, but if we are talking about sharing data between B and C from A, when would it be necessary to There would need to be, in any case:
Right? I'm thinking about use cases:
I wonder if Trellis-cli can also handle migrating databases and running search-replace, but that's obviously out of the scope of this discussion. We generally WP-Migrate-DB-Pro these days. |
🤔 It's always just
Interesting idea. Why does this make |
I am pretty sure the Trellis-cli can do it pretty easily. You can use the mysqldump in /usr/bin or just use wp db export on the vagrant host to create a copy of the the database. Backup the database being overwritten. use wp cli to do a database import and then wp search-replace $remote_url $local_url to correct urls. Here is a handy script I found a while back that does just that. https://github.com/dale42/wp-site-sync/blob/master/wp-site-sync.sh |
Summary
Add
trellis rsync
which transfers files between remote servers and local machines.Example:
Discussion
What subcommands / flags should we provide?
For reference: AWS CLI provides 3 different subcommands for moving files between s3 buckets and local machines:
Possible solutions:
The text was updated successfully, but these errors were encountered: