Rebuild of Discourse fails due to spaces in YAML file

Hey all!
I installed discourse as per How To Install Discourse on Ubuntu 16.04 | DigitalOcean and then tried modifying upload limits using Changing Max Attachment Size.

Unfortunately this lead me to an error

Ensuring launcher is up to date
Fetching origin
Launcher is up-to-date
Stopping old container
+ /usr/bin/docker stop -t 10 app
app
(<unknown>): did not find expected key while parsing a block mapping at line 10 column 1 -e 
LANG=en_US.UTF-8
YAML syntax error. Please check your containers/*.yml config files.

After which i reverted the changes made and still tried a rebuild, causing the same error. Can anyone hint me to here i need a change?

Thanks!
p.

Your containers/app.yml is broken. Probably at or around line 10. Whatever you reverted, it doesn’t seem like you did it correctly.

Hey Matt. Nothing has been changed around that area.
There is a section for custom code, as stated on the second link.
All lined added were removed, so im at the state i was before.
i only ran the rebuild again, because i was wondering if it really was anything i changed that caused it, but since the error persists after reverting, i guess not.

## 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
##
## BE *VERY* CAREFUL WHEN EDITING!
## YAML FILES ARE SUPER SUPER SENSITIVE TO MISTAKES IN WHITESPACE OR ALIGNMENT!
## visit http://www.yamllint.com/ to validate this file as needed

templates:
  - "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
expose:
  - "80:80"   # http
  - "443:443" # https

params:
  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: "1024MB"

  ## 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

env:
  LANG: en_US.UTF-8
   #DISCOURSE_DEFAULT_LOCALE: de

  ## 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
  UNICORN_WORKERS: 4

  ## TODO: The domain name this Discourse instance will respond to
  ## Required. Discourse will not work with a bare IP number.
  DISCOURSE_HOSTNAME: XXX

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

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

Did you try visiting yamllint.com as suggested in the header comment? The alignment on the comment underneath the “LANG” line seems off; I don’t recall if misaligned comments cause problems, but it wouldn’t surprise me, because YAML is a picky bugger like that.

I did just now:

Valid YAML!

Well now, you’ve got yourself a stone cold whodunnit on your hands. Since it was working before you made the changes, it stands to reason that the changes you made are the problem, and you’ve just lost track of exactly what got changed. It’s probably best just to blow away this install and start again with a fresh install, and next time take backups of config files before you change them, so you can cleanly revert if necessary (and get an exact list of changes made using diff).

Urgh. Somehow i dont think that is the case :slight_smile:
“It was working before” is not exactly true, since i never tried to rebuild the app prior to inserting the recommended changes.

Can someone provide me a app.yml of a default installation?

The bottom line was missing 2 leading spaces. So basically wherever the parser was seeing the error had absolutely nothing to do with it :slight_smile:
Thanks anyways.

3 Likes