Deployment via Fabric

I got stuck wondering how I should set up my deployment flow to production instance on Amazon EC2. The tools are all set: Mercurial + BitBucket + Fabric. The problem happens when I try to pull from BitBucket after ssh into my deployment target environment. I logged into the target environment with non-root user (root is disabled in Ubuntu), and sudo to execute deployment command.

Deployment Flow

The pull request to BitBucket got rejected due to Permission denied as it turned out that when I sudo to run

command, it tried to ssh access to BitBucket but there’s no public key set at BitBucket side. It has only my Ubuntu login user’s, but not root’s. However, my login user doesn’t have sudo permission to locally deploy the file onto the target instance. Hm…

After a millions of tries by trying to ssh-keygen with root user, etc… I resorted to the last option of compromising permission by assigning 777 to the target directory below.

Leave a Reply

Your email address will not be published. Required fields are marked *