dawarich
dawarich copied to clipboard
FATAL: role "postgres" does not exist
Updated from 0.23.6 to 0.24.0 and also switched to the "image: postgis/postgis:14-3.5-alpine" for the DB. Now the db logs are spamming:
2025-02-13T13:38:36.748225000Z 2025-02-13 13:38:36.747 UTC [265] FATAL: role "postgres" does not exist
2025-02-13T13:38:46.807261000Z 2025-02-13 13:38:46.807 UTC [273] FATAL: role "postgres" does not exist
2025-02-13T13:38:56.864067000Z 2025-02-13 13:38:56.863 UTC [280] FATAL: role "postgres" does not exist
2025-02-13T13:39:06.932430000Z 2025-02-13 13:39:06.930 UTC [288] FATAL: role "postgres" does not exist
2025-02-13T13:39:16.992832000Z 2025-02-13 13:39:16.992 UTC [296] FATAL: role "postgres" does not exist
2025-02-13T13:39:27.060399000Z 2025-02-13 13:39:27.060 UTC [303] FATAL: role "postgres" does not exist
2025-02-13T13:39:37.121570000Z 2025-02-13 13:39:37.119 UTC [311] FATAL: role "postgres" does not exist
2025-02-13T13:39:47.174465000Z 2025-02-13 13:39:47.174 UTC [319] FATAL: role "postgres" does not exist
2025-02-13T13:39:57.230449000Z 2025-02-13 13:39:57.230 UTC [326] FATAL: role "postgres" does not exist
2025-02-13T13:40:07.295562000Z 2025-02-13 13:40:07.294 UTC [334] FATAL: role "postgres" does not exist
2025-02-13T13:40:17.359432000Z 2025-02-13 13:40:17.358 UTC [343] FATAL: role "postgres" does not exist
2025-02-13T13:40:27.417083000Z 2025-02-13 13:40:27.416 UTC [350] FATAL: role "postgres" does not exist
2025-02-13T13:40:37.476032000Z 2025-02-13 13:40:37.475 UTC [358] FATAL: role "postgres" does not exist
2025-02-13T13:40:47.534591000Z 2025-02-13 13:40:47.534 UTC [366] FATAL: role "postgres" does not exist
same here after i tried using the fixes from #856 now this :(
edit: okay so i got it working with using the 856 fix but adding: -h localhost !!WILL RESET YOUR DB!!
psql -h localhost -U postgres -c "CREATE DATABASE dawarich_development;"
still have the error tho: 2025-02-13 16:59:14.883 UTC [1346] postgres@dawarich_development LOG: provided user name (postgres) and authenticated user name (root) do not match
2025-02-13 16:59:14.883 UTC [1346] postgres@dawarich_development FATAL: Peer authentication failed for user "postgres"
2025-02-13 16:59:14.883 UTC [1346] postgres@dawarich_development DETAIL: Connection matched file "/etc/postgresql/17/main/pg_hba.conf" line 118: "local all postgres peer"
@vordenken can you provide more information on your hardware and your docker compose file? Thanks
@DEZEP I think your issue should be resolved in release 0.24.1, but it's good you already have solved it
Hi @Freika , yes sure. Here's my docker compose file:
---
services:
dawarich_redis:
image: redis:7.4-alpine
container_name: dawarich_redis
command: redis-server
networks:
- dawarich
volumes:
- /mnt/docker/dawarich/shared_data:/var/shared/redis
healthcheck:
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
interval: 10s
retries: 5
start_period: 30s
timeout: 10s
restart: unless-stopped
security_opt:
- no-new-privileges:true
dawarich_db:
image: postgis/postgis:14-3.5-alpine
shm_size: 1G
container_name: dawarich_db
volumes:
- /mnt/docker/dawarich/db_data:/var/lib/postgresql/data
- /mnt/docker/dawarich/shared_data:/var/shared
networks:
- dawarich
environment:
POSTGRES_USER: $POSTGRES_USER
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres -d dawarich_development" ]
interval: 10s
retries: 5
start_period: 30s
timeout: 10s
restart: unless-stopped
security_opt:
- no-new-privileges:true
dawarich_app:
image: freikin/dawarich:0.24.0
container_name: dawarich_app
volumes:
- /mnt/docker/dawarich/public:/var/app/public
labels:
- "traefik.enable=true"
- "traefik.http.routers.dawarich.rule=Host(`dawarich.mydomain.tld`)"
- "traefik.http.routers.dawarich.entrypoints=websecure"
- "traefik.http.routers.dawarich.tls.certresolver=myresolver"
- "traefik.http.services.dawarich.loadbalancer.server.port=3000"
- "homepage.group=Apps"
- "homepage.name=DaWarIch"
- "homepage.href=https://dawarich.mydomain.tld"
networks:
- dawarich
- proxy
stdin_open: true
tty: true
entrypoint: web-entrypoint.sh
command: [ 'bin/rails', 'server', '-p', '3000', '-b', '::' ]
restart: unless-stopped
environment:
RAILS_ENV: development
REDIS_URL: redis://dawarich_redis:6379/0
DATABASE_HOST: dawarich_db
DATABASE_USERNAME: $POSTGRES_USER
DATABASE_PASSWORD: $POSTGRES_PASSWORD
DATABASE_NAME: dawarich_development
MIN_MINUTES_SPENT_IN_CITY: 60
APPLICATION_HOST: localhost
APPLICATION_HOSTS: "localhost,dawarich.mydomain.tld"
TIME_ZONE: Europe/Berlin
APPLICATION_PROTOCOL: http
ENABLE_TELEMETRY: false # More on telemetry: https://dawarich.app/docs/tutorials/telemetry
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "5"
healthcheck:
test: [ "CMD-SHELL", "wget -qO - http://127.0.0.1:3000/api/v1/health | grep -q '\"status\"\\s*:\\s*\"ok\"'" ]
interval: 10s
retries: 30
start_period: 30s
timeout: 10s
depends_on:
dawarich_db:
condition: service_healthy
restart: true
dawarich_redis:
condition: service_healthy
restart: true
deploy:
resources:
limits:
cpus: '0.50' # Limit CPU usage to 50% of one core
memory: '2G' # Limit memory usage to 2GB
security_opt:
- no-new-privileges:true
dawarich_sidekiq:
image: freikin/dawarich:0.24.0
container_name: dawarich_sidekiq
volumes:
- /mnt/docker/dawarich/public:/var/app/public
networks:
- dawarich
stdin_open: true
tty: true
entrypoint: sidekiq-entrypoint.sh
command: [ 'bundle', 'exec', 'sidekiq' ]
restart: unless-stopped
environment:
RAILS_ENV: development
REDIS_URL: redis://dawarich_redis:6379/0
DATABASE_HOST: dawarich_db
DATABASE_USERNAME: $POSTGRES_USER
DATABASE_PASSWORD: $POSTGRES_PASSWORD
DATABASE_NAME: dawarich_development
APPLICATION_HOST: localhost
APPLICATION_HOSTS: "localhost,dawarich.mydomain.tld"
BACKGROUND_PROCESSING_CONCURRENCY: 10
APPLICATION_PROTOCOL: http
DISTANCE_UNIT: km
ENABLE_TELEMETRY: false # More on telemetry: https://dawarich.app/docs/tutorials/telemetry
healthcheck:
test: [ "CMD-SHELL", "bundle exec sidekiqmon processes | grep $${HOSTNAME}" ]
interval: 10s
retries: 30
start_period: 30s
timeout: 10s
depends_on:
dawarich_db:
condition: service_healthy
restart: true
dawarich_redis:
condition: service_healthy
restart: true
dawarich_app:
condition: service_healthy
restart: true
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "5"
deploy:
resources:
limits:
cpus: '0.50' # Limit CPU usage to 50% of one core
memory: '2G' # Limit memory usage to 2GB
security_opt:
- no-new-privileges:true
networks:
dawarich:
proxy:
name: proxy
external: true
Im running normal docker (latest version) on Debian.
Interesting is that the application still runs fine with all data shown.
@vordenken so basically it all runs nicely but logs are indicating a database error?
@Freika yes exactly. this just looping over and over:
LOG: provided user name (postgres) and authenticated user name (root) do not match 2025-02-15 17:48:59.079 UTC [135605] postgres@dawarich_development FATAL: Peer authentication failed for user "postgres" 2025-02-15 17:48:59.079 UTC [135605] postgres@dawarich_development DETAIL: Connection matched file "/etc/postgresql/17/main/pg_hba.conf" line 118: "local all postgres peer"
I also noticed the entries in the log, which caught my attention. The user 'postgres' appears to be hardcoded there. I had changed the user in my *.env file., The *.env template originally used the user 'postgres', You have to change the user for the healthcheck cmd.
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres -d dawarich_development" ]
interval: 10s
retries: 5
start_period: 30s
timeout: 10s
came back to try again but i still have the same issue: 2025-03-25 22:38:19.713 UTC [556] postgres@dawarich_development LOG: provided user name (postgres) and authenticated user name (root) do not match
2025-03-25 22:38:19.713 UTC [556] postgres@dawarich_development FATAL: Peer authentication failed for user "postgres"
2025-03-25 22:38:19.713 UTC [556] postgres@dawarich_development DETAIL: Connection matched file "/etc/postgresql/17/main/pg_hba.conf" line 118: "local all postgres peer"
This can be fixed by adding the envvar POSTGRES_DB=dawarich_development to the postgis container, so that when the container is started and no such database exists, it creates it. I will submit a PR shortly.