Updated Discourse, broke my app.yml?


A few months ago I installed a very basic Discourse forum. I forgot about it for a while and a few days ago I did the in-browser update at the request of the admin alert (my forum is currently down, so I’m afraid I can’t supply screenshots or exact quotes of what happened). I refreshed the page, and the “please update” alert was still there. I went to the update page and it said I needed to do an update via command line; ssh into the server and use the following commands:

cd /var/discourse/
git pull
./launcher rebuild app

I did so, and got the following error:

(<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.

I did not change the app.yml file, and the forum was working fine before the update; now “this site can’t be reached” and “refused to connect”. Nothing looks out of place in my app.yml file. I’ve tried using http://www.yamllint.com/, but that hasn’t helped. I’ve messed around with the whitespace and managed to get a valid .yml file, but the resulting near-empty .yml file hasn’t brought back the forum.

I’ve also tried

apt-get clean
./launcher cleanup app
./launcher rebuild app

Which doesn’t work, either.

Here’s the app.yml file. I’m pretty sure I’ve removed any sensitive information.

## this is the all-in-one, standalone Discourse Docker container template
## After making changes to this file, you MUST rebuild
## /var/discourse/launcher rebuild app
## visit http://www.yamllint.com/ to validate this file as needed

  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"
## Uncomment these two lines if you wish to add Lets Encrypt (https)
  #- "templates/web.ssl.template.yml"
  #- "templates/web.letsencrypt.ssl.template.yml"

## which TCP/IP ports should this container expose?
## If you want Discourse to share a port with another webserver like Apache or nginx,
## see https://meta.discourse.org/t/17247 for details
  - "80:80"   # http
  - "443:443" # https

  db_default_text_search_config: "pg_catalog.english"

  ## Set db_shared_buffers to a max of 25% of the total memory.
  ## will be set automatically by bootstrap based on detected RAM, or you can override
  db_shared_buffers: "128MB"

  ## can improve sorting performance, but adds memory usage per-connection
  #db_work_mem: "40MB"

  ## Which Git revision should this container use? (default: tests-passed)
  #version: tests-passed

  LANG: en_US.UTF-8  ###This is the "offending" line###

  ## How many concurrent web requests are supported? Depends on memory and CPU cores.
  ## will be set automatically by bootstrap based on detected CPUs, or you can override

  ## TODO: The domain name this Discourse instance will respond to

  ## Uncomment if you want the container to be started with the same
  ## hostname (-h option) as specified above (default "$hostname-$config")

  ## TODO: List of comma delimited emails that will be made admin and developer
  ## on initial signup example 'user1@example.com,user2@example.com'

  ## TODO: The SMTP mail server used to validate new accounts and send notifications
  #DISCOURSE_SMTP_PORT: 587                        # (optional, default 587)
  #DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)

  ## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate

  ## The CDN address for this Discourse instance (configured to pull)
  ## see https://meta.discourse.org/t/14857 for details
  #DISCOURSE_CDN_URL: //discourse-cdn.example.com

## The Docker container is stateless; all data is stored in /shared
  - volume:
      host: /var/discourse/shared/standalone
      guest: /shared
  - volume:
      host: /var/discourse/shared/standalone/log/var-log
      guest: /var/log

## Plugins go here
## see https://meta.discourse.org/t/19157 for details
    - exec:
        cd: $home/plugins
          - git clone https://github.com/discourse/docker_manager.git

## Any custom commands to run after building
  - exec: echo "Beginning of custom commands"
  ## If you want to set the 'From' email address for your first registration, uncomment and change:
  ## After getting the first signup email, re-comment the line. It only needs to run once.
  #- exec: rails r "SiteSetting.notification_email='info@unconfigured.discourse.org'"
  - exec: echo "End of custom commands"

Not sure where to go from here. I’m not sure if a fresh install would wipe out the users and threads, or if where that data is stored so that I could back it up. I’m hoping that I’m a single whitespace away from a functioning .yml file or something, but I have no idea what to expect.

(Mittineague) #2

I’m certainly not an expert about minimum requirements., but going by this I’d guess you had not tried an upgrade before this and the process needs more memory to be able to complete.

  ## Set db_shared_buffers to a max of 25% of the total memory.
  ## will be set automatically by bootstrap based on detected RAM, or you can override
  db_shared_buffers: "128MB"


I do remember updating once or twice shortly after the initial installation and didn’t have any problems.
Do you really think that insufficient RAM would trigger an “invalid YML” problem?


You can try to create a swap file (it takes 2 minutes) :

If Mittineague is right, that should help you go trough the rebuild

(cpradio) #5

Just by looking your YML looks good to me. Have you run it through yamllint? That’s where I’d start first. Beyond that, I’m unsure, as Discourse during upgrades doesn’t touch your app.yml. It will touch the templates but those shouldn’t throw the error you have above (I wouldn’t think).


Yeah, I used yamllint and it gave the same error as I gave above:

(<unknown>): did not find expected key while parsing a block mapping at line 40 column 3

I also tried making the swapfile, but I couldn’t tell which directory I needed to be in (didn’t understand “opened to your droplet”). Running the first line gave the error

install: cannot remove ‘/swapfile’: Operation not permitted

I tried in the “discourse” directory and the root directory for the server.

(Mittineague) #7

Hmm, I just did a copy-paste of the app.yml you previously posted and it passed fine.

Make sure that line begins with a 2 spaces indent and not a 2 space-tab indent.

(cpradio) #8

Then what you pasted here doesn’t match what you have in your app.yml. As what is pasted parses just fine.

Swap won’t solve a yaml error. That is purely 100% an issue with your app.yml file. However, if you still want to setup swap, please follow


cpradio, you posted the exact same link that Steven did, and I explained how it wasn’t clear/didn’t work.

As for the yml file, I replaced the sensitive fields with stuff like <password> and <email list>. Of course it doesn’t match what’s in my yml file (that’s the point). However… that was a pretty good hint to go look at the fields I replaced. Went through and found that for <email list> I had


Which is NOT how the example says to do it. I removed the two middle single quotation marks and the yml parsed and the forum updated. I got a “502 Bad Gateway”, but a quick search told me to do

./launcher cleanup
./launcher start app

And my site is up and running. No clue why it was running before the update and died right after, but that’s not really important now. Thanks for the help, everyone.

(cpradio) #10

Okay, to clarify.

‘opened to your droplet’ simply means SSH’d into your droplet. As for the error you received, it could be that you already have swap enabled. If you run the command free -m, does it have a line pertaining to swap already? If so, are the values higher than 0? And if they are, you already have swap, the bigger question is, what are the values? (to determine if you have enough swap and a screenshot of the entire free -m output would be preferred)

That makes perfect sense. I would have never guessed that the developer email list could be the problem, I’ve never seen that error related to that before. So I’m glad you discovered that. :slight_smile: