Tuesday, November 16, 2010

Gotcha of the Day: Getting sitecopy to behave with ssh

Earlier today, I spent a bunch of time configuring sitecopy to deploy files over ssh on Windows using cygwin.

My key takeaways were:

  • One would think protocol sftp would work - but alas, this always seems to hang on my cygwin environment. I added some printf's to the source code and confirmed that sitecopy is hanging on a read. I'm thinking this might be related to some kind of limitation with Cygwin, but what it is exactly is beyond me. protocol ssh works well.
  • Sitecopy will inherit the ssh-agent in shell you run it from. This means you don't have to bother entering your password with every deployment.
  • The Big Gotcha for me was that files failed to copy, and reported just a vague error. The problem was that I had:
        remote /public_html
    which in an FTP or WebDAV context is interpreted as a relative path off of the home directory you log into. In ssh mode, files were attempting to get written to: /public_html/php - no wonder they were failing. I changed this to:
        remote /home/webuser/public_html
    and I was back in business.
  • Open Source rocks. Rocks I say. Because I had the source code for sitecopy I could crack it open, add debugging code, and really see what the heck was going on. If this was a closed source app, I would have had to guess and depend on the vendor alone.

Figuring the ssh protocol out is key, as now sites that have ssh/sftp access only can be deployed to just as easily as those with traditional FTP.

No comments:

Post a Comment