Open shade-belisar opened 9 months ago
Does it load the webpage if you access it in your browser?
No. Navigating to http://localhost
results in
This site can’t be reached The webpage at http://localhost/ might be temporarily down or it may have moved permanently to a new web address. ERR_SOCKET_NOT_CONNECTED
It takes a few minutes to load once booted - I just restarted my docker container and it took ~5min for the application to load completely. Have you been waiting that long? If so, are there any logs in the container/from your reverse proxy that you can share?
Waiting did not solve the issue. According to the logs there is an authentication error, but I don't quite understand how that could be.
2024-02-06 22:18:50,179 DEBG 'puma' stdout output:
(See full trace by running task with --trace)
2024-02-06 22:18:50,199 DEBG fd 9 closed, stopped monitoring <POutputDispatcher at 140613420985296 for <Subprocess at 140613420721040 with name puma in state RUNNING> (stdout)>
2024-02-06 22:18:50,199 WARN exited: puma (exit status 1; not expected)
2024-02-06 22:18:50,200 DEBG received SIGCHLD indicating a child quit
2024-02-06 22:18:51,203 INFO spawned: 'puma' with pid 533
2024-02-06 22:18:52,205 INFO success: puma entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-02-06 22:18:54,292 DEBG 'puma' stdout output:
rake aborted!
ActiveRecord::NoDatabaseError: We could not find your database: stringer. Available database configurations can be found in config/database.yml. (ActiveRecord::NoDatabaseError)
To resolve this error:
- Did you not create the database, or did you delete it? To create the database, run:
bin/rails db:create
- Has the database name changed? Verify that config/database.yml contains the correct database name.
2024-02-06 22:18:54,293 DEBG 'puma' stdout output:
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/postgresql_adapter.rb:74:in `rescue in new_client'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/postgresql_adapter.rb:68:in `new_client'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/postgresql_adapter.rb:980:in `connect'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/postgresql_adapter.rb:992:in `reconnect'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:685:in `block in reconnect!'
/usr/local/bundle/gems/activesupport-7.1.3/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:684:in `reconnect!'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:788:in `verify!'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:795:in `connect!'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:1001:in `block in with_raw_connection'
/usr/local/bundle/gems/activesupport-7.1.3/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:1000:in `with_raw_connection'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:1113:in `valid_raw_connection'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/postgresql_adapter.rb:616:in `get_database_version'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/schema_cache.rb:374:in `database_version'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/schema_cache.rb:70:in `database_version'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/schema_cache.rb:200:in `database_version'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:871:in `database_version'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/postgresql_adapter.rb:644:in `check_version'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:678:in `new_connection'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:723:in `checkout_new_connection'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:702:in `try_to_checkout_new_connection'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:654:in `acquire_connection'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:353:in `checkout'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:182:in `connection'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract/connection_handler.rb:246:in `retrieve_connection'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_handling.rb:287:in `retrieve_connection'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_handling.rb:254:in `connection'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/tasks/database_tasks.rb:510:in `migration_connection'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/tasks/database_tasks.rb:243:in `migrate'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/railties/databases.rake:93:in `block (2 levels) in <top (required)>'
/usr/local/bundle/gems/bundler-2.3.25/lib/bundler/cli/exec.rb:58:in `load'
/usr/local/bundle/gems/bundler-2.3.25/lib/bundler/cli/exec.rb:58:in `kernel_load'
/usr/local/bundle/gems/bundler-2.3.25/lib/bundler/cli/exec.rb:23:in `run'
/usr/local/bundle/gems/bundler-2.3.25/lib/bundler/cli.rb:486:in `exec'
/usr/local/bundle/gems/bundler-2.3.25/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/bundle/gems/bundler-2.3.25/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/bundle/gems/bundler-2.3.25/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/usr/local/bundle/gems/bundler-2.3.25/lib/bundler/cli.rb:31:in `dispatch'
/usr/local/bundle/gems/bundler-2.3.25/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/usr/local/bundle/gems/bundler-2.3.25/lib/bundler/cli.rb:25:in `start'
/usr/local/bundle/gems/bundler-2.3.25/exe/bundle:48:in `block in <top (required)>'
/usr/local/bundle/gems/bundler-2.3.25/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors'
/usr/local/bundle/gems/bundler-2.3.25/exe/bundle:36:in `<top (required)>'
/usr/local/bundle/bin/bundle:25:in `load'
/usr/local/bundle/bin/bundle:25:in `<main>'
Caused by:
PG::ConnectionBad: connection to server at "172.29.0.2", port 5432 failed: FATAL: password authentication failed for user "stringer" (PG::ConnectionBad)
2024-02-06 22:18:54,293 DEBG 'puma' stdout output:
/usr/local/bundle/gems/pg-1.5.4/lib/pg/connection.rb:696:in `async_connect_or_reset'
/usr/local/bundle/gems/pg-1.5.4/lib/pg/connection.rb:824:in `connect_to_hosts'
/usr/local/bundle/gems/pg-1.5.4/lib/pg/connection.rb:759:in `new'
/usr/local/bundle/gems/pg-1.5.4/lib/pg.rb:63:in `connect'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/postgresql_adapter.rb:69:in `new_client'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/postgresql_adapter.rb:980:in `connect'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/postgresql_adapter.rb:992:in `reconnect'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:685:in `block in reconnect!'
/usr/local/bundle/gems/activesupport-7.1.3/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:684:in `reconnect!'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:788:in `verify!'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:795:in `connect!'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:1001:in `block in with_raw_connection'
/usr/local/bundle/gems/activesupport-7.1.3/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:1000:in `with_raw_connection'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:1113:in `valid_raw_connection'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/postgresql_adapter.rb:616:in `get_database_version'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/schema_cache.rb:374:in `database_version'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/schema_cache.rb:70:in `database_version'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/schema_cache.rb:200:in `database_version'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:871:in `database_version'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/postgresql_adapter.rb:644:in `check_version'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:678:in `new_connection'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:723:in `checkout_new_connection'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:702:in `try_to_checkout_new_connection'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:654:in `acquire_connection'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:353:in `checkout'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:182:in `connection'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_adapters/abstract/connection_handler.rb:246:in `retrieve_connection'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_handling.rb:287:in `retrieve_connection'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/connection_handling.rb:254:in `connection'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/tasks/database_tasks.rb:510:in `migration_connection'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/tasks/database_tasks.rb:243:in `migrate'
/usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/railties/databases.rake:93:in `block (2 levels) in <top (required)>'
/usr/local/bundle/gems/bundler-2.3.25/lib/bundler/cli/exec.rb:58:in `load'
/usr/local/bundle/gems/bundler-2.3.25/lib/bundler/cli/exec.rb:58:in `kernel_load'
/usr/local/bundle/gems/bundler-2.3.25/lib/bundler/cli/exec.rb:23:in `run'
/usr/local/bundle/gems/bundler-2.3.25/lib/bundler/cli.rb:486:in `exec'
/usr/local/bundle/gems/bundler-2.3.25/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/bundle/gems/bundler-2.3.25/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/bundle/gems/bundler-2.3.25/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/usr/local/bundle/gems/bundler-2.3.25/lib/bundler/cli.rb:31:in `dispatch'
/usr/local/bundle/gems/bundler-2.3.25/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/usr/local/bundle/gems/bundler-2.3.25/lib/bundler/cli.rb:25:in `start'
/usr/local/bundle/gems/bundler-2.3.25/exe/bundle:48:in `block in <top (required)>'
/usr/local/bundle/gems/bundler-2.3.25/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors'
/usr/local/bundle/gems/bundler-2.3.25/exe/bundle:36:in `<top (required)>'
/usr/local/bundle/bin/bundle:25:in `load'
/usr/local/bundle/bin/bundle:25:in `<main>'
Tasks: TOP => db:migrate
That's interesting, I see two errors here. The first:
ActiveRecord::NoDatabaseError: We could not find your database: stringer.
somehow it seems that your postgres container is not initializing the stringer
db correctly.
PG::ConnectionBad: connection to server at "172.29.0.2", port 5432 failed: FATAL: password authentication failed for user "stringer" (PG::ConnectionBad)
seemingly the root cause, the password authentication failed. Did you at some point remove the .env
file that got created? Or perhaps the .env
file already existed? I think the database may have been initialized with different values for the default password, and now your .env
file is out of date. Maybe try starting from scratch again by removing the .env
file, the ~/stringer
directory (maybe back this up just in case, since it's the db data), and rerunning touch .env && docker compose up -d
?
I deleted env
and ~/stringer
and ran the docker compose command again. Now I am getting a different error.
In the stringer container:
tput: No value for $TERM and no -T specified
Error: no DATABASE_URL was specified.
And in the stringer-postgres container:
Error: Database is uninitialized and superuser password is not specified.
You must specify POSTGRES_PASSWORD to a non-empty value for the
superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run".
You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all
connections without a password. This is *not* recommended.
See PostgreSQL documentation about "trust":
https://www.postgresql.org/docs/current/auth-trust.html
Weirdly enough, the .env
file does contain values for both those variables, so I ran docker compose down
followed by another docker compose up -d
, thinking that maybe they were initialized late.
This led to the containers ostensibly starting, but curl localhost
simply returning nothing.
As far as I can see, there is nothing that would explain this in the logs.
Interesting. The logs you posted after the restart look correct to me, so I'm surprised that you're still not seeing anything from localhost. I'm not sure why the db initialized incorrectly for you, but I'll try and repro.
@mockdeep and I tried this out and we did indeed observe the error you're seeing. I think it might be docker compose trying to load environment files into variables before they get set, and as a result it loads an empty .env
before populating it. I'll see if there's a way around this.
I followed the instructions for setting up stringer using docker-compose. Specifically, I did this:
Unfortunately, if I try to access stringer with
curl localhost
, I only getcurl: (56) Recv failure: Connection reset by peer
. Did I misunderstand the instructions, or is this a bug?