1

My directory structure is as looks like the following :

+deploy
 |
 | Capfile
 +- config/
    |
    +- deploy/
       |
       | production.rb
         ...
         ....
    deploy.rb


+frontend-app
 |
 +- My app structure.

I want to make this structure working with capistrano, For now my Capfile and related capistrano configs are placed under the /frontend-app directory.

Any help would be appreciated.

Updated : I checked these and these but I think it doesn't provides exact abstraction.

Uri Agassi
  • 36,848
  • 14
  • 76
  • 93
FZE
  • 1,587
  • 12
  • 35
  • Can't you just do `cd deploy; cap production deploy`? – Matt Brictson Feb 09 '16 at 16:45
  • oh, I mean capistrano suppose the Capfile in the project base, in that case Capfile is must be placed under frontend-app, but I'm trying to separate deployment files from base project. Even in this structure I suppose to `cd deploy; cap production deploy` But it will not recognize the frontend-app. My question may not be clear enough, I'm asking how could you achieve this structure. Which variable etc. to set to define project to be deploy. I didn't see any config about that. In every cases around internet the file placed in base directory. – FZE Feb 09 '16 at 16:49
  • I understand what you are asking, but I don't see why you are trying to achieve that. Capistrano doesn't care where you run it; you could even put your Capistrano files in an entirely different repo. Capistrano "recognizes" your app based on the `:repo_url` setting, not based on where the `cap` command is run. – Matt Brictson Feb 09 '16 at 17:09
  • oh I see, it was my misunderstood about the workflow of capistrano. Thanks for the explanation. If you give as an answer I would mark as answered. – FZE Feb 09 '16 at 17:30
  • I just noticed that you tagged your question as `capifony`. I looked up that project and saw that it seems to require a very old version of Capistrano. I'm not familiar with how capifony or old versions of Capistrano work, so it is possible that my answer is not accurate. Maybe someone who uses capifony can confirm. :) – Matt Brictson Feb 09 '16 at 17:36
  • I think the question is not about capifony, it is totally about my misunderstand of the deploy tool workflow. Actually I was aware it was getting file from the defined master branch from the remote repository but in anyway, I don't know why I thought it depends the local project. So as a result question is not a qualified question :) – FZE Feb 09 '16 at 18:10
  • OK I added an answer based on our conversation. :) – Matt Brictson Feb 09 '16 at 23:27

1 Answers1

0

There is no need to change your project structure.

Capistrano actually does not look at your local project structure when performing a deploy. Instead, it uses the :repo_url value to clone your project's repository onto the server, and works with your project there.

In other words, Capistrano doesn't care where you run it; you could even put your Capistrano files in an entirely different repo. All that matters is that your :repo_url points to the repository you wish to deploy.

So don't sweat where the Capistrano files actually live. In your case, you can just do this:

cd deploy; cap production deploy

And it should work fine. :)

Matt Brictson
  • 10,904
  • 1
  • 38
  • 43