Deploy from git repository with multiple projects

68 views
Skip to first unread message

theturingmachine

unread,
Dec 10, 2009, 12:47:02 PM12/10/09
to Capistrano
i'm currently migrating a project we had on svn to git. the conversion
has been working fine but now we have to change our deploy recipes to
use git, the problem I'm having is with our current setup.

We have only one repostory where we have several apps. what we're
currently doing checking out one of the directories from the
repository and svn takes care of setting up the externals, etc. E.g

repository/
app1
app2

The first problem I'm getting is that I can't checkout just a
directory from git. No svn co repo/app1 equivalent.
The other problem is setting up the externals, since apps have svn
external references between them to share some code.

Any ideas on how could I deploy this? I'm currently thinking of
creating my own deployment strategy, where I would:
- get the whole repository.
- copy the "externals" into the app directory.
- copy that prepared directory to the current release.

Any insights into how to create my own deployment strategy or
something like that.

Greetings

Lee Hambley

unread,
Dec 10, 2009, 2:55:49 PM12/10/09
to capis...@googlegroups.com
I'm afraid this is basically impossible (the Git guys argument is that repositories are so cheap, you should not be sharing them) - they mean cheap like overhead, not like hosting charges, but its a fundamental limitation of Git that you can't easily deploy a "subdirectory" from a repository.

If you are using the :remote_cache deployment strategy, then you can use the patch for this that is in our ticket system (search "deploy subdirectory git" and you're half way there.

-- Lee Hambley

Twitter: @leehambley | @capistranorb
Blog: http://lee.hambley.name/
Working with Rails: http://is.gd/1s5W1


2009/12/10 theturingmachine <theturin...@gmail.com>

--
* You received this message because you are subscribed to the Google Groups "Capistrano" group.
* To post to this group, send email to capis...@googlegroups.com
* To unsubscribe from this group, send email to capistrano+...@googlegroups.com For more options, visit this group at http://groups.google.com/group/capistrano?hl=en

Rory Gibson

unread,
Dec 10, 2009, 2:49:18 PM12/10/09
to capis...@googlegroups.com


On 10 Dec 2009, at 17:47, theturingmachine
I've just done something very similar.

All I did was create a capistrano/modules/recipes structure alongside
my deploy.rb and copy the Copy strategy recipe sourcefile into it from
the unpacked gem.

A swift rename later and I had my own strategy, which I then
refactored and enhanced to suit my needs. As long as you get the dir
structure to match the module and class hierarchy there are no load
path hijinks required (no pun intended!)

When I get back to the office I'll paste it up if I get a chance.

Lee Hambley

unread,
Dec 10, 2009, 3:15:30 PM12/10/09
to capis...@googlegroups.com
Rory, great - I hope there's a contribution in it somewhere! It would be a real shame not to share community knowledge – there's not enough people hacking on the internals like you are doing!

Scott Johnson

unread,
Dec 11, 2009, 1:24:49 PM12/11/09
to Capistrano


On Dec 10, 9:47 am, theturingmachine <theturingmach...@gmail.com>
wrote:
> i'm currently migrating a project we had on svn to git. the conversion
> has been working fine but now we have to change our deploy recipes to
> use git, the problem I'm having is with our current setup.
>
> We have only one repostory where we have several apps. what we're
> currently doing checking out one of the directories from the
> repository and svn takes care of setting up the externals, etc. E.g
>
> repository/
>                app1
>                app2
>
> The first problem I'm getting is that I can't checkout just a
> directory from git. No svn co repo/app1 equivalent.
> The other problem is setting up the externals, since apps have svn
> external references between them to share some code.

I think there's a more fundamental issue here. This might be more work
than you want to take on, but you should really think about
restructuring these apps into independent repos. Shared code should go
into plugins or gems, each with their own repo.
Reply all
Reply to author
Forward
0 new messages