Showing posts with label capistrano. Show all posts
Showing posts with label capistrano. Show all posts

Friday, September 12, 2008

Capistrano + Git: fatal: 'origin': unable to chdir or not a git archive

Getting that error?

Short answer: you fucked up, then Capistrano fucked up right behind you.

SSH into your deploy target, go into shared, and then frag the shared_cache directory.

Then, cap deploy:cold.

Why?

It normally happens when you try to set your repository as a local filesystem path. Capistrano populates shared_cache with an empty Git repo, and then tries to pull in your repository, which it can't reach... but it doesn't frag shared_cache, so the next time Capistrano looks, it's there, and goes, "Hey, we've already built the repository cache, let's just call git fetch and update it!"

Good luck.

Capistrano + Git: Host key verification failed.

Getting 'Host Key verification' failed when you're trying to do this? You might be trying to deploy source in a Git repo, and the Git repo is accessed via SSH.

cap deploy:cold


Do this: ssh into your target machine (the one codes getting deployed on), and then ssh into the Git repo machine -- or just do a 'git clone' if that's not possible. Accept the key, and then you're golden.

Deploying Git over SSH (username, password) with Capistrano

This one bit me.

Hard.

If your Git repo is accessed via SSH using a username and password instead of a public key, you're probably having problems getting it to work. Notably, the password prompt isn't prompting you for your goddamn password.

Do this in your deploy file:

default_run_options[:pty] = true
set :scm_password, Proc.new { Capistrano::CLI.password_prompt "SCM Password: "}


Using Capistrano 2.5.

default_run_topions[:pty] will fuck up your output, but it's necessary for reasons I don't fully grasp and after about 3 hours don't care to.

Thursday, October 11, 2007

My first public Rails site!

It's been awhile since I blogged about anything technical, so I thought I'd talk about a site I just prototyped.

It's a Rails-driven site. Top to bottom, its a pretty simple design, but I went through a lot (a LOT) of iterations before I found a design (front/back) that I found acceptable. Thankfully, Rails made this very easy. Ruby is as straight-forward as it can get, and so is the Rails framework. C#/ASP.NET feels a little wooden and artificial now, in comparison.

Speaking of C#/ASP.NET, I didn't really miss it when developing FearlessBlogging. I didn't have a moment where I thought "damn it, this would be easier in C#" or, "How come ASP.NET provides this but Rails doesn't?!"

Then again, the site I ended up deploying as pretty simple. I cut back on a lot of cool-sounding features that really weren't all that useful.

Oh, man, deployment was FUN.

Learning Capistrano before-hand was not. There seriously, seriously needs to be an updated Capistrano 2.0 tutorial for Rails.

I managed to hodge-podge it together from a bunch of incomplete Capistrano 2.0 blog posts and inferring some stuff from Capistrano 1.x, but still, was not the most pleasant of experiences.

After I got everything setup and stuff I could deploy the site with just a "cap deploy:cold" and it worked like a dream. I've updated the site several times since then and its always gone flawlessly. Using XP Pro, SP2, and no bugs reared up, so that was a relief.

Other than that, great experience: A++++, would work with again!

Yeah, I'm a dork.