Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm the lead developer in a team of 2. My partner has only just joined the project and despite using GIT for version control etc, we are still stuck in the dark ages when it comes to code deployment.

Currently I make all site updates via FTP (this way I have control / responsibility over everything that goes live), using Filezilla.

I've done this for years, but we now have some large PHP classes (300KB), and a lot of traffic.

So in short, every time I upload a key class "general" for example, the site goes down until the file finishes uploading. This is only 5/6 seconds at a time, but this is increasingly unacceptable.

I realise I can upload the file under a different name and then rename both files... but really there must be a better way?

I've heard about rsyncing code across from another server, but I don't see how this prevents switching to the new file whilst uploading.

We only have one server (for DB and Apache) but also use some cloud servers (for openx as an example).

share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

rsync does exactly that in the default transfer mode: it creates a new file on the destination for the duration of the transmission and renames it after the transmission completes.

Nontheless, this will not help with situations where your upload is "inconsistent" - i.e. you have uploaded files which depend on other, not yet uploaded files. If this is a concern, you would need to upload to an entirely different directory structure and switch after your entire transfer completes.

share|improve this answer
    
Thanks. What method do larger sites use? In rsync, is it possible to specify the order in which files are updated? –  Jenkz Jul 1 '11 at 7:58
    
@Jenkz I think large sites have either planned downtime or a staged release where they update half their serves, switch to them, upload the other half, and then put everything back online. –  TheLQ Jul 6 '11 at 2:15
    
Thanks for the info @TheLQ –  Jenkz Jul 7 '11 at 13:13
add comment

WinSCP has a directory "synchronization" feature that will auto-synchronize to a remote FTP server, such as Filezilla Server. Filezilla client doesn't have this feature. You can get a SFTP server in this list. If you choose the right SFTP server, then a file lock will not be held while uploading until the very last bit is transferred and the file is replaced.

Alternatively, you can keep a non-live server FTP directory that you upload to and then use another piece of local software (like WinSCP) to do a instant synchronization to the live directory on the same server. This way you avoid the file lock during the upload latency.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.