Basics of Capistrano

I’m searching the net but about Capistrano, but can’t get a complete
understanding. Could someone please give me some small hints :slight_smile:

I have local developer environment, using git. The remote server also
has git and I have the app in root. Today I use ftp. What should I do
when I just want to send the files that are different, letting my local
app decide that, and how does the deploy.rb look like?

On Jul 15, 12:14 am, Pål Bergström [email protected]
wrote:

I’m searching the net but about Capistrano, but can’t get a complete
understanding. Could someone please give me some small hints :slight_smile:

I have local developer environment, using git. The remote server also
has git and I have the app in root. Today I use ftp. What should I do
when I just want to send the files that are different, letting my local
app decide that, and how does the deploy.rb look like?

First link should be fine.

Eric wrote:

On Jul 15, 12:14�am, P�l Bergstr�m [email protected]
wrote:

I’m searching the net but about Capistrano, but can’t get a complete
understanding. Could someone please give me some small hints :slight_smile:

I have local developer environment, using git. The remote server also
has git and I have the app in root. Today I use ftp. What should I do
when I just want to send the files that are different, letting my local
app decide that, and how does the deploy.rb look like?

Google

First link should be fine.

Great. I use site5. But what I don’t understand; is the git repository
the same as the app directory (the article is about svn)? This would
help me a lot to understand.

Pål Bergström wrote:
[…]

But one thing I need to understand. What about git? Does that has
anything to with it?

Yes, absolutely. The way most people use Capistrano, the server checks
out the code from the Git repository.

It states that nothing has to be done on the server
side, so I guess can skip git there and use it only locally. Is that
correct?

I think there may be a way to set Capistrano to do that, but it’s
probably not a great idea. Nothing needs to be done on the server side
in the sense that you don’t install Cap on the server, but the server
does need the tools that Cap is going to try to call.

Basically, Cap logs into the server and runs a particular sequence of
commands on the server. Thus, if Cap runs “git pull” on the server, the
server will need Git installed for the command to have any effect.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

This is a great tutorial.

http://www.softiesonrails.com/2007/4/5/the-absolute-moron-s-guide-to-capistrano

But one thing I need to understand. What about git? Does that has
anything to with it? It states that nothing has to be done on the server
side, so I guess can skip git there and use it only locally. Is that
correct?

Marnen Laibow-Koser wrote:

Basically, Cap logs into the server and runs a particular sequence of
commands on the server. Thus, if Cap runs “git pull” on the server, the
server will need Git installed for the command to have any effect.

I see. Git is installed on the server.

Should I make the app directory on the server a git repository too? Or
will Capistrano fix that. So probably a stupid question, but is the app
directory on the server the same as the git repository?

And what happens with the db? Do I need to specify that or does it use
the values from database.yml? Can I skip the db if I want?

Pål Bergström wrote:

Marnen Laibow-Koser wrote:

Basically, Cap logs into the server and runs a particular sequence of
commands on the server. Thus, if Cap runs “git pull” on the server, the
server will need Git installed for the command to have any effect.

I see. Git is installed on the server.

Great!

Should I make the app directory on the server a git repository too? Or
will Capistrano fix that.

Capistrano will take care of checking out the app from the repository
and doing what it needs to do. You don’t need to worry about it.

So probably a stupid question, but is the app
directory on the server the same as the git repository?

Generally not. Capistrano will check out a working cooy to run on the
server. You probably could run the app right from the repository, but I
see no advantage and many potential problems in doing so.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Pål Bergström wrote:

Marnen Laibow-Koser wrote:

Pål Bergström wrote:

Generally not. Capistrano will check out a working cooy to run on the
server. You probably could run the app right from the repository, but I
see no advantage and many potential problems in doing so.

And now I’m lost. What’s the repository for on the server?

The repository is a central place to store your Git data for your
project. This is a Git concept (actually, it’s a general version
control concept).

And how is
that connected to the particular app root (I’m adding several domains
and apps under one main domain)?

It’s not connected in any particular way. The repository has to do only
with source control, and does not know anything directly about
deployment.

When I use git locally, it’s the same. I think. I only use git for
version control and using the branch command for testing new things. The
important thing for me is the local version.

That’s right. And likewise on the server: Capistrano will check out a
local copy from the repository to be the actual running app instance.

The server is just to be a
mirror of that.

That’s a very simplistic way of looking at it. I’d say more that your
local copy is a mirror of the server.

Really, what’s the problem here? There is a repository. From it, you
check out copies for development, and Capistrano checks out copies (in
the same way) for deployment. How much simpler can it get? :slight_smile:

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Marnen Laibow-Koser wrote:

Really, what’s the problem here? There is a repository. From it, you
check out copies for development, and Capistrano checks out copies (in
the same way) for deployment. How much simpler can it get? :slight_smile:

A good question. :slight_smile:

I guess I have problem understanding the basic principle.

For example, when I make a pointer at the server admin, where do I make
that? There must be a root somewhere.

Marnen Laibow-Koser wrote:

Pål Bergström wrote:

Generally not. Capistrano will check out a working cooy to run on the
server. You probably could run the app right from the repository, but I
see no advantage and many potential problems in doing so.

And now I’m lost. What’s the repository for on the server? And how is
that connected to the particular app root (I’m adding several domains
and apps under one main domain)?

When I use git locally, it’s the same. I think. I only use git for
version control and using the branch command for testing new things. The
important thing for me is the local version. The server is just to be a
mirror of that.

Pål Bergström wrote:
[…]

For example, when I make a pointer at the server admin, where do I make
that? There must be a root somewhere.

Huh? What are you talking about here? I don’t think I understand what
you’re asking, and I certainly don’t understand how it relates to the
issue at hand. Rephrase?

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Pål Bergström wrote:
[…]

I can host several apps and domains under one main account. As they use
the same server, same dns, you have to point each domain to the app root
it belongs to.

Right. But setting up vhost root directory mappings is outside of the
scope of a typical Cap setup – for one thing, you’ll only have to do it
once per vhost, not every time you update the codebase. So how is this
related to your Capistrano questions?

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Marnen Laibow-Koser wrote:

Pål Bergström wrote:
[…]

For example, when I make a pointer at the server admin, where do I make
that? There must be a root somewhere.

Huh? What are you talking about here? I don’t think I understand what
you’re asking, and I certainly don’t understand how it relates to the
issue at hand. Rephrase?

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

I can host several apps and domains under one main account. As they use
the same server, same dns, you have to point each domain to the app root
it belongs to.

Btw, I’m not interested of version control on the server side. I use git
locally, but not extensively as I don’t need it that much, and want to
use Capistrano to deploy the app. Can this be done?

Pål Bergström wrote:

Btw, I’m not interested of version control on the server side.

Maybe, but pulling from Git is the simplest way for the server to get
the code.

I use git
locally, but not extensively as I don’t need it that much,

What do you mean, you “don’t need it that much”? Any development
operation – even a solo hobby developer – benefits from comprehensive
version control.

and want to
use Capistrano to deploy the app. Can this be done?

Yes. And I’ve been explaining how. Try it!

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Marnen Laibow-Koser wrote:

What do you mean, you “don’t need it that much”? Any development
operation – even a solo hobby developer – benefits from comprehensive
version control.

I’ve manage without it for a very long time. And I’m not a hobby
developer. :slight_smile:

Marnen Laibow-Koser wrote:

Pål Bergström wrote:
[…]

I’ve manage without it for a very long time.

Then you are making life hard for yourself. Trust me on this.

Not really. And I have a long experience. What I like about git is
branching. But for actual version control I can manage without it. I’ve
used git for a while now and I’ve never needed to use it for going back
in code. Trust me. :slight_smile:

Getting back to the topic, do you understand now how to get Cap
deployment working? It’s really not terribly difficult if you trust
Capistrano to do the right thing in most cases.

Not quite. I don’t think is that clear. And maybe that’s why a few
people have had a hard time getting into it. Often developers, or
programmers that is, have a hard time explaining things.

And sometimes we users are just thick headed. :slight_smile:

So back to my question, what if I, as I would like that way, have zero
and nada interest of having version control on the server side?

You can still use Capistrano to push the code from your local
directory where you are working(Like your rails root). But the main
great reason to use Capistrano is to get version deployments so that
you can roll-back if something happens to “fail” in production or
pushing to a staging environment with one tag/branch from cvs/
subversion/git then pushing the same code to production when you know
this code is good.

You can just put your own tasks in the cap scripts but this is going
to be a advanced setup. I have done something similar for a none Rails
project but it would be a custom setup for sure…

I would say that your life with Capistrano would just be SOO much
easier if you use something like git/svn…

On Jul 15, 1:46 pm, Pål Bergström [email protected]

Pål Bergström wrote:
[…]

I’ve manage without it for a very long time.

Then you are making life hard for yourself. Trust me on this.

(I used to work without version control too, a long time ago. I’d never
ever do that again.)

And I’m not a hobby
developer. :slight_smile:

I didn’t say you were.

Getting back to the topic, do you understand now how to get Cap
deployment working? It’s really not terribly difficult if you trust
Capistrano to do the right thing in most cases.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]