Tatva-Artha

meaning of "it"

Archive for the ‘capistrano’ tag

Deploy at will!

without comments

Shamelessly copying one point from a github blog. It is that good.

Deploy at Will!

At the first RailsConf I had the pleasure of hearing Martin Fowler deliver an amazing keynote. He made some apt metaphors regarding agile development that I will now paraphrase and mangle.

Imagine you’re tasked with building a computer controlled gun that can accurately hit a target about 50 meters distant. That is the only requirement. One way to do this is to build a complex machine that measures every possible variable (wind, elevation, temperature, etc.) before the shot and then takes aim and shoots. Another approach is to build a simple machine that fires rapidly and can detect where each shot hits. It then uses this information to adjust the aim of the next shot, quickly homing in on the target a little at a time.

The difference between these two approaches is to realize that bullets are cheap. By the time the former group has perfected their wind detection instrument, you’ll have finished your simple weapon and already hit the target.

In the world of web development, the target is your ideal offering, the bullets are your site deploys, and your customers provide the feedback mechanism. The first year of a web offering is a magical one. Your customers are most likely early adopters and love to see new features roll out every few weeks. If this results in a little bit of downtime, they’ll easily forgive you, as long as those features are sweet. In the early days of GitHub, we’d deploy up to ten times in one afternoon, always inching closer to that target.

Make good use of that first year, because once the big important customers start rolling in, you have to be a lot more careful about hitting one of them with a stray bullet. Later in the game, downtime and botched deploys are money lost and you have to rely more on building instruments to predict where you should aim.

Written by Sharad

April 6th, 2011 at 9:03 pm

Posted in All

Tagged with , , ,

Capistrano: Uploading file with different owner

without comments

Normally when working with capistrano, you choose to execute your commands on remote machine with a root user or non-root user. For root level activity, you don’t actually use “root” account but instead provide a “deploy” user “sudo” privileges and then leverage capistrano’s “use_sudo => true” option.

This still leaves you out in cold when you want to transfer a file and put it in a directory where your sudo user doesn’t have permission. In theory, what this needs is transferring/uploading/scp/sftp-ing that file to a /tmp and then using “sudo mv old_location new_location” to accomplish the task.

I ended up writing a utility method to do this but kept wondering that the need is so common that an inbuilt (and better) utility should exist. And then I found std.su_put.

Written by admin

May 19th, 2009 at 4:33 pm

Posted in All

Tagged with , , ,