Deploy Symfony 1.4 on Windows using rsync (cwrsync)

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 …

  1. Fabian Potencier posted everything you need to know for ssh-configs:
  2. you need to install cwrsync
  3. Many users seems to get an error when they now try to deploy (dry-run) :
    php symfony project:deploy production
    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.
  4. 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
    echo $command
    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'));
  5. 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!
  6. 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.
  7. 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.
This entry was posted in Software Engineering and tagged , . Bookmark the permalink.

1 Response to Deploy Symfony 1.4 on Windows using rsync (cwrsync)

  1. Tomasz Lisiewicz says:

    Very good tip mate!

Leave a Reply

Your email address will not be published. Required fields are marked *