This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » development » Miscellaneous » Setting up rsync with a Windows computer
Re: Setting up rsync with a Windows computer [message #71490 is a reply to message #32052 ] Wed, 04 February 2009 22:50 Go to previous messageGo to next message
Russpd  is currently offline Russpd
Messages: 104
Registered: September 2008
Senior Member
Cool did that...

C:\wamp\www\a>c:\wamp\bin\php\php5.2.6\php.exe symfony sync production
rsync --progress --dry-run -azC --force --delete --exclude-from=config/rsync_exc
lude.txt -e "ssh -p8888" ./ tzanalytic@rome.medialayer.net:/home/domains/scribni
a.com/scribnia2/>> exec rsync --progress --dry-run -azC...domains/scribnia.
com/scribnia2/

This is the message that i get...it just hangs now and doesn't ask me for a password or shows any files being moved. I don't think the problem is an incorrect path in my hostname as I was definitely putting in incorrect path names in the past and it was going through (albeit generating permission errors). Does anything look wrong here. I can snapshoot the CLI if it is hard to get a sense of a spacing error based on this cut and paste.
Re: Setting up rsync with a Windows computer [message #71491 is a reply to message #71490 ] Wed, 04 February 2009 23:00 Go to previous messageGo to next message
robh  is currently offline robh
Messages: 16
Registered: July 2008
Junior Member
You should get the "ssh" part to work first. Try cutting only the ssh part and paste it back into your command window.

ssh -p8888 tzanalytic@rome.medialayer.net

It's probably going to ask you for a password. If it does, then that is what is causing it to hang. Look higher in this thread to see how to set up a public-key sign in for ssh.
Re: Setting up rsync with a Windows computer [message #71494 is a reply to message #71491 ] Thu, 05 February 2009 01:11 Go to previous messageGo to next message
Russpd  is currently offline Russpd
Messages: 104
Registered: September 2008
Senior Member
Robh

Thanks so much, that was spot on. It did ask me for my password and I was able to login through CLI. However, I am having a bit of a problem setting up the public_key. I had two theories why things might not be working and I was curious to hear your thoughts.
1.) My .ssh folder is not stored in the right location. When i enter my host, I see two domains. There is only one .ssh folder and it is in one of the domains with the file authorized_keys. The folder is at the same level as the web root and my project and is technically /home/domains/site.com/.ssh. Should I try and move the folder to /home/.ssh/ or is that not the problem.
2.) Since I have a custom port for ssh should I be entering that or should I use port 22. There are two times when I have to specify port (the first in the putty settings and the second in properties.ini). I tried both 8888 and 22 and couldn't get it to work but I thought I might have missed something.

I wish there was a way to test whether I can login with the public key. Unfortunately, when I try and follow the directions laid out in the tutorial you posted I get the message local to local copy not supported. I googled that and it didn't become much clearer. Any idea what I could be doing wrong?

Thanks for the help, I appreciate it.
Re: Setting up rsync with a Windows computer [message #71549 is a reply to message #71494 ] Thu, 05 February 2009 15:01 Go to previous messageGo to next message
robh  is currently offline robh
Messages: 16
Registered: July 2008
Junior Member
The tutorial at http://www.ualberta.ca/CNS/RESEARCH/LinuxClusters/pka-putty. html is very good, but you need to follow each and every step carefully. (Try printing it out so you don't have to follow the directions on-screen)

Your ".ssh" folder should be in YOUR home directory. Whenever you normally log into your account with PuTTY (using a password), your home directory will be the present working directory. Type 'pwd' to see what that is.

Right after you log in (using a password), if you type "ls -a" you should see ".ssh" as a directory. You most likely don't even have access to put a directory at "/home/.ssh".

2) If you have a custom ssh port, then you will need to specify this everywhere. You previous command line showed that "-p8888" command in the correct location.
Re: Setting up rsync with a Windows computer [message #71598 is a reply to message #32052 ] Fri, 06 February 2009 00:39 Go to previous messageGo to next message
Russpd  is currently offline Russpd
Messages: 104
Registered: September 2008
Senior Member
Robh

Thanks SO much for the help thus far...I feel like I am close to getting this sync set up and I know it will be worth the trouble because it seems so helpful. Just wanted to thank you for giving me advice.

So I put the .ssh folder in the home directory as you indicated and added authorized_keys to it. I followed the instructions from the link word for word. The only change that I did make was that I copied and pasted the key manually into the authorized_keys file rather than by command line.

The step that I am a bit confused about is at the end. In my Command Prompt I type (I assume I don't have to cd to any folder to do this) >"path/to/pscp.exe" source.f "path/to/key.ppk" source.f username@rome.medialayer.net:

When I do that, I get an error saying that source.f is not a file or directory. If I try other commands like
>"path/to/pscp.exe" -l "path/to/key.ppk" source.f username@rome.medialayer.net:
I get a printout of various comamnds you can do but it remains unclear how I can connect to the remote host.

When I use the command line to try to connect via symfony it still hangs unfortunately. Sorry to make you go through such a hassle and I really appreciate the help
Re: Setting up rsync with a Windows computer [message #71708 is a reply to message #71598 ] Sat, 07 February 2009 03:15 Go to previous messageGo to next message
Russpd  is currently offline Russpd
Messages: 104
Registered: September 2008
Senior Member
So I solved my symfony prolem. It turns out that symfony 1.0.17 has the issue where you need to cut and paste the command. I added die("cmd = $cmd\n"); at the end of the sfPakeEnvironment file and got the command, entered it, and it worked. This method was the same used by some poster up top and for the life of me I can't understand why it worked then but not now. But I'm glad I got it solved, I really like the speed of rsync it reminds me a ton of Git which i use and love.

Quick problem, though, I am getting a 404 error when I browse to my page after deploying with rsync. I thought it might be because I was overwriting my symfony folders and hadn't frozen beforehand but I tried again on another app and this time put lib/symfony and data/symfony in my exclude_rsync file and got the same result. Its not a clear cache error either becuase I checked that. Anyone have any idea what happened? Thanks guys
Re: Setting up rsync with a Windows computer [message #71728 is a reply to message #71708 ] Sat, 07 February 2009 14:57 Go to previous messageGo to next message
robh  is currently offline robh
Messages: 16
Registered: July 2008
Junior Member
Your latest "404 problem" is most likely a permissions error problem. After you perform a transfer, try the following on the destination server.

In Symfony 1.2...
php symfony project:permissions
chmod -R 755 web

In Symfony 1.0...
php symfony fix-perms
chmod -R 755 web

I've had some luck with the following parameter string in properties.ini, but new files still tend to be read-only (700) on the destination.
# in the rsync section of properties.ini
parameters="-rtgoDzC --force --delete --exclude-from=config/rsync_exclude.txt"
Re: Setting up rsync with a Windows computer [message #71749 is a reply to message #32052 ] Sat, 07 February 2009 20:20 Go to previous messageGo to next message
Russpd  is currently offline Russpd
Messages: 104
Registered: September 2008
Senior Member
Awesome thanks so much for the help. It was a fix permission error and I am glad to get that squared away. I haven't yet experimented with the code to put into the properties.ini but our of curiosity what does that tell the remote host to do? To keep the file permissions of the existing files?
Re: Setting up rsync with a Windows computer [message #71755 is a reply to message #71749 ] Sat, 07 February 2009 22:04 Go to previous messageGo to next message
robh  is currently offline robh
Messages: 16
Registered: July 2008
Junior Member
parameters="-rtgoDzC --force --delete --exclude-from=config/rsync_exclude.txt"

explanation:
-r = recursive
-t = preserve times
-g = preserve group
-o = preserve owner
-D = preserve device and special files
-z = compress
-C = auto-ignore files the same way CVS does

--force = force deletion of directories even if not empty
--delete = delete extraneous files from destination dirs
--exclude-from = read exclude patterns from files.

The only problem that I still have is that "new" files don't get the correct permissions on the destination. That is why I always go to the destination server and do a "chmod -R 755 web".
Re: Setting up rsync with a Windows computer [message #71810 is a reply to message #32052 ] Sun, 08 February 2009 17:26 Go to previous messageGo to next message
Russpd  is currently offline Russpd
Messages: 104
Registered: September 2008
Senior Member
Awesome Robh thanks for making that clear. I really appreciate the help and I am sure a lot of people have the same trouble with rsync so hopefully this helps them as well. Thanks so much once again, its sooo nice to never have to remember which files to FTP again.
Re: Setting up rsync with a Windows computer [message #72048 is a reply to message #71810 ] Tue, 10 February 2009 18:35 Go to previous messageGo to next message
Russpd  is currently offline Russpd
Messages: 104
Registered: September 2008
Senior Member
Follow up Rsync

I noticed a few issues with rsync that I couldn't find answers to in the forum.

1.) I want rsync to ignore the config folder but not the apps/frontend/config folder. In my rsync_exclude file I simply put config, following the protocol in some of the tutorials I saw online. However, this tells the server to ignore any folder called config
2.) Unfortunately the parameters inside the properties folder didn't stop me from getting permission problems. It is not the end of the world and certainly beats FTPing but if Robh or anyone else had any other solutions that would be much appreciated.

Thanks so much.
Re: Setting up rsync with a Windows computer [message #72052 is a reply to message #72048 ] Tue, 10 February 2009 18:44 Go to previous messageGo to next message
robh  is currently offline robh
Messages: 16
Registered: July 2008
Junior Member
1) To skip the only the top-level config folder, put "/config/*" in your rsync_exclude.txt file.

**HOWEVER** -- symfony uses the "config" folder items to execute. If you're not going to copy it everytime, you will still need to have this folder on the destination server.

2) Permissions is still a problem for me as well. Maybe someone else will have some insight here.
Re: Setting up rsync with a Windows computer [message #72058 is a reply to message #32052 ] Tue, 10 February 2009 19:48 Go to previous messageGo to next message
Raise  is currently offline Raise
Messages: 20
Registered: August 2006
Location: UK
Junior Member
RE permissions, I have this shell script in the root dir of each of my symfony (1.0) projects:

fix-prod-perms:
#!/bin/sh

#the production application's home
APP_HOME=/home/example/symfony_site

#set permissions on the app
chown -R example:example $APP_HOME
chmod -R 775 $APP_HOME
#chmod -R 777 $APP_HOME/data/index

#help symfony out with perms and cache
$APP_HOME/symfony fix-perms
$APP_HOME/symfony cc
#$APP_HOME/symfony lucene-rebuild frontend


After I use 'symfony sync production go' from the dev environment, I run the script via ssh with './fix-prod-perms' or such.

It's not pretty, but it does the job. Given most changes to production sites require a call to clear the cache (symfony cc), I'd always find myself running *some* kind of server-side command, and this just bundles them all - including optional sfLucene calls if something has changed in the index.

Someone might find ways to optimise this shell script - I've never looked to improve it since I wrote it in a hurry 2 years ago! Smile
Re: Setting up rsync with a Windows computer [message #83159 is a reply to message #32052 ] Tue, 04 August 2009 15:03 Go to previous message
stormsson  is currently offline stormsson
Messages: 211
Registered: April 2009
Faithful Member
i bump this post to write some info that could be useful to someone, since i lost 2 hours on making it work...

after making the previosly written changes
(
- ssh and other stuff into windows dir , ugly solution but quick
- creation of the public/private key coupling
- .ssh/authorized_keys editing
etc
)

if you get an error stating that your private key has too open permissions, you can solve it by

1) opening folder settings in your explorer window
2) de-check "Use Simple File Sharing (Recommended)"
3) removing all inherited settings from advanced buttom
(this should remove all users)
4) add the user like your-pc/username
5) grant him only write and read permission.
6) hope that this is enough

mostly 6 though.

[Updated on: Tue, 04 August 2009 15:04]

Previous Topic:Job Opportunies for Symfony Developers
Next Topic:Looking for sf developers to create a start-up with
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software