CyferShepard / Jellystat

Jellystat is a free and open source Statistics App for Jellyfin
MIT License
1.01k stars 31 forks source link

Database does not exist #252

Open nothing2obvi opened 3 hours ago

nothing2obvi commented 3 hours ago

Describe the bug I'm trying to start a new container because it seemed like something got messed up, but it says the database does not exist.

Environment Details (please complete the following information):

To Reproduce Steps to reproduce the behavior:

  1. Delete "jellystat" folder
  2. Try to run jellystat docker-compose.yml file.
  3. See error (explained below)

docker-compose.yml

jellystat-db:
    image: postgres:15.2
    container_name: jellystat_db
    environment:
      POSTGRES_DB: 'jfstat'
      POSTGRES_USER: nothing2obvi
      POSTGRES_PASSWORD: 'xxx'
    volumes:
      - /Users/username/Docker/jellystat/postgres-data:/var/lib/postgresql/data # Mounting the volume
    ports:
      - 5432:5432
    restart: unless-stopped
  jellystat:
    image: cyfershepard/jellystat:1.1.0
    container_name: jellystat
    environment:
      POSTGRES_USER: nothing2obvi
      POSTGRES_PASSWORD: 'xxx'
      POSTGRES_IP: jellystat-db
      POSTGRES_PORT: 5432
      JWT_SECRET: 'yyy'
    ports:
      - "3000:3000" #Server Port
    volumes:
      - /Users/username/Docker/jellystat/backup-data:/app/backend/backup-data # Mounting the volume
    depends_on:
      - jellystat-db
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
    restart: unless-stopped

Error in Logs: See below, under "Container Logs."

Expected behavior Jellystat should start up fine with no errors with the database.

Container Logs jellystat

all values are hidden
> jfstat@1.1.0 start
> cd backend && node server.js
all values are hidden
error: database "sirnothing" does not exist
    at Parser.parseErrorMessage (/app/node_modules/pg-protocol/dist/parser.js:287:98)
    at Parser.handlePacket (/app/node_modules/pg-protocol/dist/parser.js:126:29)
    at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:39:38)
    at Socket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:11:42)
    at Socket.emit (node:events:520:28)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Readable.push (node:internal/streams/readable:390:5)
    at TCP.onStreamRead (node:internal/stream_base_commons:191:23)
[JELLYSTAT] Database exists. Skipping creation
FS-related option specified for migration configuration. This resets migrationSource to default FsMigrations
FS-related option specified for migration configuration. This resets migrationSource to default FsMigrations
[JELLYSTAT] Server listening on http://127.0.0.1:3000

jellystat_db

The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
all values are hidden
The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
all values are hidden
Data page checksums are disabled.
all values are hidden
fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Etc/UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
all values are hidden
all values are hidden
Success. You can now start the database server using:
all values are hidden
    pg_ctl -D /var/lib/postgresql/data -l logfile start
all values are hidden
initdb: warning: enabling "trust" authentication for local connections
initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.
waiting for server to start....2024-09-29 20:01:48.479 UTC [49] LOG:  starting PostgreSQL 15.2 (Debian 15.2-1.pgdg110+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
2024-09-29 20:01:48.485 UTC [49] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-09-29 20:01:48.491 UTC [52] LOG:  database system was shut down at 2024-09-29 20:01:47 UTC
2024-09-29 20:01:48.497 UTC [49] LOG:  database system is ready to accept connections
 done
server started
CREATE DATABASE
all values are hidden
all values are hidden
/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
all values are hidden
waiting for server to shut down....2024-09-29 20:01:50.234 UTC [49] LOG:  received fast shutdown request
2024-09-29 20:01:50.235 UTC [49] LOG:  aborting any active transactions
2024-09-29 20:01:50.282 UTC [49] LOG:  background worker "logical replication launcher" (PID 55) exited with exit code 1
2024-09-29 20:01:50.283 UTC [50] LOG:  shutting down
2024-09-29 20:01:50.284 UTC [50] LOG:  checkpoint starting: shutdown immediate
2024-09-29 20:01:50.899 UTC [50] LOG:  checkpoint complete: wrote 918 buffers (5.6%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.205 s, sync=0.404 s, total=0.616 s; sync files=250, longest=0.076 s, average=0.002 s; distance=4217 kB, estimate=4217 kB
2024-09-29 20:01:50.989 UTC [49] LOG:  database system is shut down
 done
server stopped
all values are hidden
PostgreSQL init process complete; ready for start up.
all values are hidden
2024-09-29 20:01:51.187 UTC [1] LOG:  starting PostgreSQL 15.2 (Debian 15.2-1.pgdg110+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
2024-09-29 20:01:51.188 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2024-09-29 20:01:51.188 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2024-09-29 20:01:51.192 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-09-29 20:01:51.198 UTC [65] LOG:  database system was shut down at 2024-09-29 20:01:50 UTC
2024-09-29 20:01:51.281 UTC [1] LOG:  database system is ready to accept connections
2024-09-29 20:01:53.480 UTC [69] FATAL:  database "nothing2obvi" does not exist
2024-09-29 20:06:51.300 UTC [63] LOG:  checkpoint starting: time
2024-09-29 20:07:14.623 UTC [63] LOG:  checkpoint complete: wrote 229 buffers (1.4%); 0 WAL file(s) added, 0 removed, 0 recycled; write=23.304 s, sync=0.011 s, total=23.325 s; sync files=82, longest=0.002 s, average=0.001 s; distance=1299 kB, estimate=1299 kB

Additional context Add any other context about the problem here.

CyferShepard commented 1 hour ago

Hey @nothing2obvi , try setting POSTGRES_DB under jellystat aswell to match the POSTGRES_DB value under postgres