udx / wp-stateless

WP-Stateless is a WordPress plugin that uploads and serves your WordPress media from Google Cloud Storage.
https://stateless.udx.io
MIT License
260 stars 62 forks source link

Ephemeral mode and File URL Domain are not working as expected #748

Open i2dcarrasco opened 3 months ago

i2dcarrasco commented 3 months ago

Hello,

We are migrating a Wordpress to Cloud Run, so the stateless mode is mandatory for us. Trying your plugin I have decided to use the Ephemeral mode which is supposed to be the most compatible and in general the best for thumbnails and similar. I know that this mode is not fully stateless, but there is no problem if files are stored locally temporary if the process is improved. The problem is that looks like is not working as expected. In this mode the plugin supposedly uploads the files to local first, and then it uploads it to the GCS and sever from it. On my tests the file is uploaded to local but never uploaded to GCS or served from it (just the normal Wordpress behaviour). The folder is currently mounted into another GCS and shared across all the containers, so the file is accesible even if the upload process is executed into another container (which should not be the way). If I enable the Stateless mode, all the process works as expected. The file is uploaded to the storage and serverd from it without problems. Also I have noticed that the sync option is not doing anything with the existing files in both cases (Ephemeral and Stateless modes). At least in Ephemeral it pretends that is doing anything (but the files are not uploaded), but in the Stateless mode the progress goes from 0% to 100% in a second and does nothing. Maybe is the right behaviour and only syncs the new files, but the description says all the files.

The option to change the storage URL by a custom domain seems to be not working. If I am not wrong, the setting will change the default storage url (https://storage.googleapis.com//sites...) by the custom domain (https://domain.com/sites...). At least in the media manager in Wordpress, is not working, because the provided URL is the full storage URL. For now I have not done tests in the post editor or looking at the post from the client side.

By the way, the other "File URL Replacement" option seems to be not working too, or at least no images are changed in the site rendering (which is what the option does if I am not wrong). I have selected the "Enable Editor & Meta" option but nothing changes, the images are served directly from the site url like the normal Wordpress behaviour.

I am using the Wordpress version 6.5.3 and the plugin version 4.0.3. My Wordpress is multisite and the plugin was enabled in Network Mode. I have tried to enable it just in a site, but the Network settings still there even when the plugin is disabled and then I cannot manage the plugin site by site.

Finally a note: When the plugin is enabled the site and the admin becomes very slow even when no Slow options like the "File URL Replacement" are enabled. the site goes from 1.2s to 1.9s, and the admin from 2.2s to more than 5s. If the plugin is not doing anything in the site why it makes it slower?, and the admin the same, in the media manager can be acceptable because is working, but in the rest of the admin site...

Best regards.

i2dcarrasco commented 3 months ago

Hello,

Update: By causality I have changed the Storage from Uniform to Fine-Grained thinking that a warning in the PHP was related to it (isn't related), and looks like has fixed the Ephemeral upload and sync, but I have not tested the rest of options yet. I don't understand why this make the plugin fails, and why there is no error message anywhere...

EDIT: The "File URL Replacement" works now, but only with the Ephemeral option and not with the Stateless option. Sync option still doing nothing in Stateless mode.

I still now knowing why it adds 1s to the page load if there is no replacements activated on the fly.

Best regards.