Deploying Symfony Projekt using Rsync in Windows 7 - Permission Problem
I am desperetly trying to deploy my Symfony app with Rsync.
I instally cwRsync and it somewhat works, at least SSH does. My app is located in E:\xampp\htdocs\MyProject.
Rsync actually does create one directory on my Server but other than that, I only get permission errors.
Now, this seems to be a common problem, however I am not able to implement any solutions, such as this one: cwRsync ignores "nontsec" on Windows 7
I installed cwRsync to the following directory: c:\cwrsync
My Question: what does my fstab file need to look like, and where do I even have to put it? Are there any oth开发者_StackOverflower solutions to this problem?
Thanks in advance!
I'd posted that question you referred to. Here's what I ended up doing to get symfony project:deploy
to work from Windows 7 (it required hacking symfony a bit, so it may not be the most optimal solution). With this solution, you don't need fullblown cygwin installed, you just need cwRsync.
In your fstab
, add this line (fstab should be located under [cwrsync install dir]\etc
):
C:/wamp/www /www ntfs binary,noacl 0 0
This essentially maps "C:\wamp\www" on your windows filesystem to "/www" for cygwin.
Modify symfony/lib/task/sfProjectDeployTask.class.php
:
protected function execute($arguments = array(), $options = array())
{
...
$dryRun = $options['go'] ? '' : '--dry-run';
// -- start hack --
if(isset($properties['src']))
$src = $properties['src'];
else
$src = './';
$command = "rsync $dryRun $parameters -e $ssh $src $user$host:$dir";
// -- end hack --
$this->getFilesystem()->execute($command, $options['trace'] ? array($this, 'logOutput') : null, array($this, 'logErrors'));
$this->clearBuffers();
}
This allows you to specify an additional src
field in properties.ini
:
src=/www/myProject
Doing this makes the whole filesystem mapping between windows and cygwin much more clearly defined. Cygwin (and cwRsync) understand unix paths much better than windows paths (i.e. /www
vs. C:/wamp/www
), so doing this makes everything just work.
Run a Script
I think Rsync always breaks your file permissions during sync between Windows and Linux.
You can quite easily create a script that goes through your file after a sync and resets the file permissions using chmod though.
精彩评论