Skip to content
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

"The source and destination cannot both be remote." #6

Open
strarsis opened this issue Jun 13, 2017 · 5 comments
Open

"The source and destination cannot both be remote." #6

strarsis opened this issue Jun 13, 2017 · 5 comments

Comments

@strarsis
Copy link
Contributor

Transferring the database dump and replacements work well,
but transferring the uploads/ folder between the two servers results in this error message:

[...]
Success: Made 16 replacements.
The source and destination cannot both be remote.
rsync error: syntax or usage error (code 1) at main.c(1279) [Receiver=3.1.1]
@jasperf
Copy link
Owner

jasperf commented Jun 13, 2017

What option did you choose assuming you are using synch all? Could be that staging to production has to particular error. Or that the local directory always needs to be the local box.. And in that case we may have to change the questions/options for uploads.

@jasperf jasperf added the bug label Jun 13, 2017
@strarsis
Copy link
Contributor Author

Currently using the non-global script (but same code):

./wp-cli-transfer.sh production staging
#!/bin/bash

DEVDIR="web/app/uploads/"
DEVSITE="http://dev:8085"

PRODDIR="web@production:/srv/www/example.com/shared/uploads/"
PRODSITE="https://www.example.com"

STAGDIR="web@staging:/srv/www/example.com/shared/uploads/"
STAGSITE="http://staging.example.com"

FROM=$1
TO=$2

case "$1-$2" in
  development-production) DIR="up";  FROMSITE=$DEVSITE;  FROMDIR=$DEVDIR;  TOSITE=$PRODSITE; TODIR=$PRODDIR; ;;
  development-staging)    DIR="up";   FROMSITE=$DEVSITE;  FROMDIR=$DEVDIR;  TOSITE=$STAGSITE; TODIR=$STAGDIR; ;;
  production-development) DIR="down"; FROMSITE=$PRODSITE; FROMDIR=$PRODDIR; TOSITE=$DEVSITE;  TODIR=$DEVDIR; ;;
  production-staging)     DIR="horizontally"; FROMSITE=$PRODSITE; FROMDIR=$PRODDIR; TOSITE=$STAGSITE; TODIR=$STA$
  staging-development)    DIR="down"; FROMSITE=$STAGSITE; FROMDIR=$STAGDIR; TOSITE=$DEVSITE;  TODIR=$DEVDIR; ;;
  *) echo "usage: $0 development production | development staging | production development | production staging $
esac

read -r -p "Would you really like to reset the $TO database and sync $DIR from $FROM? [y/N] " response

if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
  #cd ../ &&
  wp "@$TO" db export &&
  wp "@$FROM" db export - | wp "@$TO" db import - &&
  wp "@$TO" search-replace "$FROMSITE" "$TOSITE" --skip-columns=guid &&
  rsync -F -az --progress "$FROMDIR" "$TODIR"
fi

I can SSH into web@staging and web@production.

@jasperf
Copy link
Owner

jasperf commented Jun 13, 2017

Yeah, with current setup both destinations cannot be remote as rsync commands assumes you run things locally. We will need to adjust the rsync command to ssh in when need be. See also https://serverfault.com/a/449717/101547 . So if $FROMDIR is DEV or PROD SSH in and then rsync. When I have time and some luck I will update the code. Thanks for reporting @strarsis

@strarsis
Copy link
Contributor Author

@jasperf: Yes, this would be great because then I can sync back directly from production to staging.

@jasperf
Copy link
Owner

jasperf commented Jun 17, 2017

Working on a new branch here to see if I can do this with an embedded conditional. Not tested yet as I need to think about it all some more.

@jasperf jasperf added enhancement and removed bug labels Jun 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants