In a discussion titled “I want to keep PostgreSQL database on separate server [standard docker install]”, kuaza reports encountering a YAML syntax error when trying to configure Discourse to use a remote PostgreSQL server, specifically pointing to line 40 and the LANG=en_US.UTF-8 line. The error persists even after removing the problematic lines, suggesting a misconfiguration. Falco identifies the issue as likely stemming from incorrect indentation in the app.yml file, emphasizing that all database configuration keys (like DISCOURSE_DB_HOST, DISCOURSE_DB_USERNAME, etc.) must be properly indented under the env section. Falco recommends using a YAML validator like http://www.yamllint.com/ to catch such formatting errors. kuaza confirms the solution worked and thanks Falco for the help, admitting they overlooked a whitespace issue.
I tried everything but I always get this error. I tried the methods below but I get the same error every time.
Error:
./launcher rebuild app
x86_64 arch detected.
Ensuring launcher is up to date
Fetching origin
Launcher is up-to-date
Stopping old container
+ /usr/bin/docker stop -t 60 app
app
(<unknown>): did not find expected key while parsing a block mapping at line 40 column 3 -e LANG=en_US.UTF-8
YAML syntax error. Please check your containers/*.yml config files.
Is it not working because it is a standard installation? thank you for helping.
Thanks for your interest but I’m not making mistakes, I’ve tried every possible way. It gives the error only when I add these codes. It doesn’t give an error when I remove it. and I remove the code in the line where it gives an error, interestingly it gives the same error again. in the error code LANG=en_US.UTF-8
YAML is white-space indented and it’s very easy to make mistakes like this if you aren’t familiar with it and very careful.
Every one of those must be under the env section and following the same identation level as other similar keys. You can leverage tools like http://www.yamllint.com/ to validate your configuration.