Syntax error in my YAML file

Does anyone knows what could cause this issue by rebuilding app?

Last login: Mon Jan  2 03:50:07 2017 from 122.60.253.1
    root@organic:~# cd /var/discourse
    root@organic:/var/discourse# ./launcher rebuild app
    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>): found character that cannot start any token while scanning for the next token at line 90 column 1 -e LANG=en_US.UTF-8
    YAML syntax error. Please check your containers/*.yml config files.

## Plugins go here
## see https://meta.discourse.org/t/19157 for details
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - mkdir -p plugins
          - git clone https://github.com/discourse/docker_manager.git
          - git clone -b beta https://github.com/gdpelican/babble.git
          - git https://github.com/stereobooster/discourse-vk-login.git
          - cp discourse-vk-login/db/migrate/* db/migrate/
          - git clone https://github.com/communiteq/discourse-adsense.git
          - git clone https://github.com/discourse/discourse-slack-official.git
          - git clone https://github.com/tgxworld/discourse-translator.git
          - git clone https://github.com/defaye/discourse-steam-login.git

Something is wrong with your yml file. Note that yml is incredibly sensitive to whitespace. Try copying your file here: http://www.yamllint.com/. If you still can’t determine the issue, please upload your entire app.yml here for us to take a look. Make sure to remove sensitive information like passwords first!

3 Likes

I’ve got the same issue there by checking :slight_smile:

(<unknown>): found character that cannot start any token while scanning for the next token at line 90 column 1

app.yml (4.9 KB)

What you posted as

is really

Also

You didn’t, so now you should change those.

6 Likes

Now it argues to line 87 :slight_smile:

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

I have a feeling you are missing an important fact about YAML files.

http://www.yaml.org/faq.html

Why does YAML forbid tabs?

Tabs have been outlawed since they are treated differently by different editors and tools. And since indentation is so critical to proper interpretation of YAML, this issue is just too tricky to even attempt.

I don’t know what text editor you are using to edit the file, but I suspect you are using tab to create what visually looks like the correct number of spaces to you, but is not the correct number of spaces.

That is, when you edit, use the space bar and not tab.

6 Likes

I’m using the nano editor thru the terminal to make some changes. However for attaching file here I’ve connected to my Droplet by using Cyberduck and copied the body of the YAML file by using a usual text editor on Mac :slight_smile:

Does nano editor and text editor convert the tab gaps to the space gaps? I’ve just saved that file on the text editor and upload to the containers folder, but didn’t help :slight_smile:

Also, I’m wondering, why the YAML checker didn’t show tab spaces for you, when you checked the app.yml file, if there it could happen? :slight_smile:

Fixed by editing app.yml file via http://www.yamllint.com/

  • Cleared my app.yml by connecting thru Cyberduck (made it blank)
  • Copied and editied the information below
  • The already checked information on http://www.yamllint.com/ copied to my app.yml file with blank field
  • Saved and rebuild the build with plugins
  • Profit :slight_smile:

Thanks for everyone :slight_smile:

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

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

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

      ## TODO: The domain name this Discourse instance will respond to
      DISCOURSE_HOSTNAME: <hostName>

      ## 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: <email list>

      ## TODO: The SMTP mail server used to validate new accounts and send notifications
      DISCOURSE_SMTP_ADDRESS: <address>
      #DISCOURSE_SMTP_PORT: 587                        # (optional, default 587)
      DISCOURSE_SMTP_USER_NAME: <username>
      DISCOURSE_SMTP_PASSWORD: <password>
      #DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)

      ## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate
      #LETSENCRYPT_ACCOUNT_EMAIL: me@example.com

      ## 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
    volumes:
      - 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
    hooks:
      after_code:
        - exec:
            cd: $home/plugins
            cmd:
              - git clone https://github.com/discourse/docker_manager.git

    ## Any custom commands to run after building
    run:
      - 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"
2 Likes