Issue with Rails production
OS & Hardware Proxmox LXC Ubuntu 24.10
Version 0.23.5
Describe the bug dawarich_app doesnt start with rails_env production
To Reproduce use RAILS_ENV: production in docker-compose.yml
Expected behavior Start healthy like it does with RAILS_ENV: delevopment
Logs
⚠️ Starting Rails environment: production ⚠️
⏳ Waiting for database to be ready...
✅ PostgreSQL is ready!
PostgreSQL is ready. Running database migrations...
Running DATA migrations...
Running seeds...
=> Booting Puma
=> Rails 8.0.1 application starting in production
=> Run bin/rails server --help for more startup options
2025-01-23T18:07:11.704Z pid=53 tid=3th INFO: Sidekiq 7.3.7 connecting to Redis with options {:size=>10, :pool_name=>"internal", :url=>"redis://dawarich_redis:6379/0"}
I, [2025-01-23T18:07:11.706222 #53] INFO -- : Enqueued Cache::CleaningJob (Job ID: 6ed45f9c-9004-4097-9ccf-1bf413944686) to Sidekiq(default)
I, [2025-01-23T18:07:11.706599 #53] INFO -- : Enqueued Cache::PreheatingJob (Job ID: 3ad4049f-17be-4b6a-b9a8-b94f3453249f) to Sidekiq(default)
[53] Puma starting in cluster mode...
[53] * Puma version: 6.5.0 ("Sky's Version")
[53] * Ruby version: ruby 3.3.4 (2024-07-09 revision be1089c8ec) +YJIT [x86_64-linux-musl]
[53] * Min threads: 5
[53] * Max threads: 5
[53] * Environment: production
[53] * Master PID: 53
[53] * Workers: 2
[53] * Restarts: (✔) hot (✖) phased
[53] * Preloading application
[53] * Listening on http://[::]:3000
[53] Use Ctrl-C to stop
[53] - Worker 0 (PID: 71) booted in 0.0s, phase: 0
[53] - Worker 1 (PID: 83) booted in 0.0s, phase: 0
E, [2025-01-23T18:07:13.923963 #71] ERROR -- : [ActionDispatch::HostAuthorization::DefaultResponseApp] Blocked hosts: 127.0.0.1:3000
E, [2025-01-23T18:07:18.965106 #71] ERROR -- : [ActionDispatch::HostAuthorization::DefaultResponseApp] Blocked hosts: 127.0.0.1:3000
E, [2025-01-23T18:07:24.010752 #83] ERROR -- : [ActionDispatch::HostAuthorization::DefaultResponseApp] Blocked hosts: 127.0.0.1:3000
Logs with development rails env ⚠️ Starting Rails environment: development ⚠️ ⏳ Waiting for database to be ready... ✅ PostgreSQL is ready! PostgreSQL is ready. Running database migrations... [dotenv] Loaded .env.development D, [2025-01-23T18:12:24.858328 #11] DEBUG -- : (0.3ms) SELECT pg_try_advisory_lock(2529726080307754440) D, [2025-01-23T18:12:24.865816 #11] DEBUG -- : ActiveRecord::SchemaMigration Load (2.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC D, [2025-01-23T18:12:24.881408 #11] DEBUG -- : ActiveRecord::InternalMetadata Load (2.0ms) SELECT * FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 ORDER BY "ar_internal_metadata"."key" ASC LIMIT 1 [[nil, "environment"]] D, [2025-01-23T18:12:24.884509 #11] DEBUG -- : ActiveRecord::InternalMetadata Update (1.3ms) UPDATE "ar_internal_metadata" SET "value" = 'development', "updated_at" = '2025-01-23 18:12:24.882088' WHERE "ar_internal_metadata"."key" = 'environment' D, [2025-01-23T18:12:24.885592 #11] DEBUG -- : (0.2ms) SELECT pg_advisory_unlock(2529726080307754440) D, [2025-01-23T18:12:24.956309 #11] DEBUG -- : ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC Running DATA migrations... [dotenv] Loaded .env.development
Hi, I had the same issue as you and solved the problem by adding my servers IP-Address to the APPLICATION_HOSTS environment variable in the production docker-compose.yml. So it looks like this: localhost,::1,127.0.0.1,xxx.xxx.xxx.xxx
I think this issue happens when the docker runs on a different host and you are trying to access it from outside. So not from localhost.
I have successfully ran Dawarich in production env, so it shouldn't be a problem anymore. Also, it's not supposed to be run in production (yet), so I'll close this one