Manually Clear DistributedCache

Here is my current problem:

I rebuilt my discourse install using “stable” in app.yml but I did not wish to upgrade to the latest stable. So I rebuilt again using the intended older version. The current problem is that the site customizations are rendering require('discourse-common/lib/raw-handlebars').template() in the production source code when there is no such file in my install. This leads me to believe that the DistributedCache needs to be cleared. However, that is only an assumption. I would need to do this through the rails console I believe.

Currently getting a white screen due to the Uncaught Error: Could not find module discourse-common/lib/raw-handlebars error and I, of course, cannot log in through the interface to get to the admin interface.

Help and or suggestions? Thank you.

Have you tried safe mode?

My discourse install is older than 1.7 so I do not have this option.

So uninstall all plugins non-bundled plugins.

It’s not a plugin though. I believe the javascript error is coming from the cache set in app/models/site_customization.rb.

Have a look at the latest version and compare it to older versions. You’ll see the site customization headers are prepended with “raw-handlebars” which is what I am describing. My current install does not have this so the fact that it is rendering the assumption is that my distributed cache for “site_customization” needs to be cleared.

https://github.com/discourse/discourse/blob/master/app/models/site_customization.rb

For future stumbling discourse installations experiencing this obscure problem:

  1. ssh into discourse server
  2. cd var/discourse
  3. ./launcher enter app
  4. redis-cli flushall
  5. exit
  6. ./launcher rebuild app
5 Likes

Note, distributed cache is now versioned and tied to the actual git hash of the currently deployed discourse.

I can not think of any reason you would need to manually clear it.

4 Likes