Roots Discourse

Caching problems with Bedrock on Kinsta hosting

Hi there,

I am experiencing problems with caching on Kinsta hosting, and the support guys can’t seem to help me. As Kinsta is the recommend hosting of Roots I was acually quite surprised this is the case.

It seems to be a problem with the root path of files. I find it hard to debug because I don’t really know where to start because this is the first time I have this problem.

Does anyone else had or has this problem? Any suggestion in what direction I should think for the solution?

Thanks!

Cheers,
Ferre

I think you need to explain the specific issue further, we know it’s about caching but nothing more.

  • Is caching not working at all, on occasion, not clearing etc?

Are you refering to Kinsta Nginx caches not purged after deploy? Try https://github.com/ItinerisLtd/trellis-purge-kinsta-cache-during-deploy

Hey @JordanC26 @TangRufus,

Thanks for your response and sorry for the late reply. I’ve actually got an email from Kinsta because they saw this post on Discourse. The problem was that I was being a retard and has the wrong folder structure for their plugin. I’ve had their resources one level too deep and didn’t even think to check that.

Thanks again!

Hey @ferremek, glad you sorted it. Think I did exactly the same thing when I first set it up. Did you find two kinsta-mu-plugin directories (one inside the other) and deploy just the inner one?

Not working
web/app/mu-plugins/kinsta-mu-plugin/

Working
Instead of: web/app/mu-plugins/kinsta-mu-plugin/kinsta-mu-plugin

The second directory structure is how it’s set up for me and based on the code, the way it needs to be but seems odd they’ve got it with 2 of the same directories inside each other. I changed it to be the first example and it broke it (reverted that change now).

Hey @JordanC26, yeah it’s confusing they have the same dirs inside each other. For every other WP pluginI know of all the files live within the plugin directory, but for this Kinsta plugin the main .php file lives outside the plugin folder and in the mu-plugins folder.

So this is the structure that works for me:

/mu-plugins/
      ├────kinsta-mu-plugins.php
      └────/kinsta-mu-plugins/

Hopes this helps anyone else who encounters the same issue.

Ps. @Kinsta, if you read this I will suggest the plugin structure as follows:

/mu-plugins/
     └────/kinsta-mu-plugin/
          ├────kinsta-mu-plugin.php
          └────/includes/
               ├────/cache/
               ├────/cdn/
               ├────/compat/
               └────/shared/

That plugin structure is likely mandated by WordPress’s nature: it won’t load mu-plugins that keep all their files in a subdirectory:

WordPress only looks for PHP files right inside the mu-plugins directory, and (unlike for normal plugins) not for files in subdirectories.

Bedrock has a little code of its own that will autoload mu-plugins that are structured like “normal” plugins, but vanilla WordPress can’t.

@alwaysblank Ah, that explains a lot! I had no idea that was the case, thanks for your response!

Hi @ferremek,

I actually had the same issue, glad to see that you have sorted it out. However, I am curious to know whether when you deploy to your production environment, you have to manually move the kinsta-mu-plugin files for it to have the correct structure ?

I am using composer to load the plugin and I can’t seem to find a way to load it correctly.

I extracted the references to the kinsta mu-pulugin from my composer.json file:
"repositories": [ { "type": "package", "package": { "name": "kinsta/kinsta-mu-plugins", "type": "wordpress-muplugin", "version": "2.3.2", "dist": { "url": "https://kinsta.com/kinsta-tools/kinsta-mu-plugins.zip", "type": "zip" } } } ], "require": { "kinsta/kinsta-mu-plugins": "^2.3" }

Cheers,

Hi @Phil, currently I have all my plugins and mu-plugins in the Git repo. I am still looking for a better way of doing this but for now it works quite well. I did try installing the Kinsta MU Plugin with Composer, but the folder structure is wrong so you’ll have to fix that manually.

Out of curiosity, do you manage all your plugins with Composer? What is your experience with this in combination with custom plugins as the whole plugins folder is in the .gitignore? And do you have any solid way to autoupdate the plugins and WP core?

Hi @ferremek, indeed I have that issue with composer as well.

Regarding my setup, I can’t manage everything with composer but I use it for about 60% of the plugins that I need. It’s still saves me some time with the updates of composer enabled plugins and the wp core. I add exceptions to my gitignore for the custom/premium plugins that I can’t manage with composer and update those manually (which is a pain).

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