Deploying symfony 1.4 projects to the production server may be horrible if you’re on windows…
(For older versions of Symfony it’s quite the same.. but the symfony file you need to edit is a different one… check out this thread on the symfony-forums: Setting up rsync with a Windows computer). For symfony 1.3/1.4 this works:
1) Use Linux if you can!
2) On Windows you can do it with some workarounds …
- Fabian Potencier posted everything you need to know for ssh-configs: http://fabien.potencier.org/article/19/quick-ssh-tip
- you need to install cwrsync
- Many users seems to get an error when they now try to deploy (dry-run) :
this will probably fail. This seems to be an symfony-issue on the way that symfony passes the rsync-command. Workaround is to generate the command by the symfony-task, but then execute it by hand.
php symfony project:deploy production
- Open ../lib/vendor/symfony/lib/task/project/sfProjectDeployTask.class.php
on line 162 it says
$command = "rsync $dryRun $parameters -e $ssh ./ $user$host:$dir";
in the next line add
and comment the line
$this->getFilesystem()->execute($command, ...);to prevent symfony executing the command.
Finally it should look like this:
// ... $dryRun = $options['go'] ? '' : '--dry-run'; $command = "rsync $dryRun $parameters -e $ssh ./ $user$host:$dir"; echo $command; //$this->getFilesystem()->execute($command, $options['trace'] ? array($this, 'logOutput') : null, array($this, 'logErrors')); $this->clearBuffers(); //...
- Now execute
php symfony project:deploy production > deploy
This will write the (dry-run) command in a new file called “deploy”. Open it, copy&paste the command to your command line and execute it!
- Now do the same for the real command:
php symfony project:deploy production --go > deploy_go
Again copy&paste the command from the file to your command line and execute it.
- If you get permission errors check that the folder you specified in your properties.ini is writeable by the user you specified for the ssh connection.
Very good tip mate!