Forum Replies Created

  • +1 I’m using acf with composer through packagist, but I’ve put repeater-field in my repo. It’s one of the only dependencies that I’m keeping in the repo and while that’s not really an issue, it plays on my OCD anxiety that I don’t have a consistent approach. 😀

  • Just noticed I’ve got the wpcli rsync running on the DB role, which works only because I’ve got everything on the same server. If I had a dedicated DB server that was different to my app role, that wouldn’t work. I’m gonna break those tasks up now.

  • 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, '' for staging.rb

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

    # WPCLI config
    set :wpcli_local_url, ''
    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'

    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. :/

Viewing 3 posts - 1 through 3 (of 3 total)