Does bedrock/trellis disable the ability to add/install plugins via admin?

I know this may not be “the Bedrock way” because it decouples the management of plugins/themes/updates from Composer, but for clients where I cannot (or do not) want to maintain active management/control of their site following completion of the project I make the following modifications to bedrock at the outset of the project which subsequently allows plugins/themes/updates to be managed via the Admin yet still allows me to perform trellis deploys – without removing/overwriting plugins!

  1. Add the following to both production.php (create if necessary) and staging.php (if desired) files in site/config/environments/ to allow theme/plugin/updates via the Admin:
    Config::define('DISALLOW_FILE_MODS', false);
    
  2. Next, add the following to trellis/roles/deploy/defaults/main.yml under the project_shared_children heading (line 33 ATTOW), which will create new themes and plugins directories in /srv/www/example.com/shared/, symlinked to the themes and plugins directories in site/web/app/:
    project_shared_children
      [...]
      - path: web/app/plugins
        src: plugins
      - path: web/app/themes
        src: themes
    
    • From the next deploy onwards all themes and plugins installed via the WordPress Admin will be written to /srv/www/example.com/shared/[themes/plugins], which is retained across deployments!

Once these changes have been implemented you can deploy at your leisure, assured that themes and plugins won’t be overwritten or removed!

Note: if you want to shim this in to an existing installation just mv the plugins and themes from your previous release (/srv/www/example.com/releases/[release -1]/web/app/[plugins/themes]/*) into the newly created /srv/www/example.com/shared/[themes/plugins]/ directories after deploy.

10 Likes