Wat is het doel van DISCOURSE_HOSTNAME env?

AI-generated summary

In a discussion titled ‘What’s the purpose of DISCOURSE_HOSTNAME env?’, Marcin_J questions the necessity of the DISCOURSE_HOSTNAME environment variable and the --mac-address Docker flag, noting that Discourse runs without them. pfaffman suggests DISCOURSE_HOSTNAME populates config/discourse.conf, which Rails uses for configuration, and advises always setting it to avoid unpredictable failures. Regarding --mac-address, supermathie explains it ensures consistent IPv6 addresses during container replacements, useful for deployments, but is optional if not needed. pfaffman humorously celebrates the explanation. Marcin_J further asks about config/discourse.conf and the role of DOCKER_HOST_IP, suspecting the latter is only needed for web-based upgrades. pfaffman reiterates that omitting DISCOURSE_HOSTNAME risks silent failures, potentially at inconvenient times, and admits limited knowledge of discourse.conf beyond its Rails config role. The consensus leans toward keeping these settings for stability, even if they appear optional in basic setups.

Hi,
I’ve been experimenting a bit with Discourse installation. I noticed that by default the Docker container is started with the DISCOURSE_HOSTNAME environment variable. I tried to start the container without this env and it works fine as well.

I tried to look for this env in the code repository, but the results are not really interesting. (Repository search results · GitHub)

What is the purpose of this env?

Similarly, I also tried removing the --mac-address setting from docker’s run command - the app works as before. Why is --mac-address needed?

I’m pretty sure that makes hostname appear in the config/discourse.conf file. I’d recommend that you always set it.

The --mac-address is something of a mystery to me. I think it has to do with something in their internal hosting. I’m pretty certain that it’s safe to leave that off.

Consistent MAC addresses on the containers would give us consistent container IPv6 addresses which is useful when replacing containers during a deployment.

I don’t think it’s used for anything else.

You can skip it if you don’t need it.

Ooooh! The mystery is solved! And a chance to see Matt Palmer! If I had 100 likes, I’d apply them here.

@pfaffman Could you say something more about the config/discourse.conf file? What is its purpose? I saw some references to it on the Internet, but it seems like it is something similar to containers/app.yml?

What will happen in practice if I do not provide DISCOURSE_HOSTNAME?

Another thing I realized - by default Discourse also is being run with the DOCKER_HOST_IP env. Again, I removed it, and Discourse works fine. I suppose that this one is somehow used during Upgrade process. Is that right? If I do not plan to upgrade Discourse via the web UI, I guess I don’t need it…

Since you asked me specifically . . . sort-of, it’s where Rails gets its config. That’s not a very good answer, but it’s my best free answer. But we’re getting some really great free answers here, so maybe you’ll get a better one. :wink:

I don’t know, but there isn’t much reason to find out. Either it will work, or it will fail one day and you’ll have no reason why and no one else will either.

And, in my experience, it’ll happen during your Christmas holiday and one of your most important sites will be down for 18 hours until you finally give up and re-configure the site from scratch.