Persistent formatting errors in app.yml with tabs and spaces


(Chethan Thimmappa) #1

Dear Discourse community,

I need your help in getting my site live again with https support. Our Website community.gaadikey.com which talks about automobiles in India is using a one-click discourse droplet set up… I thought it is good thing to move my site to https and even bought an SSL certificate to install it…

I am new to all this RoR and docker stuff and I went through the instructions provided by Sam on allowing SSL for discourse docker setup . I added new template and added 443 port in app.yml etc …and was facing an issue with a “tab character present” error for hours while editing app.yml file.

Eventually after removing tab character, and adding all required ssl paths, i tried “./launcher rebuild app” etc but I dont know what happend, My site is not live from then, more than 24 hours from now ( and is still offline at this point)… I don’t now what went went wrong, or what mistake I did…

But for now I dont want to lose all the existing activity which happened on our site… Please tell me how I can I find these data ( I know it is somewhere in postgres inside /shared/standalone ) and I can import all this data to an entirely new droplet.

Or If you can help me get past this error in existing setup that will be great too… But I am feeling very uncertain, as my site is down and also want to know in future how can I avoid the downtime while upgrading to ssl or doing something similar.

Looking forward to hear from you… Essentially I want to copy all data in postgres to new droplet ( I read this but couldn’t figure out how to restore content of community )


(Jeff Atwood) #2

Per the error message on your screen, a folder went missing. Did you check what happened to the missing folder?

I would also check df -m disk space and free -m memory as well.


(Chethan Thimmappa) #3

Thanks for the reply Jeff.

According to my knowledge I have not deleted any folder manually. All I did was edited the app.yml file and some invisible “tab character” started troubling me. Spent like 5 to 6 hours to eliminate tab character. In that process, I was curious if that error message is cached or something and wanted to try with different app.yml which I got on internet randomly.

I did “./launcher rebuild app” with that new random app.yml and started seeing all that build messages - the one which shows up for 2 to 3 mins … and didn’t know how to terminate it - (although i pressed Ctrl Z/C)… So ended the session abruptly and rebooted.

Apart from this I did no changes. I can see almost all folders and files… Not sure how to find what is missing? I also did few commands where I removed docker instance etc, and started again etc…

I then somehow removed tab character from original app.yml and tried rebuilding to see the above error message and from then on our community website is down.

I don’t think there is memory issue. This is what I got after doing df - m and free -m …

It all happened because of a single tab character :frowning: , to fix something, i broke something else.

What do you suggest? Should I start fresh ? - My community was like some 15 days old and had invited lot of people to participate in threads … and now everyone is asking me "how to signup :stuck_out_tongue: " and as it is gone down … So was thinking if there are any possibilities to get those registered people and community topics somehow from this? As i can see standalone/postgres and uploads folder - so am hoping somehow I can get it back…


(Chethan Thimmappa) #4

I checked the missing file /root/.ssh/authorized_keys… The file authorized_keys exists, but there is nothing in it??

Ideally, What should it contain?


(Jeff Atwood) #5

If you think it is an app.yml corruption problem perhaps copy your current app.yml to a different backup file name, then copy across the original app.yml per the instructions, then edit it very carefully to change just the essential information as covered in our official setup docs – no stray spaces or tabs.

Memory and disk space look fine.


(Chethan Thimmappa) #6

Some magic is happening now…

I tried this discourse-terraform/app.yml at master · pearkes/discourse-terraform · GitHub and did ./launcher rebuild app

and i can see something building… this is so much better…

Also what is the command to stop building? :smiley:

Now shall I abort and add correct app.yml with careful editing?


(Jeff Atwood) #7

Sure if you think you have a corrupt app.yml that is what I recommend as I said above.


(Chethan Thimmappa) #8

Jeff, I was very delighted to see build things happening for default credentials as present in discourse-terraform/app.yml at master · pearkes/discourse-terraform · GitHub

It all got built so well…

On that same working app.yml I added all credentials like smtp specific my domain with complete attention not to add any tab character… carefully saved it and did “./launcher rebuild app”

Can you believe I get that damn ------ tab error "found a found a tab character where an intendation space is expected while scanning a block scalar at line 19 column 10 " …

This is unbelievable - where is the tab character actually? why is it saying there is tab character… — I have given my 100% attention not to insert a tab, but how can it say i added a tab?" This is where I got struck for 5 to 6 hours solving it…

Is this a tab virus? :frowning:

The new app.yml passes through all online validation tools for YAML… But this is something like “me against computer” … The computer is saying me I have added a tab character, but I have not added it for god sake.


(Jeff Atwood) #9

I don’t know, it looks like the stray character is there, if that is what the error says.


(Chethan Thimmappa) #10

It seems like the computer is blindly saying a stray character is present at line 19, column 10… There is nothing as such… I added few lines by adding 2 comments ##… above,… to check if yaml compiler or whatever finds the stray character at line 21,column 10…

Even then, it still says there is a tab in line 19, column 10… How can this be possible… According to YAML compiler, how can it still see a tab character at same location even after adding 2 lines?


(Kane York) #11

If you’re using the nano editor, you should be able to hold the right arrow key and see if there’s whitespace on the end of the line.


(Chethan Thimmappa) #12

@codinghorror OMG!!! Hurray!!! solved it… That tab character was not present in app.yml instead it was present in /templates/web.ssl.template.yml …

And it all happened because in that SSL tutorial someone posted saying using
return 301 https://$host$request_uri;

speeds up things than using

rewrite ^ https://$$ENV_DISCOURSE_HOSTNAME$request_uri? permanent;

And while editing it to make it faster, I have put a tab character in that template file. That is what caused the whole mess.

No worries now. Everything is alrite and the site is up and running!!! You guys are so supportive and excellent. Was able to solve this problem.

Learnings:

  • Pay attention while copy pasting config files or during manipulating files. tab is such a killer character
  • Don’t blindly believe what YAML throws… in my case it was saying it found tab character in line 19 , column 10 … but it never said in which file it found … we were focussing only on app.yaml file and nothing else
  • Don’t give up
  • Ask questions

The site is now live: https://community.gaadikey.com with all the data :slight_smile: Thank you soo much - this community is super awesome. Special Thanks to Jeff and Sam.


(Sam Saffron) #13

Keep in mind, this YAML tragedy keeps happening to us, we plan to add another more lenient format some time in the next year to alleviate this pain.


(system) #14

(Jeff Atwood) #15

:thinking: in the next year eh?