Title: stateless wordpress instance
Last modified: March 30, 2018

---

# stateless wordpress instance

 *  Resolved [olaflexemo](https://wordpress.org/support/users/olaflexemo/)
 * (@olaflexemo)
 * [8 years ago](https://wordpress.org/support/topic/stateless-wordpress-instance/)
 * 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)

1 [2](https://wordpress.org/support/topic/stateless-wordpress-instance/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/stateless-wordpress-instance/page/2/?output_format=md)

 *  [Alimuzzaman Alim](https://wordpress.org/support/users/alimuzzamanalim/)
 * (@alimuzzamanalim)
 * [8 years ago](https://wordpress.org/support/topic/stateless-wordpress-instance/#post-10132659)
 * 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](https://wordpress.org/support/users/olaflexemo/)
 * (@olaflexemo)
 * [8 years ago](https://wordpress.org/support/topic/stateless-wordpress-instance/#post-10132691)
 * 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](https://wordpress.org/support/users/alimuzzamanalim/)
 * (@alimuzzamanalim)
 * [8 years ago](https://wordpress.org/support/topic/stateless-wordpress-instance/#post-10132779)
 * 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](https://wordpress.org/support/users/olaflexemo/)
 * (@olaflexemo)
 * [8 years ago](https://wordpress.org/support/topic/stateless-wordpress-instance/#post-10132793)
 * 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](https://wordpress.org/support/users/alimuzzamanalim/)
 * (@alimuzzamanalim)
 * [8 years ago](https://wordpress.org/support/topic/stateless-wordpress-instance/#post-10133506)
 * 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](https://wordpress.org/support/users/olaflexemo/)
 * (@olaflexemo)
 * [8 years ago](https://wordpress.org/support/topic/stateless-wordpress-instance/#post-10133606)
 * 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](https://wordpress.org/support/users/alimuzzamanalim/)
 * (@alimuzzamanalim)
 * [8 years ago](https://wordpress.org/support/topic/stateless-wordpress-instance/#post-10133631)
 * 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](https://wordpress.org/support/users/olaflexemo/)
 * (@olaflexemo)
 * [8 years ago](https://wordpress.org/support/topic/stateless-wordpress-instance/#post-10133634)
 * 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](https://wordpress.org/support/users/olaflexemo/)
 * (@olaflexemo)
 * [8 years ago](https://wordpress.org/support/topic/stateless-wordpress-instance/#post-10133652)
 * 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](https://wordpress.org/support/users/alimuzzamanalim/)
 * (@alimuzzamanalim)
 * [8 years ago](https://wordpress.org/support/topic/stateless-wordpress-instance/#post-10133714)
 * 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](https://www.usabilitydynamics.com)
   directly for further investigation.
 *  Thread Starter [olaflexemo](https://wordpress.org/support/users/olaflexemo/)
 * (@olaflexemo)
 * [8 years ago](https://wordpress.org/support/topic/stateless-wordpress-instance/#post-10135388)
 * Hi there one last time 🙂
 * do you mean to use the contact us form here:
    [https://www.usabilitydynamics.com/contact-us](https://www.usabilitydynamics.com/contact-us)
   Just wondering as this page requires me to provide a project budget $ amount.
 * Thanks
 *  [Alimuzzaman Alim](https://wordpress.org/support/users/alimuzzamanalim/)
 * (@alimuzzamanalim)
 * [8 years ago](https://wordpress.org/support/topic/stateless-wordpress-instance/#post-10135406)
 * 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](https://wordpress.org/support/users/olaflexemo/)
 * (@olaflexemo)
 * [8 years ago](https://wordpress.org/support/topic/stateless-wordpress-instance/#post-10135418)
 * Thanks, I just did that a few minutes ago.
 *  Thread Starter [olaflexemo](https://wordpress.org/support/users/olaflexemo/)
 * (@olaflexemo)
 * [8 years ago](https://wordpress.org/support/topic/stateless-wordpress-instance/#post-10154541)
 * 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](https://wordpress.org/support/users/olaflexemo/)
 * (@olaflexemo)
 * [8 years ago](https://wordpress.org/support/topic/stateless-wordpress-instance/#post-10157007)
 * Hi [@alimuzzamanalim](https://wordpress.org/support/users/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)

1 [2](https://wordpress.org/support/topic/stateless-wordpress-instance/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/stateless-wordpress-instance/page/2/?output_format=md)

The topic ‘stateless wordpress instance’ is closed to new replies.

 * ![](https://ps.w.org/wp-stateless/assets/icon.svg?rev=1715943)
 * [WP-Stateless - Google Cloud Storage](https://wordpress.org/plugins/wp-stateless/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-stateless/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-stateless/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-stateless/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-stateless/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-stateless/reviews/)

 * 16 replies
 * 2 participants
 * Last reply from: [Alimuzzaman Alim](https://wordpress.org/support/users/alimuzzamanalim/)
 * Last activity: [8 years ago](https://wordpress.org/support/topic/stateless-wordpress-instance/page/2/#post-10159720)
 * Status: resolved