Support

Account

Home Forums ACF PRO Composer Support Reply To: Composer Support

  • Hey Tommy, I’ve got a similar approach with Bedrock but I’m running composer and wpcli tasks automatically in my deploy.rb. Kinda think having to SSH manually goes against the reason for using automated deploys.

    You need gem 'capistrano-composer' in your gemfile (+ run bundle install). Looks like you’re already using the capistrano-wpcli one though?
    So I assume you’ve set the remote url in your stage rb files:
    e.g. set :wpcli_remote_url, 'http://staging.yoursite.com' for staging.rb

    Then you need the WP-cli config in your deploy.rb, e.g:

    
    # WPCLI config
    set :wpcli_local_url, 'http://local.yoursite.com'
    set :wpcli_local_uploads_dir, 'web/app/uploads/'
    set :wpcli_remote_uploads_dir, -> { shared_path.join('web/app/uploads') }
    set :wpcli_rsync_options, '-rlvz -e "ssh -p4444" --stats --delete --delete-after'
    

    Note, I also push uploads and I need a custom port for ssh, not everyone would need that.

    THEN add a task to run sync in your namespace :deploy do

    
      desc 'Keep WP synced'
      task :wp_sync do
        on roles(:db) do
          info "Push local database and uploads"
          within release_path do
            invoke 'wpcli:db:push'
            invoke 'wpcli:rewrite:flush'
            invoke 'wpcli:uploads:rsync:push'
          end
        end
      end
    

    Then (usually) at the end of your deploy namespace, you need to attach the tasks to the Capistrano flow, with after :updated, 'deploy:wp_sync'

    As for your “Invalid post type” error, I can’t help you though. Just tried the same process and mine works. :/