Discourse خطأ nginx مزدوج: تعذر العثور على الوحدة `handlebars` المستوردة من `discourse-common/lib/raw-handlebars`

Hi!
My website uses version 2.9 of discourse. For some reason, I had to use double nginx for discourse. I deployed two discourse web_only container nodes and used an nginx to proxy in front of them. My system architecture diagram:

I was confused when my custom nginx proxy two web_only container nodes and randomly distributed requests to any web_only node, my discourse website sometimes reported errors: Could not find module ‘handlebars’ imported from’ discurse-common /lib/raw-handlebars’, this time the browser visits the site blank screen. But when I used custom nginx to forward all requests to only one of the web_only nodes, this error does not occur. I searched for this problem, there were some commits before to solve this same error, I confirmed that my version contains those commit code.

Could not find module 'handlebars' imported from 'discourse-common/lib/raw-handlebars'

Broken instance after updating to 2.9.0.beta2 - #11 by david

Does anyone know why that is? Thanks very much

By the way, share a problem where using double nginx causes can’t get the real user IP address.
This is because my custom nginx enables X-Forwarded-For header field to get client IP address, but does not disenable X-Forwarded-For of discourse’s nginx. Causes the custom nginx X-Forwarded-For configuration to be overwritten by discourse’s nginx

And it doesn’t matter which one you use? And they are running the same image? That is perplexing.

The only advantage I can see to running two containers like that on the same host is to make it possible to do zero-downtime upgrades. Since you’re not upgrading very often, it seems that you’ve got unnecessary complexity.

You need sometihng like this in your web_only.yml:

after_bundle_exec:
  - replace:
    filename: /etc/nginx/conf.d/discourse.conf
    from: "types {"
    to: |
      set_real_ip_from 172.16.0.0/12;
      set_real_ip_from 10.0.0.0/8;
      real_ip_recursive on;
      real_ip_header X-Forwarded-For;
      types {

Thank you very much for your reply.

Yes, it doesn’t matter which one use. They are running the same web_only image. I will continue to look for problems using safe-mode and if there are any conclusions I will report back here.

Sorry for the misunderstanding in my system architecture diagram, I used a different machine to deploy web_only.The reason why I use double web_only is that my web_only container once crashed due to too many connections, but I did not find out the reason at that time. So I tried to use double web_only to avoid the same problem again.

Thanks,this helped me solve the problem of getting the real user ip

إعجاب واحد (1)

That makes sense.

There is a setting to increase the number of connections.

I would upgrade. There should be some issue on that version and I’m pretty sure that several security issues have been fixed since then.

إعجاب واحد (1)

Thanks. At present, I still get the same error when I try to debug in safe mode. I’ll be ready to try upgrading my discourse to see if it works.

إعجاب واحد (1)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.