Commit b42669e6 authored by David Lucadou's avatar David Lucadou

Fixed YAML errors and added to the troubleshooting section

I fixed the missing `---` and `...` in the config file example and
added some diagnostic hints for incorrect YAML errors.
parent 3e0e5506
Pipeline #62284547 canceled with stage
......@@ -489,7 +489,7 @@ You'll need to look at the file `shared/log/puma.stderr.log` (I recommend using
...
```
Typically, that means you need to check the Ruby version in use. If you cd into the git directory and rvm outputs this:
This error usually indicates you need to check the Ruby version in use. If you cd into the git directory and rvm outputs this:
```bash
$ cd -
......@@ -538,6 +538,50 @@ Past this, I have not encountered any other causes of 504 errors. `less`-ing the
------
Another potential cause for 504 gateway timeouts is an invalid YAML config. From my `shared/log/puma.stderr.log`:
```ruby
/home/ubuntu/.rvm/gems/ruby-2.5.5/gems/railties-5.2.3/lib/rails/application.rb:2
40:in `rescue in config_for': YAML syntax error occurred while parsing /home/ubu
ntu/git/irc-log-explorer-prod/config/config.yml. Please note that YAML must be c
onsistently indented using spaces. Tabs are not allowed. Error: (<unknown>): did
not find expected key while parsing a block mapping at line 3 column 5 (Runtime
Error)
from /home/ubuntu/.rvm/gems/ruby-2.5.5/gems/railties-5.2.3/lib/rails/app
lication.rb:226:in `config_for'
from /home/ubuntu/.rvm/gems/ruby-2.5.5/gems/railties-5.2.3/lib/rails/rai
ltie.rb:190:in `public_send'
from /home/ubuntu/.rvm/gems/ruby-2.5.5/gems/railties-5.2.3/lib/rails/railtie.rb:190:in `method_missing'
```
The message about indents is a bit misleading, as it implies the error on line 3 column 5 (or wherever in your file) is due to indentation. What you should do is install `yamllint` and run it against the file.
```bash
$ yamllint config/config.yml
4:81 error line too long (141 > 80 characters) (line-length)
4:130 error syntax error: expected <block end>, but found '<scalar>'
```
The line in question:
```yaml
---
default: &default
footer:
append: 'Version 0.8.8 Alpha <a href="https://gitlab.com/dlucadou/irc-log-explorer/blob/development/CHANGELOG.md">(See what\'s new!)</a>'
```
The line too long error can be safely ignored; what matters is that I messed up escaping a single quote - I should have done `''`, not `\'`. After correcting that error, rerunning it returned just the line too long error:
```bash
$ yamllint config/config.yml
4:81 error line too long (141 > 80 characters) (line-length)
```
I then restarted the SystemD service and the application ran as expected.
------
> There are weird CSS and JS errors that I can't reproduce in development mode.
This is usually caused by compiling assets without the `RAILS_ENV` environment variable being set. There are 2 ways to do this:
......
......@@ -25,7 +25,7 @@
<br />
<br />
<div class="justify-content-center text-center">
<p>© 2019 <a href="https://dl.codes/">David Lucadou</a> | <a href="https://gitlab.com/dlucadou/irc-log-explorer">Source Code</a> | <%= link_to 'Terms of Service', policy_tos_path %><%= " | #{Rails.configuration.application['footer']['append']}" if Rails.configuration.application['footer']['append'].to_s.length > 0 %></p>
<p>© 2019 <a href="https://dl.codes/">David Lucadou</a> | <a href="https://gitlab.com/dlucadou/irc-log-explorer">Source Code</a> | <%= link_to 'Terms of Service', policy_tos_path %><%= " | #{Rails.configuration.application['footer']['append']}".html_safe if Rails.configuration.application['footer']['append'].to_s.length > 0 %></p>
</div>
<br />
</div>
......
---
default: &default
footer:
append: 'Development Mode'
......@@ -30,3 +31,4 @@ test:
production:
<<: *default
...
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment