What are people doing when a theme is being deployed on several domains about the dist folder?

I am cloning a theme 50+ times on different domains from my github repository. I make changes to the codebase daily and sometimes I edit a style or two along with the JS files. I do not have the dist folder under version control because of best practices and the fact that the cache busting system would balloon my repository. I need to figure out a way to get those 50+ sites the newest dist assets. Has anyone had to tackle this problem?

P.S. I do not use Trellis to deploy, should I be doing this? I also am using Cloudways with Digital Ocean as the cloud provider.

Though Trellis is great, you can also use other deployment tools like Capistrano.
Are you using Bedrock for these sites?

The goal is to have a single command that deploy so all (or specific) sites fully automatically.

I am using bedrock. And the goal is to be able to push changes to all the sites including the dist folder.

If you put these sites on a multi site install you’d only have to update one theme.

Unfortunately we have decided against this because if the WP core gets compromised the entire network would be down. Its a SAAS website for a niche industry so each customer gets a standalone site. I am going to look into Capistrano or any other ideas people have. Thanks for the suggestions.

Bedrock helps with deployment. Trellis deployment does basically the following:

  1. Prepare a new release directory that isn’t used yet, so it can be switched to very quickly from the previous release (also allows for fast rollback) (via symlink).
  2. Clone/update the PHP-code on the target using git.
  3. Install WordPress plugin dependencies and theme runtime dependencies using composer.
  4. Build the theme on the deployment system/workstation (webpack).
  5. Upload the theme build artifacts onto the target.
  6. Optionally install/update core/plugin/theme languages.
  7. Some transient/cache clean up stuff to ensure smooth switching to the new release.
  8. Switch to the new release folder (via symlink).

For speeding up the deployment Trellis can re-use or share (via symlinks) some folders, like the vendor folder (or the languages folder if you use that; see this guide about language management):

composer and WordPress are mostly idempotent in their operation, which means that installing/updating plugins and language files will work with existing installations, also intelligently cleaning up older files.
Trellis is based on ansible which can manage multiple systems (servers).
Trellis deployment code: https://github.com/roots/trellis/tree/17430191bb7211545eb63ba3ba989ee95c262c5f/roles/deploy - especially https://github.com/roots/trellis/tree/17430191bb7211545eb63ba3ba989ee95c262c5f/roles/deploy/tasks

But you don’t have to use Trellis, you can also make your own deployment task/script on run that on each server automatically. For some many sites you may also bei interested in using a CI/CD pipeline that automatically updates the plugins, releases to staging and (after an optional manual approval process) to production.

There are also paid SaaS WordPress deployment solutions.

1 Like

This topic was automatically closed after 42 days. New replies are no longer allowed.