Rails Console Error: FATAL: Peer authentication failed for user "discourse"


(Chris Croome) #1

Sorry to ask a basic question which is similar to other threads, but I couldn’t find a thread that had a solution to this, also sorry if I’m doing something daft here (it wouldn’t be the first time ;-)).

On a Debian Stretch server running the standalone Docker Discourse I’m getting an error when trying to use the Rails console, this is what is happening:

ssh root@example.org
su - discourse
cd /var/discourse
./launcher enter app
rails c
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/pg-0.20.0/lib/pg.rb:56:in `initialize': FATAL:  Peer authentication failed for user "discourse" (PG::ConnectionBad)
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/pg-0.20.0/lib/pg.rb:56:in `new'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/pg-0.20.0/lib/pg.rb:56:in `connect'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:695:in `connect'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:220:in `initialize'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `new'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `postgresql_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:759:in `new_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:803:in `checkout_new_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:782:in `try_to_checkout_new_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:743:in `acquire_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:500:in `checkout'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in `connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `retrieve_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:116:in `retrieve_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:88:in `connection'
        from /var/www/discourse/lib/site_settings/db_provider.rb:62:in `table_exists?'
        from /var/www/discourse/lib/site_settings/db_provider.rb:21:in `find'
        from /var/www/discourse/lib/site_settings/defaults_provider.rb:109:in `block in refresh_site_locale!'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rails_multisite-1.1.0.rc4/lib/rails_multisite/connection_management.rb:126:in `block in each_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rails_multisite-1.1.0.rc4/lib/rails_multisite/connection_management.rb:124:in `each'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rails_multisite-1.1.0.rc4/lib/rails_multisite/connection_management.rb:124:in `each_connection'
        from /var/www/discourse/lib/site_settings/defaults_provider.rb:103:in `refresh_site_locale!'
        from /var/www/discourse/lib/site_settings/defaults_provider.rb:20:in `initialize'
        from /var/www/discourse/lib/site_setting_extension.rb:35:in `new'
        from /var/www/discourse/lib/site_setting_extension.rb:35:in `defaults'
        from /var/www/discourse/lib/site_setting_extension.rb:69:in `block in setting'
        from /var/www/discourse/lib/site_setting_extension.rb:68:in `synchronize'
        from /var/www/discourse/lib/site_setting_extension.rb:68:in `setting'
        from /var/www/discourse/app/models/site_setting.rb:17:in `block in load_settings'
        from /var/www/discourse/lib/site_settings/yaml_loader.rb:25:in `block (2 levels) in load'
        from /var/www/discourse/lib/site_settings/yaml_loader.rb:11:in `each'
        from /var/www/discourse/lib/site_settings/yaml_loader.rb:11:in `block in load'
        from /var/www/discourse/lib/site_settings/yaml_loader.rb:10:in `each_key'
        from /var/www/discourse/lib/site_settings/yaml_loader.rb:10:in `load'
        from /var/www/discourse/app/models/site_setting.rb:16:in `load_settings'
        from /var/www/discourse/app/models/site_setting.rb:21:in `<class:SiteSetting>'
        from /var/www/discourse/app/models/site_setting.rb:4:in `<top (required)>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:379:in `block in require_or_load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:36:in `block in load_interlock'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/concurrency/share_lock.rb:149:in `exclusive'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies/interlock.rb:11:in `loading'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:36:in `load_interlock'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:357:in `require_or_load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:510:in `load_missing_constant'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:202:in `const_missing'
        from /var/www/discourse/config/initializers/004-message_bus.rb:84:in `<top (required)>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `block in load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:655:in `block in load_config_initializer'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb:168:in `instrument'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:654:in `load_config_initializer'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:612:in `block (2 levels) in <class:Engine>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:611:in `each'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:611:in `block in <class:Engine>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `instance_exec'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `run'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:59:in `block in run_initializers'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:48:in `each'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:48:in `tsort_each_child'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:415:in `call'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:415:in `each_strongly_connected_component_from'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `each'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `call'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:58:in `run_initializers'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application.rb:353:in `initialize!'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `public_send'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `method_missing'
        from /var/www/discourse/config/environment.rb:5:in `<top (required)>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application.rb:329:in `require_environment!'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command/actions.rb:16:in `require_application_and_environment!'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands/console/console_command.rb:96:in `perform'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

So I thought I’d try as the discourse user in the container rather than root, in the container:

su - discourse
cd /var/www/discourse/
rails c
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:699:in `rescue in connect': FATAL:  database "discourse_development" does not exist (ActiveRecord::NoDatabaseError)
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:695:in `connect'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:220:in `initialize'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `new'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `postgresql_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:759:in `new_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:803:in `checkout_new_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:782:in `try_to_checkout_new_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:743:in `acquire_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:500:in `checkout'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in `connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `retrieve_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:116:in `retrieve_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:88:in `connection'
        from /var/www/discourse/lib/site_settings/db_provider.rb:62:in `table_exists?'
        from /var/www/discourse/lib/site_settings/db_provider.rb:21:in `find'
        from /var/www/discourse/lib/site_settings/defaults_provider.rb:109:in `block in refresh_site_locale!'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rails_multisite-1.1.0.rc4/lib/rails_multisite/connection_management.rb:126:in `block in each_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rails_multisite-1.1.0.rc4/lib/rails_multisite/connection_management.rb:124:in `each'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rails_multisite-1.1.0.rc4/lib/rails_multisite/connection_management.rb:124:in `each_connection'
        from /var/www/discourse/lib/site_settings/defaults_provider.rb:103:in `refresh_site_locale!'
        from /var/www/discourse/lib/site_settings/defaults_provider.rb:20:in `initialize'
        from /var/www/discourse/lib/site_setting_extension.rb:35:in `new'
        from /var/www/discourse/lib/site_setting_extension.rb:35:in `defaults'
        from /var/www/discourse/lib/site_setting_extension.rb:69:in `block in setting'
        from /var/www/discourse/lib/site_setting_extension.rb:68:in `synchronize'
        from /var/www/discourse/lib/site_setting_extension.rb:68:in `setting'
        from /var/www/discourse/app/models/site_setting.rb:17:in `block in load_settings'
        from /var/www/discourse/lib/site_settings/yaml_loader.rb:25:in `block (2 levels) in load'
        from /var/www/discourse/lib/site_settings/yaml_loader.rb:11:in `each'
        from /var/www/discourse/lib/site_settings/yaml_loader.rb:11:in `block in load'
        from /var/www/discourse/lib/site_settings/yaml_loader.rb:10:in `each_key'
        from /var/www/discourse/lib/site_settings/yaml_loader.rb:10:in `load'
        from /var/www/discourse/app/models/site_setting.rb:16:in `load_settings'
        from /var/www/discourse/app/models/site_setting.rb:21:in `<class:SiteSetting>'
        from /var/www/discourse/app/models/site_setting.rb:4:in `<main>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:63:in `load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:63:in `load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:476:in `block in load_file'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:661:in `new_constants_in'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:475:in `load_file'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:374:in `block in require_or_load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:36:in `block in load_interlock'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/concurrency/share_lock.rb:149:in `exclusive'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies/interlock.rb:11:in `loading'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:36:in `load_interlock'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:357:in `require_or_load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:510:in `load_missing_constant'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/active_support.rb:53:in `block in load_missing_constant'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/active_support.rb:6:in `with_bootsnap_fallback'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/active_support.rb:53:in `load_missing_constant'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:202:in `const_missing'
        from /var/www/discourse/config/initializers/004-message_bus.rb:84:in `<main>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `block in load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:655:in `block in load_config_initializer'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb:168:in `instrument'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:654:in `load_config_initializer'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:612:in `block (2 levels) in <class:Engine>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:611:in `each'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:611:in `block in <class:Engine>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `instance_exec'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `run'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:59:in `block in run_initializers'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:48:in `each'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:48:in `tsort_each_child'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:415:in `call'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:415:in `each_strongly_connected_component_from'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `each'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `call'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:58:in `run_initializers'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application.rb:353:in `initialize!'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `public_send'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `method_missing'
        from /var/www/discourse/config/environment.rb:5:in `<main>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application.rb:329:in `require_environment!'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command/actions.rb:16:in `require_application_and_environment!'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands/console/console_command.rb:96:in `perform'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<main>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
        from bin/rails:4:in `<main>'

Any suggestions?


(Daniela) #2

I have no problems on Ubuntu with:

ssh root@example.org
cd /var/discourse
./launcher enter app
rails c

without using su - discourse


(Chris Croome) #3

Thanks @Trash but the discourse user on the server is in the docker group so that shouldn’t make a difference, and it doesn’t appear to:

ssh root@example.org
cd /var/discourse
./launcher enter app
rails c
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/pg-0.20.0/lib/pg.rb:56:in `initialize': FATAL:  Peer authentication failed for user "discourse" (PG::ConnectionBad)
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/pg-0.20.0/lib/pg.rb:56:in `new'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/pg-0.20.0/lib/pg.rb:56:in `connect'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:695:in `connect'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:220:in `initialize'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `new'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `postgresql_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:759:in `new_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:803:in `checkout_new_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:782:in `try_to_checkout_new_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:743:in `acquire_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:500:in `checkout'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in `connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `retrieve_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:116:in `retrieve_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:88:in `connection'
        from /var/www/discourse/lib/site_settings/db_provider.rb:62:in `table_exists?'
        from /var/www/discourse/lib/site_settings/db_provider.rb:21:in `find'
        from /var/www/discourse/lib/site_settings/defaults_provider.rb:109:in `block in refresh_site_locale!'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rails_multisite-1.1.0.rc4/lib/rails_multisite/connection_management.rb:126:in `block in each_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rails_multisite-1.1.0.rc4/lib/rails_multisite/connection_management.rb:124:in `each'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rails_multisite-1.1.0.rc4/lib/rails_multisite/connection_management.rb:124:in `each_connection'
        from /var/www/discourse/lib/site_settings/defaults_provider.rb:103:in `refresh_site_locale!'
        from /var/www/discourse/lib/site_settings/defaults_provider.rb:20:in `initialize'
        from /var/www/discourse/lib/site_setting_extension.rb:35:in `new'
        from /var/www/discourse/lib/site_setting_extension.rb:35:in `defaults'
        from /var/www/discourse/lib/site_setting_extension.rb:69:in `block in setting'
        from /var/www/discourse/lib/site_setting_extension.rb:68:in `synchronize'
        from /var/www/discourse/lib/site_setting_extension.rb:68:in `setting'
        from /var/www/discourse/app/models/site_setting.rb:17:in `block in load_settings'
        from /var/www/discourse/lib/site_settings/yaml_loader.rb:25:in `block (2 levels) in load'
        from /var/www/discourse/lib/site_settings/yaml_loader.rb:11:in `each'
        from /var/www/discourse/lib/site_settings/yaml_loader.rb:11:in `block in load'
        from /var/www/discourse/lib/site_settings/yaml_loader.rb:10:in `each_key'
        from /var/www/discourse/lib/site_settings/yaml_loader.rb:10:in `load'
        from /var/www/discourse/app/models/site_setting.rb:16:in `load_settings'
        from /var/www/discourse/app/models/site_setting.rb:21:in `<class:SiteSetting>'
        from /var/www/discourse/app/models/site_setting.rb:4:in `<top (required)>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:379:in `block in require_or_load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:36:in `block in load_interlock'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/concurrency/share_lock.rb:149:in `exclusive'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies/interlock.rb:11:in `loading'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:36:in `load_interlock'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:357:in `require_or_load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:510:in `load_missing_constant'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:202:in `const_missing'
        from /var/www/discourse/config/initializers/004-message_bus.rb:84:in `<top (required)>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `block in load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:655:in `block in load_config_initializer'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb:168:in `instrument'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:654:in `load_config_initializer'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:612:in `block (2 levels) in <class:Engine>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:611:in `each'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:611:in `block in <class:Engine>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `instance_exec'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `run'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:59:in `block in run_initializers'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:48:in `each'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:48:in `tsort_each_child'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:415:in `call'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:415:in `each_strongly_connected_component_from'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `each'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `call'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:58:in `run_initializers'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application.rb:353:in `initialize!'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `public_send'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `method_missing'
        from /var/www/discourse/config/environment.rb:5:in `<top (required)>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application.rb:329:in `require_environment!'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command/actions.rb:16:in `require_application_and_environment!'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands/console/console_command.rb:96:in `perform'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

(Chris Croome) #4

Does anybody have any suggestions regarding how to debug this problem?


(Mittineague) #5

There is obviously a problem that involves the database.

What happens if you do rails db instead of rails c ?


(Chris Croome) #6

You are right:

rails db
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/pg-0.20.0/lib/pg.rb:56:in `initialize': FATAL:  Peer authentication failed for user "discourse" (PG::ConnectionBad)
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/pg-0.20.0/lib/pg.rb:56:in `new'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/pg-0.20.0/lib/pg.rb:56:in `connect'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:695:in `connect'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:220:in `initialize'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `new'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `postgresql_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:759:in `new_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:803:in `checkout_new_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:782:in `try_to_checkout_new_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:743:in `acquire_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:500:in `checkout'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in `connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `retrieve_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:116:in `retrieve_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:88:in `connection'
        from /var/www/discourse/lib/site_settings/db_provider.rb:62:in `table_exists?'
        from /var/www/discourse/lib/site_settings/db_provider.rb:21:in `find'
        from /var/www/discourse/lib/site_settings/defaults_provider.rb:109:in `block in refresh_site_locale!'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rails_multisite-1.1.0.rc4/lib/rails_multisite/connection_management.rb:126:in `block in each_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rails_multisite-1.1.0.rc4/lib/rails_multisite/connection_management.rb:124:in `each'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rails_multisite-1.1.0.rc4/lib/rails_multisite/connection_management.rb:124:in `each_connection'
        from /var/www/discourse/lib/site_settings/defaults_provider.rb:103:in `refresh_site_locale!'
        from /var/www/discourse/lib/site_settings/defaults_provider.rb:20:in `initialize'
        from /var/www/discourse/lib/site_setting_extension.rb:35:in `new'
        from /var/www/discourse/lib/site_setting_extension.rb:35:in `defaults'
        from /var/www/discourse/lib/site_setting_extension.rb:69:in `block in setting'
        from /var/www/discourse/lib/site_setting_extension.rb:68:in `synchronize'
        from /var/www/discourse/lib/site_setting_extension.rb:68:in `setting'
        from /var/www/discourse/app/models/site_setting.rb:17:in `block in load_settings'
        from /var/www/discourse/lib/site_settings/yaml_loader.rb:25:in `block (2 levels) in load'
        from /var/www/discourse/lib/site_settings/yaml_loader.rb:11:in `each'
        from /var/www/discourse/lib/site_settings/yaml_loader.rb:11:in `block in load'
        from /var/www/discourse/lib/site_settings/yaml_loader.rb:10:in `each_key'
        from /var/www/discourse/lib/site_settings/yaml_loader.rb:10:in `load'
        from /var/www/discourse/app/models/site_setting.rb:16:in `load_settings'
        from /var/www/discourse/app/models/site_setting.rb:21:in `<class:SiteSetting>'
        from /var/www/discourse/app/models/site_setting.rb:4:in `<top (required)>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:379:in `block in require_or_load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:36:in `block in load_interlock'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/concurrency/share_lock.rb:149:in `exclusive'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies/interlock.rb:11:in `loading'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:36:in `load_interlock'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:357:in `require_or_load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:510:in `load_missing_constant'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:202:in `const_missing'
        from /var/www/discourse/config/initializers/004-message_bus.rb:84:in `<top (required)>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `block in load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:655:in `block in load_config_initializer'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb:168:in `instrument'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:654:in `load_config_initializer'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:612:in `block (2 levels) in <class:Engine>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:611:in `each'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:611:in `block in <class:Engine>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `instance_exec'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `run'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:59:in `block in run_initializers'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:48:in `each'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:48:in `tsort_each_child'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:415:in `call'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:415:in `each_strongly_connected_component_from'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `each'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `call'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:58:in `run_initializers'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application.rb:353:in `initialize!'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `public_send'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `method_missing'
        from /var/www/discourse/config/environment.rb:5:in `<top (required)>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application.rb:329:in `require_environment!'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command/actions.rb:16:in `require_application_and_environment!'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands/dbconsole/dbconsole_command.rb:154:in `perform'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

(Chris Croome) #7

The site appears to be working fine, nothing appears to be wrong when using the web interface, it’s a new server and install with a massive (1+ million posts, 13k user) database that was migrated from vBulletin.


(Chris Croome) #8

I know my way around MySQL / MariaDB fairly well, I’m afraid I have less Postgres experience (the same can be said of Ruby, Rails and Docker) — can anyone suggest some steps I could take to track down the cause of this issue?


(Michael Brown) #9

Note the different errors:

root tried to connect via the Unix domain socket (hence peer authentication) and PG rejected root

discourse successfully connected to PG, however the (development) database to which it tried to connect doesn’t exist. You might need:

RAILS_ENV=production rails c


(Mittineague) #10

I don’t know how you set things up, but AFAIK “discourse” is the owner of the database.

Maybe you need to create the SUPERUSER ?

This is for a development setup, so you should probably go over whatever steps you followed, but it may help.


(Chris Croome) #11

Thanks for the suggestion, this is what I get:

RAILS_ENV=production rails c
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/pg-0.20.0/lib/pg.rb:56:in `initialize': FATAL:  Peer authentication failed for user "discourse" (PG::ConnectionBad)
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/pg-0.20.0/lib/pg.rb:56:in `new'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/pg-0.20.0/lib/pg.rb:56:in `connect'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:695:in `connect'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:220:in `initialize'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `new'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `postgresql_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:759:in `new_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:803:in `checkout_new_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:782:in `try_to_checkout_new_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:743:in `acquire_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:500:in `checkout'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in `connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `retrieve_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:116:in `retrieve_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:88:in `connection'
        from /var/www/discourse/lib/site_settings/db_provider.rb:62:in `table_exists?'
        from /var/www/discourse/lib/site_settings/db_provider.rb:21:in `find'
        from /var/www/discourse/lib/site_settings/defaults_provider.rb:109:in `block in refresh_site_locale!'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rails_multisite-1.1.0.rc4/lib/rails_multisite/connection_management.rb:126:in `block in each_connection'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rails_multisite-1.1.0.rc4/lib/rails_multisite/connection_management.rb:124:in `each'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rails_multisite-1.1.0.rc4/lib/rails_multisite/connection_management.rb:124:in `each_connection'
        from /var/www/discourse/lib/site_settings/defaults_provider.rb:103:in `refresh_site_locale!'
        from /var/www/discourse/lib/site_settings/defaults_provider.rb:20:in `initialize'
        from /var/www/discourse/lib/site_setting_extension.rb:35:in `new'
        from /var/www/discourse/lib/site_setting_extension.rb:35:in `defaults'
        from /var/www/discourse/lib/site_setting_extension.rb:69:in `block in setting'
        from /var/www/discourse/lib/site_setting_extension.rb:68:in `synchronize'
        from /var/www/discourse/lib/site_setting_extension.rb:68:in `setting'
        from /var/www/discourse/app/models/site_setting.rb:17:in `block in load_settings'
        from /var/www/discourse/lib/site_settings/yaml_loader.rb:25:in `block (2 levels) in load'
        from /var/www/discourse/lib/site_settings/yaml_loader.rb:11:in `each'
        from /var/www/discourse/lib/site_settings/yaml_loader.rb:11:in `block in load'
        from /var/www/discourse/lib/site_settings/yaml_loader.rb:10:in `each_key'
        from /var/www/discourse/lib/site_settings/yaml_loader.rb:10:in `load'
        from /var/www/discourse/app/models/site_setting.rb:16:in `load_settings'
        from /var/www/discourse/app/models/site_setting.rb:21:in `<class:SiteSetting>'
        from /var/www/discourse/app/models/site_setting.rb:4:in `<top (required)>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:379:in `block in require_or_load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:36:in `block in load_interlock'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/concurrency/share_lock.rb:149:in `exclusive'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies/interlock.rb:11:in `loading'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:36:in `load_interlock'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:357:in `require_or_load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:510:in `load_missing_constant'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:202:in `const_missing'
        from /var/www/discourse/config/initializers/004-message_bus.rb:84:in `<top (required)>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `block in load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:655:in `block in load_config_initializer'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb:168:in `instrument'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:654:in `load_config_initializer'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:612:in `block (2 levels) in <class:Engine>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:611:in `each'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:611:in `block in <class:Engine>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `instance_exec'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `run'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:59:in `block in run_initializers'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:48:in `each'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:48:in `tsort_each_child'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:415:in `call'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:415:in `each_strongly_connected_component_from'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `each'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `call'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
        from /usr/local/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:58:in `run_initializers'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application.rb:353:in `initialize!'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `public_send'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `method_missing'
        from /var/www/discourse/config/environment.rb:5:in `<top (required)>'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application.rb:329:in `require_environment!'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command/actions.rb:16:in `require_application_and_environment!'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands/console/console_command.rb:96:in `perform'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

All the envars:

printenv
HOSTNAME=example-app
LETSENCRYPT_ACCOUNT_EMAIL=chris@webarchitects.co.uk
DISCOURSE_DB_HOST=
TERM=xterm
RUBY_GLOBAL_METHOD_CACHE_SIZE=131072
DISCOURSE_DEVELOPER_EMAILS=chris@webarchitects.co.uk
PG_MAJOR=9.5
OLDPWD=/
LETSENCRYPT_DIR=/shared/letsencrypt
RUBY_ALLOCATOR=/usr/lib/libjemalloc.so.1
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
DOCKER_HOST_IP=172.17.0.1
PWD=/var/www/discourse
RUBY_GC_HEAP_GROWTH_MAX_SLOTS=40000
RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5
DISCOURSE_SMTP_ADDRESS=example.webarchitects.co.uk
LANG=en_GB.UTF-8
DISCOURSE_HOSTNAME=example.webarchitects.co.uk
RUBY_GC_HEAP_INIT_SLOTS=400000
UNICORN_WORKERS=16
SHLVL=1
HOME=/root
RAILS_ENV=production
UNICORN_SIDEKIQS=1
DISCOURSE_DB_PORT=
COMPRESS_BROTLI=1
DISCOURSE_DB_SOCKET=/var/run/postgresql
_=/usr/bin/printenv

I assume not having DISCOURSE_DB_PORT isn’t a problem is it is using sockets?


(Chris Croome) #12

The discourse user and group exists in the container:

cat /etc/passwd | grep discourse
discourse:x:1000:1000::/home/discourse:/bin/bash
cat /etc/group | grep discourse
discourse:x:1000:

Or am I misunderstanding your suggestion?

One thing I found I had to do during the database migration was add this to /etc/sudoers:

discourse ALL = NOPASSWD: ALL

But I can’t think of any other changes that could be causing this.

Regarding the Beginners Guide to Install Discourse on Ubuntu for Development, I’m not sure how applicable that is to my situation, the site is running on a 8 core, 32GB RAM VPS I installed using Ansible playbooks which follow the official install steps for a standalone server / Docker etc.


(Chris Croome) #13

I backed the site up, transferred the 910M backup to a brand new VPS with a fresh Discourse install and imported it and now the Rails console works without a problem :slight_smile:

Sorry not to have tried that before creating this thread but perhaps if someone else has this problem in future this might help them.


(无限星辰) #14

So how do you solve this problem?


(Sam Saffron) #15

This is only a potential problem in dev environments, to avoid needing to deal with any of this I recommend you use our dev docker setup.


(无限星辰) #16

thanks, and how can install plugin with the dev docker?
my forums depends on the following plugin:

In /var/discourse/containers/app.yml  add:

- "templates/web.china.template.yml"
- git clone https://github.com/zh99998/discourse-username-localization.git
- git clone https://github.com/zh99998/discourse-discuz-migrate.git
- git clone https://github.com/fantasticfears/discourse-chinese-localization-pack.git

(Sam Saffron) #17

In dev docker you are working on your local filesystem, you would simple cd into your plugin directory and clone the repos.