Live data from Hacker News

Ask YC: How do you upload to your web server?

news.ycombinator.com

11–20 of 49 posts

Re: Ask YC: How do you upload to your web server?

#11
I took a page from Rails and Capistrano deployment, and like the idea of versioning releases and using symbolic links. In essence, you update the latest code out of your source control system into /myapp/source, then you run a build and installation script which installs the latest copy of your code to /myapp/release-2008-05-22-114500 (timestamp), then makes a symbolic link from /myapp/current to the right version of the code. That way, if you release something broken, you can trivially roll back to a previous version. (It obviously doesn't always work for things like database schema changes.)

Re: Ask YC: How do you upload to your web server?

#12

Are you using a repository to store your code? If so, you can check it out from the server and then copy it over.

Yes. I am using SVN to collaborate with my friends. How do you copy easily?

I'd recommend that you look into SVN export command

Re: Ask YC: How do you upload to your web server?

#13
post #9

Use SVN and setup a postcommit thingy that copies the new files to your public directory whenever you do an update.

You'll have a problem if updates involve more than code changes. Any database scripts or configuration changes will be left undone, potentially breaking the site.

You may choose to use a tool to run your update scripts automatically and create configuration files correctly, but you'll want to think it through in advance. A particular problem I have is that certain sensitive passwords should not exist anywhere but in the locations they are required, so even pre-created configuration files still require me to manually enter the password once installed on the server.

Re: Ask YC: How do you upload to your web server?

#14
My webserver runs Puppet and periodically pulls both the code and its own configuration from my Git repository (which I'm currently hosting on Github, but I may someday self-host).

Yes, I'm going against the grain by using Puppet instead of Capistrano. All the Rails people are probably going to crucify me, but I personally think this setup works quite well.

Re: Ask YC: How do you upload to your web server?

#15
This is one way to do it on Windows.

Use WinKey to map win-P to project.bat.

project.bat: rsync -Crltvz -e ssh /cygdrive/c/personal/project/ me@mydomain.com:/bigfiles/project

then I can just hit win-P to force the rsync. Runs in a couple seconds even with hundreds of files.

But my favorite if I don't need version control is to use http://www.sftpdrive.com/">sftpdrive to mount the remote server as a local disk. It is $39, but is probably my favorite windows software. I've done the Samba thing and like this much better.

Re: Ask YC: How do you upload to your web server?

#17

Git or SVN using Capistrano. If you're deploying code, you really should be using Capistrano. Even if it is not a Rails project. It is a world of difference.

I use Capistrano and am quite happy with it, but even if you don't go that way, seriously look into some kind of deployment management software. Versioned deployments, simple and automatic rollbacks if something fails, and the ability to easy scale up deployments if you wind up breaking out into multiple servers for app/db/web.

It turns updating your server from a mild headache to one line that you actually enjoy typing in.

Post reply on HN