Discourse-app container starts then silently stops

Right! I’ve dumbly applied the config in the page listed above, compared to other nginx config files and couldn’t understand why the proxy wouldn’t listen to 80:443 for discourse… :confused:

Here’s what I expected to see:

server {
	listen 80;
	server_name discourse.mydomain.com;
    return 301 https://$host$request_uri;  # routing to https
}

server {
	listen 443 ssl
	listen [::]:443 ssl;
	server_name discourse.mydomain.com;

	ssl_certificate      /etc/letsencrypt/live/discourse.mydomain.com/fullchain.pem;
	ssl_certificate_key  /etc/letsencrypt/live/discourse.mydomain.com/privkey.pem;

	root /var/www/html;

	# Add index.php to the list if you are using PHP
	index index.html index.htm index.nginx-debian.html;

	location / {
      proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock:; # using socket
      proxy_set_header Host $http_host;
      proxy_http_version 1.1;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header X-Real-IP $remote_addr;
	}
}

NPM: I’ve followed @pfaffman’s advide and read Using Nginx Proxy Manager to manage multiple sites with Discourse, so I’ve evaluated the option to install NPM, but this looks overkill…

Thanks to all for your help!

For reference npm, and the nginx proxy manager are different things. You’re confusing your terminology, and thus the people trying to assist you.

2 Likes

Then you need to configure that nginx to proxy to discourse.

I recommend that you just spin up a fresh vm just for Discourse.

1 Like

Sorry Stephen for the confusion, I just used the name of the tool which is referenced in the article. I understand that NPM and nginx (as a) proxy manager are different things, this is why I used capital letters…

This is exactly what I’m trying to do and I understand you cannot support on this. However, any hint / link would be appreciated!

I just can’t Jay: I’m trying to help a friend deploying the app and can’t modify their server configuration. This is why I have to fix the nginx issue…

By the way, my understanding is:

  • Discourse is listening on ports 80/443.
  • nginx is playing the role of a switch, dispatching requests to different applications, base on their domain name:
    • netxcloud.mydomain.com trying to reach the port 80 → request is routed to server_IP:8000
    • crm.mydomain.com trying to reach the port 80 → request is routed to server_IP:9000
    • discourse.mydomain.com trying to reach the port 80 → request is routed to http://unix:/var/discourse/shared/standalone/nginx.http.sock: (hope the trailing colon is not a typo) as the setupo script has configured discourse to listen to this socket.

Am I right on this?

Thanks a lot for your help!

That is rather annoying and confusing, but to be fair to @jlgarnier, that acronym was first used by either @tophee or @pfaffman in Using Nginx Proxy Manager to manage multiple sites with Discourse to refer to Nginx Proxy Manager. I don’t love it, but if it is ‘wrong’, that isn’t really OP’s fault.

For example, the topic has a section called Install NPM focusing entirely on Nginx Proxy Manager.

Wow, that fooled me as well.
Annoying how that project hijacked an existing acronym eight years after the original.

2 Likes

I’m not sure that it has; I’ve browsed their site & not seen them use the acronym themselves.

They do use it in their Docker setups. nginx-proxy-manager/docker-compose.dev.yml at develop · NginxProxyManager/nginx-proxy-manager · GitHub

services:
  npm:
    image: nginxproxymanager:dev
    container_name: npm_core
1 Like

Ah, oops! I hadn’t realised that. :slightly_smiling_face:

Hi all,

I’ll try to setup nginx again this afternoon. Can anyone confirm the exact syntax for the socket: http://unix:/var/discourse/shared/standalone/nginx.http.sock:? I want to make sure that the trailing colon is not a typo…

Thanks in advance for any help!

I don’t think that colon should be there, no.

Indeed… I’ve applied in discourse.conf the modifications I proposed last Friday and Discourse now runs fine! At least I can reach the welcome page but I don’t receive the activation mail, which is not related to Discourse (I suspect my friend didn’t create the requested mail account :blush:).

I owe you a warm thank you for the help you provided and hope I won’t come back on this forum too soon! :wink:

2 Likes

Finally, back sooner than expected but you’ll probably be able to kick me off with your great suggestions! :grin:

The situation is:

  • Discourse up and running, Docker (or Portainer) indicates the container is healthy and I can reach the welcome page forums.mydomain.com.
  • I don’t receive any activation mail, despite the technical mail account has been properly created (hosting provider = OVH).
  • I’ve tested sending an email from this technical account (with the config below) = OK.
  • The current mail config is:
DISCOURSE_SMTP_ADDRESS: ssl0.ovh.net
DISCOURSE_SMTP_PORT: 465
DISCOURSE_SMTP_USER_NAME: forums@mydomain.com
DISCOURSE_SMTP_PASSWORD: "Str0ngPassw0rd"
DISCOURSE_SMTP_ENABLE_START_TLS: false
DISCOURSE_SMTP_DOMAIN: mydomain.com
DISCOURSE_NOTIFICATION_EMAIL: noreply-forums@mydomain.com

I don’t really know where I should start investigating and would be happy with any advice!

Thanks in advance for your help!

First thing I’ll check is that if forums@mydomain.com has been configured to send on behalf of noreply-forums@mydomain.com it needs to be checked at your email provider.

1 Like

I’m not sure this address can send ‘on behalf on’, so I’ve updated app.yml to set the same address:

DISCOURSE_SMTP_ADDRESS: ssl0.ovh.net
DISCOURSE_SMTP_PORT: 465
DISCOURSE_SMTP_USER_NAME: forums@mydomain.com
DISCOURSE_SMTP_PASSWORD: "Str0ngPassw0rd"
DISCOURSE_SMTP_ENABLE_START_TLS: false
DISCOURSE_SMTP_DOMAIN: mydomain.com
DISCOURSE_NOTIFICATION_EMAIL: forums@mydomain.com

Tried to telnet ssl0.ovh.net 465 = OK

However discourse-doctor reports:

========================================
Discourse 2.9.0.beta9
Discourse version at forums.mydomain.com: Discourse 2.9.0.beta9
Discourse version at localhost: NOT FOUND
==================== DNS PROBLEM ====================
This server reports NOT FOUND, but forums.mydomain.com reports Discourse 2.9.0.beta9 .
This suggests that you have a DNS problem or that an intermediate proxy is to blame.

[...]

Testing sending to myprivatemail@yahoo.fr using ssl0.ovh.net:465, username:forums@mydomain.com with plain auth.
======================================== ERROR ========================================
                                    UNEXPECTED ERROR

Net::ReadTimeout

====================================== SOLUTION =======================================

Could the mail issue be linked to the alleged DNS issue? I don’t have an “intermediate proxy”, just running nginx as the proxy web server…

This is probably your problem. Can you try a different port? I’ve seen best results with port 587 if that’s supported by your email provider.

You’ll need to comment this out or set it to true if you change port to 587

No, my email provider (same as hosting provider) only allows port 465. By the way, I’ve read that I need to set SPF and DKIM record for the domain (is this subdomain?) and I didn’t set any of these yet: could this have any impact?

See Troubleshoot email on a new Discourse install

1 Like

I’m browsing the post but I’ve forgotten some information:

  • The DNS is managed by our hosting provider (for some services), let’s say on ServerA.
  • Discourse is running on another server (ServerB) which is hosted by a different provider.

My understanding is then: Discourse on ServerB connects to the mail server on ServerA, authenticating with email/password to use the SMTP service provided by ServerA hosting provider.

Is this a abnormal config or may I still use the normal app.yml email config here?