I've tried to follow those KB article and I wish to share my experience...
Firstly: why do I need it? isn't Remote Server Support enough?
- Because Zend Studio 9 Remote Server Support is unable to transfer dotted folders. It just ignores them. It looks like its impossible to change this.
(I've posted this question here:
viewtopic.php?f=59&t=105783&p=196043
, but no one replied yet)
- At best, I'd like to have a two-way sync, or at least a notification, that something on the server is updated
So...Let's start:
On the Windows workstation cwRsync a Windows port of rsync is used.
I don't know, which version of cwRsync author have used. For now, I can see two versions: newer commercial and free, cwRsync 4.0.5. I tried to use the latter.
First, you need to create an authentication key pair. But before you do this, make sure that you don't have the keys already in:
Windows - %USERPROFILE%\.ssh
This is where the story begins. The thing is - my cwRsync 4.0.5 won't try to get a profile from there. You may put your keys to anywhere - you still have to provide a full path to the key to cwRsync. (Putting your keys to "%USERPROFILE%\.ssh" is still a good idea, though).
So, we've created our keys and we're now going to test them.
Here's what we can see in the article:
C:\> cd C:\Program Files\cwRsync\bin
C:\Program Files\cwRsync\bin> ssh developer@staging-server
Welcome to the staging server!
developer@staging-server:~$ pwd
/home/developer
As I've just mentioned, I don't get, how ssh choses key in the example above. Even if we suppose that it's aware about "%USERPROFILE%\.ssh" folder, there might be several private keys there...
So, as for me, this example is wrong:
- Code: Select all
C:\Program Files\cwRsync\bin>ssh developer@staging-server
Could not create directory '/home/John/.ssh'.
The authenticity of host 'staging-server (88.88.888.888)' can't be establi
shed.
RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:x:xx:xx:xx:xx:xx:xx:xx:xx.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/home/John/.ssh/known_hosts).
Password:
After reading some documentation I've managed to create an appropriate example:
- Code: Select all
C:\Program Files\cwRsync\bin>ssh -i "C:\Users\John\.ssh\id_rsa" developer@staging-server
developer@staging-server ~ $ pwd
/home/developer
Next... concerning arguments list:
Here's what we can see in the article:
-vcrz
--delete-after
--exclude-from=rsyncExclude.txt
.
developer@staging-server:public_html
there's even no "ssh" in it... I'm puzzled. Of course, it wasn't working for me. But here's an argument list that worked:
- Code: Select all
-vaurPcz
--delete-after
--exclude-from=rsyncExclude.txt
-e "ssh -i C:\Users\John\.ssh\id_rsa" developer@staging-server:public_html
./my_project_public_html/
As for "-vaurPcz" - one can find definitions of this options in rsync manual (for example, try to google "rsync samba manual" - I'm unable to post links here).
The last parameter "./my_project_public_html/" refers to the folder you're going to sync, relative to your ${build_project}
And the last thing, concerning Environment - have you mentioned "Failed to add the host to the list of known hosts (/home/John/.ssh/known_hosts)" above in my post? So, we need to define "HOME" variable in "Enviroment" tab.
- Variable = "HOME"
- Value = "/cygdrive/c/Users/John"
Here "/cygdrive/c/Users/John" stands for "C:/Users/John" . This is how you should pass a path to cwRsync 4.0.5 .... (But ssh accepts "ssh -i C:\Users\John\.ssh\id_rsa").
Hope this would help somebody.
Or even a miracle would happen and those article would get fixed...
Still, I've got two final notes:
- You may also add a second "builder" - a copy of this one, but with swapped source and target to get a two-way sync.
- rsync is designed for one-way syncing. Although there's an "-u" option (do not overwrite a newer file with older), you'll might run into problems with file deletion.
- you may try to set up "unison" or any other two-way sync tool,similarly to cwRsync. This is what I'm going to do now. I'll try to share my experience afterwards...