views:

31

answers:

1

ruby on my development machine:ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux] capistrano on my development machine: Capistrano v2.5.5 OS on development machine: ubuntu 10.04 desktop edition

server is Amazon web service instance running on ubuntu server 64 bit 10.04 ruby on server: ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux] Capistrano v2.5.5

deploy.rb: http://gist.github.com/643504

what i want to do: i want to be able to deploy on 2 different folders in /var/www in my server. 1 folder is for example.com 1 folder is for example.biz

the .biz is staging and .com is production.

i will also have 2 different databases. 1 for staging 1 for production

i want to use capistrano to deploy code on my production folder AND staging folder.

for deploying staging folder, i want to be able to 1) do a git pull at the server for the staging folder ONLY. 2) run a bash script that will restore the staging database. script is written and placed inside the staging folder.

for production folder, i just want to be able to do a git pull at the server for production folder ONLY.

IMMEDIATE issues: 1) right now as i test my code i am unable to do a git pull at the server for staging folder ONLY.

i ran this command in my devt machine.

cap staging deploy

i get prompted for a password i am not sure of.

screenshot of what i saw http://picasaweb.google.com/kimcity/Screenshots#5531588545516293762

Please help

I have tried this http://stackoverflow.com/questions/3826440/capistrano-password-prompt

and i did the following in my ~/.ssh vi config

inserted the following text

Host production
  Hostname example.com
  User username_of_server
  ForwardAgent yes

Host staging
  Hostname example.biz
  User username_of_server
  ForwardAgent yes

Host *
  ForwardAgent no

Still does not work for me.

Potential issues: 1) if i make any mistakes in my deploy.rb that may cause other issues further down the road towards what i want to achieve, please let me know.

A: 

assuming installation is not an issue etc,

assuming that you want to have the following setup,

and that you want to do it this way:

run "cap production deploy" from your laptop and have your server git pull the latest code from a public repository like github.com or projectlocker.com

the key thing is that you need to create a user account ON YOUR SERVER that is meant for deployment.

let us call this user account 'deploy' without the quotes.

1) make sure that 'deploy' has the public key of your laptop. (assuming you already have created a key pair for your laptop)

the public key of your laptop is a long sequence of text that should be in /home/deploy/.ssh/authorized_keys

create the folders or file if they do not exist.

2) check that you can ssh into the server using deploy@server from your laptop. if this works, it means that you have done 1) correctly.

3) generate keypair for 'deploy' at your server machine.

4) go to github.com or projectlocker and place the public key of the keypair in 3) over at the website.

5) go to your working folder at server. Do a git init if you did not already have a .git inside that folder. run git pull [email protected]:abc.git or whatever your git repo url is.

6) if you succeed to pull your latest code from the public repo at github or projectlocker, steps 3 and 4 were correctly done.

7) now ensure that you have the following in your deploy.rb

# set server user account responsible
set :user, "deploy"

# Deploy via a remote repository cache. In git's case, it 
# does a "git fetch" on the remote cache before moving it into place
# can change this to :copy but apparently :remote_cache is faster
set :deploy_via, :remote_cache

8) run "cap production deploy:setup" because you are going to deploy for the very first time.

9) run "cap production deploy" subsequently.

keisimone