2
votes

I'm using Capistrano (as part of Bedrock) to deploy Wordpress.

I'm also using Composer to manage php dependencies and my WordPress plugins, and I have my theme managed by git as a submodule.

I've got everything setup and I've successfully deployed WordPress to my remote server.

The problem is I'm managing my custom theme with git submodules. I can't find a way to init and update the submodule during the default deployment, or as a separate task. I'd prefer to have it as a separate task as I don't change the underlining project files too frequently.

  1. I found this gist that creates a task to do the same but its using an older version of Capistrano.

  2. I tried this method but it fails when trying to create the release symlinks.

  3. I tried enabling submodules with set :git_enable_submodules, 1 in my deploy.rb file but that seems to be missing from Capistrano V3.x.

  4. I found this thread where the author of Capistrano explains why submodule support was removed and another commenter posted this gist, which is giving me this error Tasks: TOP => git:create_release => git:update => git:clone.

What are other people doing to enable simple deployments with Capistrano that include git submodules?

1
Welp it looks like the simplest solution by far is to just remove the submodule and commit the theme to my project so it's all deployed by Capistrano. :( - Ken Prince
Looks like my submodule was improperly added to my super-project. When I examines the super-project's .git/config it was apparent that the submodule was not mapped. Also the super-project contained no .gitmodules files. This may have caused my issues but I decided to remove the submodule all together and merge it into the super-project to avoid any more problems with capistrano. - Ken Prince

1 Answers

1
votes

i also use git submodule in capistrano 2 i used:

set :git_enable_submodules, 1

worked prefctly.

when i moved into Capistrano 3.x i started to use:

namespace :git do
  desc 'Copy repo to releases'
  task create_release: :'git:update' do
    on roles(:all) do
      with fetch(:git_environmental_variables) do
        within repo_path do
          execute :git, :clone, '-b', fetch(:branch), '--recursive', '.', release_path
        end
      end
    end
  end
end

also working like a charm.

see more details here:

https://github.com/capistrano/capistrano/blob/master/lib/capistrano/tasks/git.rake#L34 https://github.com/capistrano/capistrano/blob/master/lib/capistrano/tasks/git.rake#L56