|
Time Sync and the local machine: msg#00161lang.ruby.capistrano.general
I came across this issue a couple days ago and found it interesting. Quick rundown - I develop on a Ubuntu VM inside of my windows laptop. This allows me to develop on a machine configured identically to my production Ubuntu server. The problem is that sometimes the time gets out of sync when I suspend the machine. So in some cases my Ubuntu machine can think it's 3 days ago, especially if I suspend over the weekend. Of course as Capistrano currently uses the date on the local machine, you can wind up with a release directory that's actually behind another deployment from another developer. For example - The current date is midnight 12/20/2007, and my laptop thinks it's 12/15/2007 /u/apps/sampleapp/releases/20071215000000 is where mine deployed /u/apps/sampleapp/releases/20071217000000 is where another developer deployed 3 days ago The "current" directory gets symlinked to the "20071215" directory with the up to date code, and if you run a migration it gets run on the latest directory, which in this case is set to the "20071217" directory. So now you have your mongrels running off the "20071215" directory, and the database still lacking the most recent update. Now obviously one solution is for me to sync my clock. I recognize that it's ridiculous to expect capistrano to make up for my poor "time management" But I think there's a more subtle problem here. If you're working in group where multiple people can deploy, you could still run into this issue. For example, it's not absurd to expect a one developers clock to be off my 5 minutes, and I've been in a situation where one person has deployed and minutes later I fixed an issue and redeployed. I think the best solution is to base all release directory timestamps off of the server. That completely solves the issue and to be honest it just make more sense to organize around one time standard, rather than to expect everyone to be perfectly in sync. I propose the following modification - _cset(:release_name) { Time.parse(capture('date')).utc.strftime("%Y%m %d%H%M%S") } This has solved the problem entirely for me, and now I can happily update from a laptop that think it's Dec 15, 1986, as I often do whilst traveling around in my DeLorean. Of course I'm not an expert on Capistrano, so I'd appreciate any thoughts on why this would be a good or bad change. Thanks, Mark Percival |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Interesting Error - No space: 00161, kent.langley-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx |
|---|---|
| Next by Date: | Re: Time Sync and the local machine: 00161, Jamis Buck |
| Previous by Thread: | Permissions and remote_cachei: 00161, Giovanni Intini |
| Next by Thread: | Re: Time Sync and the local machine: 00161, Jamis Buck |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |