Discourse-app container starts then silently stops

I think you need to comment out the ports.

You mean “before running discourse-setup”? In that case, which file should I modify, as app.yml doesn’t exist before I run the script? I want to install a 1-container app: should I run the same discourse-setup script again or the /var/discourse/launcher rebuild app command?

By the way, is my process above correct?

Edit the existing file with nano or similar and comment out the ports. ./launcher rebuild app.

Probably for your case, you could also use --skip-rebuild as well, so you’d run

./discourse-setup --skip-connection-test --skeip-rebuild
nano containers/app.yml
./launcher rebuild app

Sorry to bother you, I need to be 100% sure as I’m definitely not an expert :wink::

  • I run once again ./discourse-setup --skip-connection-test --skip-rebuild (previous run was without the --skip-rebuild option). I don’t need to delete what has been installed by the previous run.
  • Then I edit the existing app.yml file and comment out the ports (they’re already commented out)
  • Then I run ./launcher rebuild app

Thanks again for your time!

You don’t need to run discourse-setup ever again (unless, perhaps, you change the amount of RAM you have and want it to update the memory settings to the default recommended ones).

Just edit the ports and rebuild

Hi Jay,

Here’s the result of this morning rebuild:

  • ./launcher rebuild app = OK, some warnings, but docker says local_discourse/up is up and running.
  • I’ve setup an nginx site according to instructions given in Run other websites on the same machine as Discourse and restarted nginx = OK.
  • I’ve setup a DNS entry to have discourse.mydomain.com pointing at the server IP address = OK.
  • Opening a browser to discourse.mydomain.com leads me to… the Nextcloud instance running on the server. Seems the configuration should be fixed, as traffic is not properly routed to the discourse container…

I don’t want to install NPM as I read it’s not a robust tool and the config for discourse involves IP hard-coding: should I anyway?

Thanks in advance for your advices!

So this sounds like a problem on your reverse proxy nginx that you have in front of your Discourse installation.

Wait…? What? And why would you need to install NPM outside of the container?

2 Likes

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