Discourse-app container starts then silently stops

Dear Community,

I’ve tried to install a private instance of Discourse, following the official instructions at discourse/INSTALL-cloud.md at main · discourse/discourse · GitHub. Even though the scripts look utterly complex, I had to manually modify the container.yml and the discourse-setup files to set my own settings…

1st issue : despite its complexity, the installation script doesn’t allow for exposed port modification! Ports 80/443 can’t be used on my server, being used by nginx. So I had once again to tweak the setup script to set ports 3080/3443 as the required ports to access Discourse.

Then I managed to have all containers up and running. Looking at the stack with Portainer, I found out that the application starts and silently stops and the logs don’t give much information on the reason. As redis and postgres don’t publish any port, could the discourse app fails because it cannot connect to these components? What did I miss or do wrong?

_discourse-app_logs.txt (10,4 Ko)

Thanks in advance for any help!

Caused by:

Errno::EADDRNOTAVAIL: Cannot assign requested address - connect(2) for [::1]:6379

So it’s unable to connect to Redis on the IPv6 loopback address.

Hi Richard, thanks for the quick answer! I’m not an IT professional, just like to play with tools: what would be the fix for this issue?

Thanks in advance for your advice!

It seems like you have deviated from the standard install by setting up separate containers for Redis and Postgres, so I’m afraid I don’t have an out of the box answer for you. How did you configure the Redis settings within Discourse?

Another thing - I do see redis:4-alpine. I’m afraid you’ll need to move to a newer version of Redis since Discourse requires version 6.20 or higher. I don’t think this is the cause of your issue though.

2 Likes

The setup script works only for a standard setup. If you’re doing something more complex you have to edit the yml by hand. That’s much simpler than modifying the script.

Discourse won’t work on a non standard port. You’ll need a reverse proxy in front. See topics like Run other websites on the same machine as Discourse.

If you’re not going to use the provided postgres and redis then you’re on your own figuring out why yours doesn’t work. There are too many things that it could be that we cannot guess or infer. I’d recommend a standard install on a separate vm to see how things work before trying a very complex setup.

3 Likes

I didn’t perform any ‘non-standard’ install! I’ve, as actually described in the documentation, download the whole stuff from Github, changed the exposed ports only and ran the script:

  • I didn’t change anything in redis configuration, nor postgres.
  • I didn’t change anything for redis version.
    These pieces of software have been installed by the genuine discourse-setup script.

@pfaffman what do you mean by “editing the yml by hand”? Which yml do you talk about? There are plenty of .yml files in “containers”…

By the way, I have actually a reverse proxy on the box, which seems to have a simple config: multiple subdomain.conf files which define the redirection subdomain:80 → port XXX. Is it what’s required?

I’d recommend a standard install on a separate vm to see how things work before trying a very complex setup.

I don’t want a complex setup :blush:, just need to run Discourse along some other containers, which is what Docker is designed for…

Thanks again for your help!

In general discourse-setup does not install separate postgres and redis instances and certainly not versions 12 and 4.

Can you please post your configuration and the changes you made to container.yml and the scripts? Make sure to redact any confidential settings.
Also, please let us know which commit of the discourse_docker repository you’re at.

3 Likes

You edited both the discourse-setup and a file that will be overwritten when you update discourse-docker. Changing anything other than your app.yml is decidedly non-standard.

Why? And whatever it is that you needed to change there, that’s not how to do it. You’ll need to put those changes into your app.yml.

Discourse won’t work on a non-standard port, so this is not a standard install.

The standard install includes postgres and redis in the single container. As pointed out, you’re using unsupported versions of redis and postgres. You can also do a two container installation as described here Move from standalone container to separate web and data containers (and you can use ./discourse-setup --two-container to have discourse-setup create separate data and web containers, though it’s a bit more complicated to mainain (you have to know when to update the data container).

1 Like

OK, I then need to:

  • wipe all the software that was installed with the modified scripts (hope this will easily reversible).
  • download the script again. I’ve used git clone https://github.com/discourse/discourse_docker.git /var/discourse for the current installation: is it OK?
  • change possibly some settings in the file app.yml only, before running ./discourse-setup.
  • run the installation script for standard install (I do prefer one single container).
  • setup the nginx proxy to route discourse.example.com:80/443 to the proper container. Does the documentation give hints for this part?

Please complete the list if I skipped any step!

Thanks again for your help!

:white_check_mark:

See Run other websites on the same machine as Discourse

2 Likes

The only thing it will install is docker.

Looks good.

app.yml gets created by discourse-setup. You can’t run discourse-setup if it can’t access the ports, but if you read the source you’ll see that you can ./discourse-setup --skip-connection-test and run it anyway.

Your nginx will be responsible for let’s encrypt, so you’ll want to comment out the let’s encrypt template. I suspect that’s described in the reverse proxy topic linked above and below.

See Using Nginx Proxy Manager to manage multiple sites with Discourse or Run other websites on the same machine as Discourse (which has already been linked).

1 Like

Hi @pfaffman,

Reading the documentation on Run other websites on the same machine as Discourse, I need some confirmation:

  • The post says

You cannot use ./discourse-setup to set up Discourse if another server is using port 80 or 443. You will need to copy and edit samples/standalone.yml with your favorite text editor.

and I understand that I need to modify app.yml before running discourse-setup, as already said in the preamble

You cannot use ./discourse-setup to set up Discourse if another server is using port 80 or 443. You will need to copy and edit samples/standalone.yml with your favorite text editor.

Can you then please confirm the following process:

  • download the whole stuff from Github
  • run discourse-setup once with the option --skip-connection-test → this will create the containers/app.yml
  • modify app.yml as decribed in the documentation above
  • update the software with /var/discourse/launcher rebuild app
  • create the nginx site to point to the Discourse socket and restart nginx
  • finally launch a browser to access Discourse at https://discourse.mydomain.com, which simply points to the server IP.

Thanks in advance for your advice!

Update:

  • download the whole stuff from Github : DONE
  • run discourse-setup once with the option --skip-connection-test : everything went fine until the end, where the script returned
docker: Error response from daemon: driver failed programming external connectivity on endpoint app (784361985c928eb26b149d829f37882056562d9b1e77ef4ce71fbfe30c5d80b1): Error starting userland proxy: listen tcp4 0.0.0.0:443: bind: address already in use.

This looks normal to me, as the container tries to access the same ports than the existing webserver. However, as no discourse container has been created (as returned by docker container ls), I’d like you to confirm this before going further with the nginw config…

Thanks in advance for your help!

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