0
votes

I am using Capifony (v2.15.5) to deploy my Symfony (2.6.5) application to a remote server. I'm using deployment strategy "a)", where changes are pushed to Git, and then on deployment the server clones the repo to provide the latest application files. Up until recently I had this working fine, but I have made a change to the structure of my repo, and now it's not.

Specifically, it used to be like this, Symfony project root is same as Git root:

[root]
    app/
    src/
    web/

But now it's like this, Symfony project root is child of Git root:

[root]
    dbscripts/
    docs/
    webapp/
        app/
        src/
        web/

It's not surprising this is giving Capifony some trouble, but I'd have thought it would be possible to configure my way out of, and no luck so far.

Here's some of my deploy.rb:

set :app_path,    "webapp/app"

set :repository,  "ssh://[repodetails]"
set :scm,         :git

set :shared_files,      [app_path+"/config/parameters.yml"]
set :shared_children,     [app_path + "/logs", "webapp/vendor"]

set :use_composer, true

As you can see, I've tried to reflect the new Symfony root in the config, and this gets me so far, but currently my deployments are failing at the Composer step, because it's executing the install command in the Git root, which isn't where composer.json and composer.lock are.

I've found a quite similar question here: Redefined symfony root project. Not a lot of detail there, and it's 3 years old, so I thought it was worth a revisit.

I can potentially move it back the way it was, and maybe maintain some semblance of the old structure using Git submodules (new territory for me though). But my question is: is it possible to configure Capifony to work correctly with a Symfony root not in the Git root; if so, how; if not, what's the best way of working round it.

Thanks in advance!

1

1 Answers

2
votes

I have found a German blog post talking about this issue here. You basically need to change these configuration values:

set :cache_path, "api/app/cache"
set :composer_options, "--no-dev --verbose --prefer-dist --optimize-autoloader --working-dir=api"
set :composer_dump_autoload_options, "--optimize --working-dir=api"
set :symfony_console, "api/app/console"

Also change your shared_files / shared_children values appropriately.

In this example the Symfony2 project was installed in the api directory. Just change it to your needs.