Frappe dockerized multibench asset building problems

Hi everyone,

I’m running two separate Frappe benches on a single server using docker containers as explained here. Each bench has its own site, and both use similar configurations. However, while subdomain1.domain.com works perfectly, subdomain2.domain.com is returning 404 errors for static assets (CSS and JS files).

May I have some guidance on where the problem could lay?

Let me know if you need further information.

Thanks.

Check if this solves your problem? Remove redis-cache volume by sdfateh · Pull Request #1555 · frappe/frappe_docker · GitHub

2 Likes

I was pulling my hair. Thank You!

I believe there needs to be another way to do it in case you have Managed Redis Instance. I had to delete assets_json key in order for it to work.

What is the reason that this is implemented in the first place?

Asset caching? For performance.

bench --site site.name clear-website-cache should ideally do that?

  • use the cloud api to clear volumes or cache.
  • Or use redis cli client and flushall

Clear cache for redis after update in any convenient way.

Wuo, thank you very much @revant_one, that seemed to solve the problem… but not really.

docker compose --project-name <compose_project_name-subdomain2> exec redis-cache redis-cli FLUSHALL

So it got fixed for a while, until I restored subdomain1 site. Then subdomain1 broke, and subdomain2 started to work. It seems like redis cache might be shared across benches?

I found out something strange… I will provide an example:

The “live page” in the browser is requesting the file https://subdomain1.domain.com/assets/frappe/dist/css/login.bundle.NRGUE7GC.css That file is present in the backend service, but not in the frontend filesystem (under ~/frappe-bench/sites/assets).

Any thought on this? Shouldn’t they have a unique volume associated?

Do not execute bench build in production containers.

Try recreating all containers.

Ok, I will give it a try, and let you know. Sorry if I have some ‘fundaments’ lacks of knowledge with the framework. I’m quite new. :slight_smile:

PS: Is it possible to make bakcups and restores from other servers in production sites?

I always use clear-website-cache on new deployment but it did seem to solve the problem for some reason.

It finally seems it was a multifactorial issue. On one hand, I had run bench build in production, and Redis cache needed to be cleared as well. On the other hand, there were also problems with building the Docker images (version-related issues).

Thank you for your help. If I encounter more issues, I’ll come back to the forum.

Best regards.