-
Notifications
You must be signed in to change notification settings - Fork 7
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
Comments
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. |
Currently using the non-global script (but same code):
#!/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. |
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 |
@jasperf: Yes, this would be great because then I can sync back directly from production to staging. |
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. |
Transferring the database dump and replacements work well,
but transferring the uploads/ folder between the two servers results in this error message:
The text was updated successfully, but these errors were encountered: