How to deploy using Git repo that has multiple projects inside folders in a single repo?


#1

Hi chef fellas!
I’ve a private repo at github and it has multiple projects in that single repo.
e.g

/shared/microlabs (root of the git repo mirrored using git from github)

Following are the 2 projects inside the microlabs1-subdir

/shared/microlabs/microlabs1-subdir/drupal
/shared/microlabs/microlabs1-subdir/radiant

I got to install those 2 projects and I’m trying to follow the opscode’s standard application and database recipes.

Following is the snippet default of the php application recipe.

deploy_revision app['id'] do
  revision app['revision'][node.chef_environment]
  repository app['repository']
  user app['owner']
  group app['group']
  deploy_to app['deploy_to']
  action app['force'][node.chef_environment] ? :force_deploy : :deploy
  ssh_wrapper "#{app['deploy_to']}/deploy-ssh-wrapper" if app['deploy_key']
  shallow_clone true
  purge_before_symlink([])
  create_dirs_before_symlink([])
  symlinks({})
  symlink_before_migrate({
    local_settings_file_name => local_settings_full_path
  })
end

By default, it will assume the checked-out repo dir as the source. And in my case, its below 2 dirs from the root of the git repo.

But I couldn’t find any params that configures/tells to use the inner folder of the root repo?

How to deal with this?


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.tumblr.com
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


#2

You may need to write some custom code to work around this but this might
be a good time to revisit the decision to store two separate projects in
the same github repo.

If you really need these in the same repo, using git submodules might make
more sense.

On Sun, Jan 29, 2012 at 2:07 AM, Sachin Sagar Rai millisami@gmail.comwrote:

Hi chef fellas!
I’ve a private repo at github and it has multiple projects in that single
repo.
e.g

/shared/microlabs (root of the git repo mirrored using git from github)

Following are the 2 projects inside the microlabs1-subdir

/shared/microlabs/microlabs1-subdir/drupal
/shared/microlabs/microlabs1-subdir/radiant

I got to install those 2 projects and I’m trying to follow the opscode’s
standard application and database recipes.

Following is the snippet default of the php application recipe.

deploy_revision app['id'] do
  revision app['revision'][node.chef_environment]
  repository app['repository']
  user app['owner']
  group app['group']
  deploy_to app['deploy_to']
  action app['force'][node.chef_environment] ? :force_deploy : :deploy
  ssh_wrapper "#{app['deploy_to']}/deploy-ssh-wrapper" if

app[‘deploy_key’]
shallow_clone true
purge_before_symlink([])
create_dirs_before_symlink([])
symlinks({})
symlink_before_migrate({
local_settings_file_name => local_settings_full_path
})
end

By default, it will assume the checked-out repo dir as the source. And in
my case, its below 2 dirs from the root of the git repo.

But I couldn’t find any params that configures/tells to use the inner
folder of the root repo?

How to deal with this?


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.tumblr.com
Sent with Sparrow http://www.sparrowmailapp.com/?sig


#3

I’ll try this.


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.tumblr.com
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Sunday, January 29, 2012 at 11:03 PM, Nathen Harvey wrote:

You may need to write some custom code to work around this but this might be a good time to revisit the decision to store two separate projects in the same github repo.

If you really need these in the same repo, using git submodules might make more sense.

On Sun, Jan 29, 2012 at 2:07 AM, Sachin Sagar Rai <millisami@gmail.com (mailto:millisami@gmail.com)> wrote:

Hi chef fellas!
I’ve a private repo at github and it has multiple projects in that single repo.
e.g

/shared/microlabs (root of the git repo mirrored using git from github) 

Following are the 2 projects inside the microlabs1-subdir

/shared/microlabs/microlabs1-subdir/drupal
/shared/microlabs/microlabs1-subdir/radiant

I got to install those 2 projects and I’m trying to follow the opscode’s standard application and database recipes.

Following is the snippet default of the php application recipe.

deploy_revision app['id'] do
  revision app['revision'][node.chef_environment]
  repository app['repository']
  user app['owner']
  group app['group']
  deploy_to app['deploy_to']
  action app['force'][node.chef_environment] ? :force_deploy : :deploy
  ssh_wrapper "#{app['deploy_to']}/deploy-ssh-wrapper" if app['deploy_key']
  shallow_clone true
  purge_before_symlink([])
  create_dirs_before_symlink([])
  symlinks({})
  symlink_before_migrate({
    local_settings_file_name => local_settings_full_path
  })
end

By default, it will assume the checked-out repo dir as the source. And in my case, its below 2 dirs from the root of the git repo.

But I couldn’t find any params that configures/tells to use the inner folder of the root repo?

How to deal with this?


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.tumblr.com
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


#4

On Mon, Jan 30, 2012 at 4:18 AM, Nathen Harvey nharvey@customink.com wrote:

You may need to write some custom code to work around this but this might be
a good time to revisit the decision to store two separate projects in the
same github repo.

If you really need these in the same repo, using git submodules might make
more sense.

I case this ever is considered as a feature request… I’d like to
advance reasons why this setup is sometimes necessary:
Think of a service-end stacks and a front-end stack, which have to be
quite tightly coupled, without additional staff and in complex setups,
it is often easier (keeping to DRY) to have these stacks developed in
the one project. While separate ‘projects’ for deployment purposes,
for every other purpose the look and act as one project.

After much wrestling I in github.com/cookbooks I concluded
git-submodules are nice but not well suited everywhere - they are
very sensitive/fragile to your workflow and require a painful
workflow if committing and deploying 20 times a day. My sense is that
sub-modules are suited to the use case that Librarian[0] targets[1] -
your stable code. Then Librarian is in every way superior to
sub-modules. That still leaves the development process, which if you
are using continuous deploy, never has a discrete end.

HTH

[0] https://github.com/applicationsonline/librarian
[1] “Librarian is really for pulling in the 50 or so finished
third-party cookbooks that you’re using, not the 1 or 2 cookbooks
you’re actively working on.”

On Sun, Jan 29, 2012 at 2:07 AM, Sachin Sagar Rai millisami@gmail.com
wrote:

Hi chef fellas!
I’ve a private repo at github and it has multiple projects in that single
repo.
e.g

/shared/microlabs (root of the git repo mirrored using git from

github)

Following are the 2 projects inside the microlabs1-subdir

/shared/microlabs/microlabs1-subdir/drupal
/shared/microlabs/microlabs1-subdir/radiant

I got to install those 2 projects and I’m trying to follow the opscode’s
standard application and database recipes.

Following is the snippet default of the php application recipe.

deploy_revision app['id'] do
  revision app['revision'][node.chef_environment]
  repository app['repository']
  user app['owner']
  group app['group']
  deploy_to app['deploy_to']
  action app['force'][node.chef_environment] ? :force_deploy : :deploy
  ssh_wrapper "#{app['deploy_to']}/deploy-ssh-wrapper" if

app[‘deploy_key’]
shallow_clone true
purge_before_symlink([])
create_dirs_before_symlink([])
symlinks({})
symlink_before_migrate({
local_settings_file_name => local_settings_full_path
})
end

By default, it will assume the checked-out repo dir as the source. And in
my case, its below 2 dirs from the root of the git repo.

But I couldn’t find any params that configures/tells to use the inner
folder of the root repo?

How to deal with this?


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.tumblr.com
Sent with Sparrow


πόλλ’ οἶδ ἀλώπηξ, ἀλλ’ ἐχῖνος ἓν μέγα
[The fox knows many things, but the hedgehog knows one big thing.]
Archilochus, Greek poet (c. 680 BC – c. 645 BC)
http://hedgehogshiatus.com


#5

As @hedge explained, working with git sub-modules has always been a pain for me managing commits. May be I’m not meant for submodules. Any ideas on how to accomplish this w/o submodules?


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.tumblr.com
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Tuesday, January 31, 2012 at 1:25 AM, Hedge Hog wrote:

On Mon, Jan 30, 2012 at 4:18 AM, Nathen Harvey <nharvey@customink.com (mailto:nharvey@customink.com)> wrote:

You may need to write some custom code to work around this but this might be
a good time to revisit the decision to store two separate projects in the
same github repo.

If you really need these in the same repo, using git submodules might make
more sense.

I case this ever is considered as a feature request… I’d like to
advance reasons why this setup is sometimes necessary:
Think of a service-end stacks and a front-end stack, which have to be
quite tightly coupled, without additional staff and in complex setups,
it is often easier (keeping to DRY) to have these stacks developed in
the one project. While separate ‘projects’ for deployment purposes,
for every other purpose the look and act as one project.

After much wrestling I in github.com/cookbooks (http://github.com/cookbooks) I concluded
git-submodules are nice but not well suited everywhere - they are
very sensitive/fragile to your workflow and require a painful
workflow if committing and deploying 20 times a day. My sense is that
sub-modules are suited to the use case that Librarian[0] targets[1] -
your stable code. Then Librarian is in every way superior to
sub-modules. That still leaves the development process, which if you
are using continuous deploy, never has a discrete end.

HTH

[0] https://github.com/applicationsonline/librarian
[1] “Librarian is really for pulling in the 50 or so finished
third-party cookbooks that you’re using, not the 1 or 2 cookbooks
you’re actively working on.”

On Sun, Jan 29, 2012 at 2:07 AM, Sachin Sagar Rai <millisami@gmail.com (mailto:millisami@gmail.com)>
wrote:

Hi chef fellas!
I’ve a private repo at github and it has multiple projects in that single
repo.
e.g

/shared/microlabs (root of the git repo mirrored using git from

github)

Following are the 2 projects inside the microlabs1-subdir

/shared/microlabs/microlabs1-subdir/drupal
/shared/microlabs/microlabs1-subdir/radiant

I got to install those 2 projects and I’m trying to follow the opscode’s
standard application and database recipes.

Following is the snippet default of the php application recipe.

deploy_revision app['id'] do
  revision app['revision'][node.chef_environment]
  repository app['repository']
  user app['owner']
  group app['group']
  deploy_to app['deploy_to']
  action app['force'][node.chef_environment] ? :force_deploy : :deploy
  ssh_wrapper "#{app['deploy_to']}/deploy-ssh-wrapper" if

app[‘deploy_key’]
shallow_clone true
purge_before_symlink([])
create_dirs_before_symlink([])
symlinks({})
symlink_before_migrate({
local_settings_file_name => local_settings_full_path
})
end

By default, it will assume the checked-out repo dir as the source. And in
my case, its below 2 dirs from the root of the git repo.

But I couldn’t find any params that configures/tells to use the inner
folder of the root repo?

How to deal with this?


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.tumblr.com
Sent with Sparrow


πόλλ’ οἶδ ἀλώπηξ, ἀλλ’ ἐχῖνος ἓν μέγα
[The fox knows many things, but the hedgehog knows one big thing.]
Archilochus, Greek poet (c. 680 BC – c. 645 BC)
http://hedgehogshiatus.com