Chatwoot: Bug: Rake db Initialization Fails

Created on 23 Mar 2020  路  5Comments  路  Source: chatwoot/chatwoot

Describe the bug
Bug: Rake db Initialization Fails when setting up docker development environment

To Reproduce
Steps to reproduce the behavior:

  1. Run docker-compose run --rm rails bundle exec rails db:reset after building the docker image, as per documentation at: https://www.chatwoot.com/docs/installation-guide-docker
  1. See error:
Bundle complete! 69 Gemfile dependencies, 200 gems now installed.
Bundled gems are installed into `/gems`
+ BUNDLE='bundle check'
+ bundle check
The Gemfile's dependencies are satisfied
+ exec bundle exec rails db:reset
rails aborted!
NameError: wrong constant name
/gems/ruby/2.6.0/gems/railties-6.0.2.2/lib/rails/application/bootstrap.rb:53:in `const_get'
/gems/ruby/2.6.0/gems/railties-6.0.2.2/lib/rails/application/bootstrap.rb:53:in `block in <module:Bootstrap>'
/gems/ruby/2.6.0/gems/railties-6.0.2.2/lib/rails/initializable.rb:32:in `instance_exec'
/gems/ruby/2.6.0/gems/railties-6.0.2.2/lib/rails/initializable.rb:32:in `run'
/gems/ruby/2.6.0/gems/railties-6.0.2.2/lib/rails/initializable.rb:61:in `block in run_initializers'
/gems/ruby/2.6.0/gems/railties-6.0.2.2/lib/rails/initializable.rb:60:in `run_initializers'
/gems/ruby/2.6.0/gems/railties-6.0.2.2/lib/rails/application.rb:363:in `initialize!'
/app/config/environment.rb:5:in `<main>'
/gems/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
/gems/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/gems/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/gems/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
/gems/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/gems/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:23:in `require'
/gems/ruby/2.6.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:325:in `block in require'
/gems/ruby/2.6.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:291:in `load_dependency'
/gems/ruby/2.6.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:325:in `require'
/gems/ruby/2.6.0/gems/railties-6.0.2.2/lib/rails/application.rb:339:in `require_environment!'
/gems/ruby/2.6.0/gems/railties-6.0.2.2/lib/rails/application.rb:515:in `block in run_tasks_blocks'
/gems/ruby/2.6.0/gems/railties-6.0.2.2/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/gems/ruby/2.6.0/gems/railties-6.0.2.2/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/gems/ruby/2.6.0/gems/railties-6.0.2.2/lib/rails/command.rb:48:in `invoke'
/gems/ruby/2.6.0/gems/railties-6.0.2.2/lib/rails/commands.rb:18:in `<main>'
/gems/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
/gems/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/gems/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/gems/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
/gems/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/gems/ruby/2.6.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:325:in `block in require'
/gems/ruby/2.6.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:291:in `load_dependency'
/gems/ruby/2.6.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:325:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => db:reset => db:drop => db:load_config => environment
(See full trace by running task with --trace)

Expected behavior
Initialize Postgres Db

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • Building on Docker, docker version 19.03.8, docker-compose version 1.25.4

Most helpful comment

Found problem: default log level in .env evaluates to 1 and breaks db migration: https://github.com/rails/rails/issues/14538.

All 5 comments

Found problem: default log level in .env evaluates to 1 and breaks db migration: https://github.com/rails/rails/issues/14538.

For anyone that is experiencing this problem, I found the way to solve it. Note this is only applicable if you're following the instructions around starting it up for development using docker-compose.

If you copied .env.example into .env then go to line 62 where it says LOG_LEVEL= and change it to:

LOG_LEVEL=info

I'd suggest this be reopened and the .env.example file is updated with this change? I can do it if you would like.

@Kerren-Entrostat We will update that. 馃憤

Was this page helpful?
0 / 5 - 0 ratings