dawarich icon indicating copy to clipboard operation
dawarich copied to clipboard

0.23.0: container dawarich_app is unhealthy

Open marsmathis opened this issue 1 year ago • 16 comments

OS & Hardware Proxmox 8.3.1, Intel i7 10700K

Version 0.23.0

Describe the bug container doesn’t start (sidekiq, db, redis do start, but app doesn’t)

To Reproduce Steps to reproduce the behavior:

  1. docker compose pull
  2. docker compose up -d

Expected behavior Container should start

Screenshots Image

Additional context Updated from 0.22.3.

marsmathis avatar Jan 21 '25 10:01 marsmathis

Please provide logs from both dawarich_sidekiq and dawarich_app containers

Freika avatar Jan 21 '25 10:01 Freika

@Freika sidekiq has no logs at all (using docker logs dawarich_sidekiq, app has a lot. What would be the best way to provide you the logs?

marsmathis avatar Jan 21 '25 10:01 marsmathis

Having the same issue on my install. At first, I thought the healthcheck failed because migration was taking longer than expected but this seems to not be the case. Here are my logs (removed the full trace but can provide it if needed).

dawarich_app    | PostgreSQL is ready. Running database migrations...
dawarich_app    | [dotenv] Set DATABASE_PORT
dawarich_app    | [dotenv] Loaded .env.development
dawarich_app    | D, [2025-01-21T11:01:41.259983 #11] DEBUG -- :    (0.2ms)  SELECT pg_try_advisory_lock(1212213197400985920)
dawarich_app    | D, [2025-01-21T11:01:41.264250 #11] DEBUG -- :   ActiveRecord::SchemaMigration Load (1.9ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
dawarich_app    | D, [2025-01-21T11:01:41.270558 #11] DEBUG -- :   ActiveRecord::InternalMetadata Load (1.3ms)  SELECT * FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 ORDER BY "ar_internal_metadata"."key" ASC LIMIT 1  [[nil, "environment"]]
dawarich_app    | I, [2025-01-21T11:01:41.271116 #11]  INFO -- : Migrating to AddUniqueIndexToPoints (20250120154555)
dawarich_app    | == 20250120154555 AddUniqueIndexToPoints: migrating ===========================
dawarich_app    | -- add_index(:points, [:latitude, :longitude, :timestamp, :user_id], {:unique=>true, :name=>"unique_points_index", :algorithm=>:concurrently})
dawarich_db     | 2025-01-21 11:01:41.273 UTC [344740] ERROR:  relation "unique_points_index" already exists
dawarich_db     | 2025-01-21 11:01:41.273 UTC [344740] STATEMENT:  CREATE UNIQUE INDEX CONCURRENTLY "unique_points_index" ON "points" ("latitude", "longitude", "timestamp", "user_id")
dawarich_app    | D, [2025-01-21T11:01:41.275107 #11] DEBUG -- :    (1.3ms)  CREATE UNIQUE INDEX CONCURRENTLY "unique_points_index" ON "points" ("latitude", "longitude", "timestamp", "user_id")
dawarich_app    | D, [2025-01-21T11:01:41.276720 #11] DEBUG -- :    (0.5ms)  SELECT pg_advisory_unlock(1212213197400985920)
dawarich_app    | bin/rails aborted!
dawarich_app    | StandardError: An error has occurred, all later migrations canceled: (StandardError)
dawarich_app    | 
dawarich_app    | PG::DuplicateTable: ERROR:  relation "unique_points_index" already exists
...
dawarich_app    | 
dawarich_app    | Caused by:
dawarich_app    | ActiveRecord::StatementInvalid: PG::DuplicateTable: ERROR:  relation "unique_points_index" already exists (ActiveRecord::StatementInvalid)
...
dawarich_app    | 
dawarich_app    | Caused by:
dawarich_app    | PG::DuplicateTable: ERROR:  relation "unique_points_index" already exists (PG::DuplicateTable)
...
dawarich_app    | Tasks: TOP => db:migrate
dawarich_app    | (See full trace by running task with --trace)

Edit: if you have the same error without more information, just use a thumbs up. Replying 'same' usually does not contribute to resolving an issue.

tjorim avatar Jan 21 '25 11:01 tjorim

Having also the same issue. Same Error as tjorim.

H4usi avatar Jan 21 '25 11:01 H4usi

Yes, my dawarich_app logs show the same thing.

marsmathis avatar Jan 21 '25 11:01 marsmathis

Same thing here and 2 others on the Discord as well @Freika my test instance (rails_env production) updated fine my main (rails_env development) has the issue, maybe thats something?

narucx avatar Jan 21 '25 11:01 narucx

Let's see if 0.23.1 fix that when it's built

Freika avatar Jan 21 '25 12:01 Freika

Let's see if 0.23.1 fix that when it's built

Will there be data loss when updating from the botched 0.23.0 version to 0.23.1?

marsmathis avatar Jan 21 '25 13:01 marsmathis

@marsmathis the jobs described in release notes to 0.23.0 (to remove points with duplicated lat-lon-timestamp-userid) will be run, no other data-related tasks will be executed. It will be run after the database migration is completed.

Freika avatar Jan 21 '25 13:01 Freika

Yeah, my own instance didn't update successfully, another fix attempt is on its way

Freika avatar Jan 21 '25 13:01 Freika

no go with 0.23.1 https://notebin.de/?357f3d97654584a5#FyDpvAhbMt2wL17ANw57dRxrKycd5hWMkfGUMaJcJJ47

edit: okay you where faster than me ;)

rantanlan avatar Jan 21 '25 13:01 rantanlan

@rantanlan you might wanna obscure your logs next time, you left exact coordinates in there.

marsmathis avatar Jan 21 '25 13:01 marsmathis

@rantanlan you might wanna obscure your logs next time, you left exact coordinates in there.

thanks, I know, will die shortly anyway ... and if you really want, you can find my info easily.

rantanlan avatar Jan 21 '25 13:01 rantanlan

0.23.2 works for me now

narucx avatar Jan 21 '25 14:01 narucx

It works now. Thanks for the quick fix!

marsmathis avatar Jan 21 '25 14:01 marsmathis

I ran into the same issue when I upgraded from 22.1 to 23+ versions today.

In my case the data migration started but did not complete in the startup time and docker marked the container unhealty. At the end I resolved it with the re-issue of docker compose down ; docker compose up -d commands after each failure and after a few tries I also increased the start_period: 30s to 3000s for the dawarich_app. After multiple tries the conversion completed and now everythign is back to normal.

The issue is probably caused by the database size as I have Google Location History imported for tha last 15 years

schneemaier avatar Feb 17 '25 19:02 schneemaier