קובץ Javascript גדול בתוך תיקיית assets

סיכום מבוסס בינה מלאכותית

The discussion revolves around a large 3.1 MB JavaScript file in the assets folder of a Discourse installation, causing Nginx buffer warnings. TechGeek questions the file’s purpose and seeks ways to reduce its size. awesomerobot explains that this file contains the full Discourse JavaScript application, sent on first load and cached thereafter. Falco notes that the official install guide uses Brotli compression to reduce the file to ~400KB. TechGeek clarifies they’re using separate web and data containers with a manual reverse proxy, not the official setup. Falco confirms the official nginx config (from nginx.sample.conf) is tailored by the install script and not supported for manual setups. TechGeek expresses a desire for an official guide on manual nginx configuration for multi-container deployments. Falco reiterates that the official install guide is preferred, but separate containers don’t affect the web container’s nginx setup. TechGeek seeks optimization for hosting multiple Discourse forums using an Nginx proxy with separate containers, implying manual configuration of performance features like Brotli and HTTP/2.

One of the file /assets/application-7c87db9088046beb643be94b61428105469e084e8d02f141c57adfaf14168c63.js is almost 3.1 MB in size and causing lots of warning in error.log for Nginx reverse proxy.

an upstream response is buffered to a temporary file /var/lib/nginx/proxy/2/77/0012036772 while reading upstream, client: XXXXXX

  • Does anybody know for what this much big javascript file is used for
  • Is there a way to reduce size of this file. One way to reduce warning in Nginx will be to increase buffer size to 3.1 MB, but isn’t that little too much from default nginx configuration

When you first load a Discourse site, the full JavaScript application is sent to the browser (it’s then cached so subsequent page loads are much faster). That’s what that 3MB file is.

Also worth keeping in mind that by following the official install guide you get a pre-configured nginx reverse-proxy that serves this file using brotli compression that reduces it to 400kb.

Thanks @Falco. Using separate web and data container and manual reverse proxy configuration. Looks like guide at discourse/docs/INSTALL-cloud.md at main · discourse/discourse · GitHub is for standalone container.

For pre-configured nginx reverse proxy configuration, do you mean using configuration from discourse/config/nginx.sample.conf at main · discourse/discourse · GitHub

That config file is the template we use in the official install guide, but it’s heavily modified by the install script during installation too.

I’m afraid we only provide the config file when running following our official install guide. If you deviate from it you will have to be careful to not lose everything we support like brotli, HTTP/2, IPv6, etc.

@Falco By reading discourse forum, can feel separate web and db container is preferred or may be recommended way. It will be great if there is an official guide on manual nginx configuration or automatic setup for separate containers.

Our preferred way to install is the one we documented as our official install guide. That said, using a separate web/data container doesn’t affect the pre-configured nginx inside the web container, it should work the same way, without a need for an extra reverse-proxy.

Looking for optimization while hosting multiple discourse forum using: Nginx proxy → Separate Web and DB container. In this scenario I assume performance enhancement done by official install has to be done manually in nginx proxy.