Super admin Console problem
-
Have you tried to follow the steps mentioned in the link you posted? On Cloudron you can open a webterminal into the app via the Cloudron dashboard and then run the mentioned commands there. If this is a production instance of the app, maybe first create a fresh backup.
-
Yes, I have and get the following statement back:
root@807d143a-8##################55cc2ef4804:/app/code# RAILS_ENV=production bundle exec rails c [12/16/21 10:37:10 +0000 8##################55cc2ef4804 (295)] INFO : No configuration file loaded, and no configuration found in ENV. For assistance configuring Scout, visit https://docs.scoutapm.com/#ruby-configuration-options [12/16/21 10:37:10 +0000 8##################55cc2ef4804 (295)] INFO : Scout Agent [4.1.2] Initialized [12/16/21 10:37:10 +0000 8##################55cc2ef4804 (295)] INFO : Not Loading Instruments [12/16/21 10:37:10 +0000 8##################55cc2ef4804 (295)] INFO : Scout Agent [4.1.2] Installed [12/16/21 10:37:10 +0000 8##################55cc2ef4804 (295)] INFO : Monitoring isn't enabled for the [production] environment. [12/16/21 10:37:10 +0000 8##################55cc2ef4804 (295)] INFO : Agent attempting to load in interactive mode. [12/16/21 10:37:10 +0000 8##################55cc2ef4804 (295)] INFO : Deferring agent start. Standing by for first request /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-6.1.4.1/lib/rails/application.rb:603:in `validate_secret_key_base': Missing `secret_key_base` for 'production' environment, set this string with `bin/rails credentials:edit` (ArgumentError) from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-6.1.4.1/lib/rails/application.rb:437:in `secret_key_base' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/devise-4.8.0/lib/devise/secret_key_finder.rb:24:in `key_exists?' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/devise-4.8.0/lib/devise/secret_key_finder.rb:16:in `find' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/devise-4.8.0/lib/devise/rails.rb:37:in `block in <class:Engine>' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in `instance_exec' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in `run' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:61:in `block in run_initializers' from /root/.rbenv/versions/3.0.2/lib/ruby/3.0.0/tsort.rb:228:in `block in tsort_each' from /root/.rbenv/versions/3.0.2/lib/ruby/3.0.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component' from /root/.rbenv/versions/3.0.2/lib/ruby/3.0.0/tsort.rb:431:in `each_strongly_connected_component_from' from /root/.rbenv/versions/3.0.2/lib/ruby/3.0.0/tsort.rb:349:in `block in each_strongly_connected_component' from /root/.rbenv/versions/3.0.2/lib/ruby/3.0.0/tsort.rb:347:in `each' from /root/.rbenv/versions/3.0.2/lib/ruby/3.0.0/tsort.rb:347:in `call' from /root/.rbenv/versions/3.0.2/lib/ruby/3.0.0/tsort.rb:347:in `each_strongly_connected_component' from /root/.rbenv/versions/3.0.2/lib/ruby/3.0.0/tsort.rb:226:in `tsort_each' from /root/.rbenv/versions/3.0.2/lib/ruby/3.0.0/tsort.rb:205:in `tsort_each' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:60:in `run_initializers' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-6.1.4.1/lib/rails/application.rb:391:in `initialize!' from /app/code/config/environment.rb:5:in `<main>' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `block in require' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-6.1.4.1/lib/rails/application.rb:367:in `require_environment!' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-6.1.4.1/lib/rails/command/actions.rb:28:in `require_environment!' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-6.1.4.1/lib/rails/command/actions.rb:15:in `require_application_and_environment!' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-6.1.4.1/lib/rails/commands/console/console_command.rb:101:in `perform' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-6.1.4.1/lib/rails/command/base.rb:69:in `perform' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-6.1.4.1/lib/rails/command.rb:48:in `invoke' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-6.1.4.1/lib/rails/commands.rb:18:in `<main>' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' from /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' from bin/rails:4:in `<main>'
-
@chap @nebulon My guess is this is due to the location of the
.env
file right now. It should be at/app/code/.env
.an MR for the same --> https://git.cloudron.io/cloudron/chatwoot-app/-/merge_requests/1
This also means env variable set using .env were not taking effect. Have there been users reporting issues related to that ?
-
@nebulon Hi there,
very dear thanks! Now that looks like it should be, am I assuming?root@8+++++++55cc2ef4804:/app/code# RAILS_ENV=production bundle exec rails c [12/16/21 18:17:01 +0000 8+++++++55cc2ef4804 (53)] INFO : No configuration file loaded, and no configuration found in ENV. For assistance configuring Scout, visit https://docs.scoutapm.com/#ruby-configuration-options [12/16/21 18:17:01 +0000 8+++++++55cc2ef4804 (53)] INFO : Scout Agent [4.1.2] Initialized [12/16/21 18:17:01 +0000 +++++++55cc2ef4804 (53)] INFO : Not Loading Instruments [12/16/21 18:17:01 +0000 8+++++++55cc2ef4804 (53)] INFO : Scout Agent [4.1.2] Installed [12/16/21 18:17:01 +0000 8+++++++55cc2ef4804 (53)] INFO : Monitoring isn't enabled for the [production] environment. [12/16/21 18:17:01 +0000 8+++++++55cc2ef4804 (53)] INFO : Agent attempting to load in interactive mode. [12/16/21 18:17:01 +0000 8+++++++55cc2ef4804 (53)] INFO : Deferring agent start. Standing by for first request W, [2021-12-16T18:17:03.020736 #53] WARN -- : Creating scope :open. Overwriting existing method Conversation.open. Loading production environment (Rails 6.1.4.1) irb(main):001:0>
Why is that now?
irb(main):001:0> s = SuperAdmin.create!(email: "mail@########.de", password: "##########") /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql_adapter.rb:83:in `rescue in new_client': connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused (ActiveRecord::ConnectionNotEstablished) Is the server running on that host and accepting TCP/IP connections? connection to server at "localhost" (::1), port 5432 failed: Cannot assign requested address Is the server running on that host and accepting TCP/IP connections? /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/pg-1.2.3/lib/pg.rb:58:in `initialize': connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused (PG::ConnectionBad) Is the server running on that host and accepting TCP/IP connections? connection to server at "localhost" (::1), port 5432 failed: Cannot assign requested address Is the server running on that host and accepting TCP/IP connections?
-
@girish Doesn't seem to work, does it?
root@8074804:/app/code# RAILS_ENV=production bundle exec rails c [12/16/21 22:33:09 +0000 8074804 (71)] INFO : No configuration file loaded, and no configuration found in ENV. For assistance configuring Scout, visit https://docs.scoutapm.com/#ruby-configuration-options [12/16/21 22:33:09 +0000 8074804 (71)] INFO : Scout Agent [4.1.2] Initialized [12/16/21 22:33:09 +0000 8074804 (71)] INFO : Not Loading Instruments [12/16/21 22:33:09 +0000 8074804 (71)] INFO : Scout Agent [4.1.2] Installed [12/16/21 22:33:09 +0000 8074804 (71)] INFO : Monitoring isn't enabled for the [production] environment. [12/16/21 22:33:09 +0000 8074804 (71)] INFO : Agent attempting to load in interactive mode. [12/16/21 22:33:09 +0000 8074804 (71)] INFO : Deferring agent start. Standing by for first request W, [2021-12-16T22:33:11.046679 #71] WARN -- : Creating scope :open. Overwriting existing method Conversation.open. Loading production environment (Rails 6.1.4.1) irb(main):001:0> set -o allexport; source /app/data/env; set +o allexport /root/.rbenv/versions/3.0.2/lib/ruby/3.0.0/irb/workspace.rb:116:in `eval': (irb):1: syntax error, unexpected local variable or method, expecting `do' or '{' or '(' (SyntaxError) set -o allexport; source /app/data/env; set +... ^~~~~~~~~ (irb):1: unknown regexp options - data ... -o allexport; source /app/data/env; set +o allexport ... ^~~~~ (irb):1: syntax error, unexpected local variable or method, expecting `do' or '{' or '(' .../app/data/env; set +o allexport ... ^~~~~~~~~ irb(main):002:0> s = SuperAdmin.create!(email: "mail@#####.de", password: "PASSWORD") /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql_adapter.rb:83:in `rescue in new_client': connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused (ActiveRecord::ConnectionNotEstablished) Is the server running on that host and accepting TCP/IP connections? connection to server at "localhost" (::1), port 5432 failed: Cannot assign requested address Is the server running on that host and accepting TCP/IP connections? /root/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/pg-1.2.3/lib/pg.rb:58:in `initialize': connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused (PG::ConnectionBad) Is the server running on that host and accepting TCP/IP connections? connection to server at "localhost" (::1), port 5432 failed: Cannot assign requested address Is the server running on that host and accepting TCP/IP connections? irb(main):003:0>
If I enter the command in front of the rails, there is no output! If I go to Rails, I'm in there, but I can't set up a Super_Admin. Mistake the same!
-
@chap a temporary workaround.
- Open a Web Terminal
- Run in the terminal/bash (and not inside rails console)
export POSTGRES_DATABASE="${CLOUDRON_POSTGRESQL_DATABASE}" export POSTGRES_USERNAME="${CLOUDRON_POSTGRESQL_USERNAME}" export POSTGRES_PASSWORD="${CLOUDRON_POSTGRESQL_PASSWORD}" export POSTGRES_HOST="${CLOUDRON_POSTGRESQL_HOST}" export POSTGRES_PORT="${CLOUDRON_POSTGRESQL_PORT}"
IMPORTANT: do not run the above commands inside the rails console. It should be in the initial bash shell.
- Now open the rails console:
# RAILS_ENV=production bundle exec rails c
I can confirm the above works
-
@girish Hi there,
Thank you very much! Can confirm it too! Everything looks much, much better and the login also works in Super_Admin!Connecting... If you resize the browser window, press Ctrl+D to start a new session with the current size. root@807d143a-f55cc2ef4804:/app/code# export POSTGRES_DATABASE="${CLOUDRON_POSTGRESQL_DATABASE}" root@807d143a-f55cc2ef4804:/app/code# export POSTGRES_USERNAME="${CLOUDRON_POSTGRESQL_USERNAME}" root@807d143a-f55cc2ef4804:/app/code# export POSTGRES_PASSWORD="${CLOUDRON_POSTGRESQL_PASSWORD}" root@807d143a-f55cc2ef4804:/app/code# export POSTGRES_HOST="${CLOUDRON_POSTGRESQL_HOST}" root@807d143a-f55cc2ef4804:/app/code# export POSTGRES_PORT="${CLOUDRON_POSTGRESQL_PORT}" root@807d143a-f55cc2ef4804:/app/code# RAILS_ENV=production bundle exec rails c [12/17/21 09:41:06 +0000 807d143a-f55cc2ef4804 (111)] INFO : No configuration file loaded, and no configuration found in ENV. For assistance configuring Scout, visit https://docs.scoutapm.com/#ruby-configuration-options [12/17/21 09:41:06 +0000 807d143a-f55cc2ef4804 (111)] INFO : Scout Agent [4.1.2] Initialized [12/17/21 09:41:06 +0000 807d143a-f55cc2ef4804 (111)] INFO : Not Loading Instruments [12/17/21 09:41:06 +0000 807d143a-f55cc2ef4804 (111)] INFO : Scout Agent [4.1.2] Installed [12/17/21 09:41:06 +0000 807d143a-f55cc2ef4804 (111)] INFO : Monitoring isn't enabled for the [production] environment. [12/17/21 09:41:06 +0000 807d143a-f55cc2ef4804 (111)] INFO : Agent attempting to load in interactive mode. [12/17/21 09:41:06 +0000 807d143a-f55cc2ef4804 (111)] INFO : Deferring agent start. Standing by for first request W, [2021-12-17T09:41:07.947941 #111] WARN -- : Creating scope :open. Overwriting existing method Conversation.open. Loading production environment (Rails 6.1.4.1) irb(main):001:0> s = SuperAdmin.create!(email: "E_MAIL_ADRESSE", password: PASSWORD") => #<SuperAdmin id: 1, email: "E_MAIL_ADRESSE", created_at: "2021-12-17 09:41:39.296219000 +0000", updated_at: "2021-12-17 09:41:39.296219000 +0000"> irb(main):002:0> quit root@807d143a-f55cc2ef4804:/app/code#