1

I'm reading the capistrano tutorial: https://github.com/capistrano/capistrano/wiki/2.x-From-The-Beginning

Where do you set the i.p address of the server to push the code to?

Does it assume you have an SSH key setup?

What if you have 10 servers, is it best to use a different tool to mirror things?

Blankman
  • 259,732
  • 324
  • 769
  • 1,199

3 Answers3

1

Capistrano isn't responsible for pushing code (in the sense of pushing changes to SCM) you still do this with Git, or your other choice of SCM.

Capistrano by default will log onto the servers named in your "roles" and pull the code down from your source control, to each server individually.

If you have 10 servers, and they are all web servers, you would name them all in the web role in Capistrano.

There are excellent Github guides for more information, but in short, yes; it's expected that you have ssh keys setup for a) logging on to the servers as your deploy user, and b) for your server to reach the source control (often referred to as deploy keys.)

@Arthur's suggestion about capistrano multistage is useful only when deploying to multiple environments, such as "staging" and "production" where the procedure is the same, but the server list is different.

Lee Hambley
  • 6,270
  • 5
  • 49
  • 81
1

In your config/deploy.rb or Capfile, just set the "web" role to the IP Address you require as follows:

role :web, "1.2.3.4", "5.6.7.8"

As mentioned by others, you will need to setup SSH keys (unless you really like typing passwords!) and then when you type cap deploy it will (depending on your settings) either checkout the git repo, tarball it and scp the tarball to the server (:deploy_via :copy or :deploy_via :export) or ssh to the server and check out the git repo directly (the default behaviour).

-2

Take a look at capistrano multistage extension. Works well with multiple servers. You would then define different stages (or servers) in separate files and then deploy to each one by specifying the stage (and you may have a default stage to deploy to).

Arthur Frankel
  • 4,695
  • 6
  • 35
  • 56
  • This answer doesn't help the OP at all. – Lee Hambley Jul 14 '11 at 09:05
  • Agreed that I misread his question a bit and didn't answer the SSH part, but if he wants any difference in his deployment to the 10 servers (either RAILS_ENV, or other system wide settings) using the multistage extension would be useful. In your comment starting "@Arthur's suggestion...where the procedure is the same" I think that's what he wants, but in addition the procedure can be different based on stage/server. – Arthur Frankel Jul 14 '11 at 12:47