• Resolved olaflexemo

    (@olaflexemo)


    Hi, I may misunderstand how this plugin works and am hoping that someone can help me understand what I can expect and what not or help me fix my problems.

    I’m trying to build a truly stateless WordPress instance using docker containers and kubernetes. in order to do that I need to either load all medial library content into the container image, which makes it impossible to dynamically load new content into a running instance and persist it beyond the containers lifespan or use an external cloud storage as Google cloud storage with a plugin that redirects all urls pointing to the media library content to the storage bucket.
    Using this plugin I was hoping to have found a solution but it doesn’t really seem to work. I have restored a few hundred files into a running container, then synchronised them using WP-Stateless into my Google cloud storage bucket successfully and finally enabled the plugin in stateless mode. We are using a custom frontend plugin which uses the WordPress rest api to consume content. Loading any of these images or pdf files seems to continue to load them directly from the media library. When I restart the container or scale the number of replicas (instances), it naturally boots without any of the content files and even though the plugin is still enabled and set to stateless mode, i don’t see any of the images or pdf files any longer. They do exist in the Google storage bucket though.

    Am I missing something?

    Thanks,
    olaf

Viewing 15 replies - 1 through 15 (of 16 total)
  • Alimuzzaman Alim

    (@alimuzzamanalim)

    It’s work by storing additional data in attachment metadata. If your database get reset then even if you have the plugin configured it wouldn’t know about files in GCS.
    About it not working on frontend, make sure File URL Replacement is enabled. How you are getting the image url on frontend? More details can be helpful. May be you have to make a way around to make this work.

    Thread Starter olaflexemo

    (@olaflexemo)

    Hi there,

    thanks for your reply!
    The File URL Replacement is enabled. And the db is not reset, the file system is. So WP knows about the files but they are missing from the file system after the container has been restarted or new instances have been deployed.
    The media files are being referenced in individual pages which then are being pulled into a plugin that renders tabs on the frontend. The actual frontend is pulling the content via the WP REST API.
    The pages linking the images contain absolute links to the medial library. Could it work to simply replace all links to the media library against URLs pointing to the Google storage bucket?

    Any other ideas of how I can solve this?

    Thanks,
    olaf

    Alimuzzaman Alim

    (@alimuzzamanalim)

    The pages linking the images contain absolute links to the medial library. In this case File URL Replacement should be worked, maybe the rest API didn’t apply the_content filter.
    We don’t make any changes to database URL Replacement just work on real time.

    Thread Starter olaflexemo

    (@olaflexemo)

    Thanks, I’ll investigate. I just noticed that none of my pdf files from the media library seems to have made it over into the storage bucket. Is that intentional?

    The fact that the files eventually don’t exist locally shouldn’t cause problems, correct?

    Thanks a lot,
    olaf

    Alimuzzaman Alim

    (@alimuzzamanalim)

    1. No, that shouldn’t be happening. Synchronize non-images files between Google Storage and local server in Sync tab should have copied the pdf file to GCS.

    2. No, if you did the sync process.
    As long as you have the file in GCS and you have additional metadata in attachment it will work.

    Thread Starter olaflexemo

    (@olaflexemo)

    Thanks for the feedback! πŸ™‚

    so what’s the 1st option doing then? That’s the one I used, wrongly believing that it would take care of all files inside the media library (wp-content/upload), it’s only refreshing images? so images that are only local are being pushed to google and image files that only exist remotely are being pulled down locally?

    What the best way to catch everything, run 3 syncs, using all three options?

    thanks again,
    olaf

    Alimuzzaman Alim

    (@alimuzzamanalim)

    Yes, first one only for image and work like you said. You only need to run first two only, last one don’t do much. Sorry for the inconvenience. We will merge all of them in future.

    Thread Starter olaflexemo

    (@olaflexemo)

    Hi Alimuzzaman,

    thanks again for your prompt reply! Much appreciated!
    No need to apologise as you have been extremely helpful! πŸ™‚

    Thanks again

    Thread Starter olaflexemo

    (@olaflexemo)

    One more question springs to mind though:
    we use mindmap files in our system and store them in the media library too. i added the file name extension (.mind) to the supported file types list on the settings page. Do I need to run a sync with option 3 to take care of these or are they regarded as non-image files (option 2)? Or is Option three synchronising files that are outside the upload directory?

    And sorry to be a pain but after completing a synch using option 1 I just tried running a sync using option 2 but all i get is a long list with error messages: Unknown failure reason.
    A sync using option 3 doesn’t do anything, it just says:
    Status: Processing files (0 total)...
    and sits there at 0%.

    Alimuzzaman Alim

    (@alimuzzamanalim)

    Option 3 doesn’t do much, it sync files outside of media library and it’s support is limited. 0 total means that it didn’t find any supported file. We are working on it now.
    About the Unknown failure reason I am not sure why that is happening. Only reason this could happen is because of empty attachment metadata.
    supported file types list is for File URL Replacement.
    You may contact us directly for further investigation.

    Thread Starter olaflexemo

    (@olaflexemo)

    Hi there one last time πŸ™‚

    do you mean to use the contact us form here:
    https://www.usabilitydynamics.com/contact-us
    Just wondering as this page requires me to provide a project budget $ amount.

    Thanks

    Alimuzzaman Alim

    (@alimuzzamanalim)

    You can ignore that, that’s a not required field. Send details and I will take a look what is causing the Unknown failure reason.

    Thread Starter olaflexemo

    (@olaflexemo)

    Thanks, I just did that a few minutes ago.

    Thread Starter olaflexemo

    (@olaflexemo)

    Hi there again,

    as it turns out, the issue with the links to embedded images not being replaced by the plugin when content is being consumed via the WP REST API was fixed by the following change:
    line 182 of wp-stateless/lib/classes/class-bootstrap.php
    change:
    add_filter( 'the_content', array( $this, 'the_content_filter' ) );
    to
    add_filter( 'the_content', array( $this, 'the_content_filter' ), 99 );

    This ensures that the filter is being applied after the shortcode of the wonderplugin tab that we use has been applied.
    Is it possible to integrate that change into the plugins code base?

    Next issue to solve is the problem with uploading/synching of pdf (non-image) files.

    Thanks,
    olaf

    Thread Starter olaflexemo

    (@olaflexemo)

    Hi @alimuzzamanalim, i was just wondering if you saw my last update since the post is marked as resolved…?

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘stateless wordpress instance’ is closed to new replies.