Phalcode / gamevault-backend

Backend for the self-hosted gaming platform for drm-free games
https://gamevau.lt
Other
180 stars 15 forks source link

Unable to Start new container. #177

Closed 60plus closed 1 year ago

60plus commented 1 year ago

Describe the bug unable to start container.

To Reproduce Deploy new container.

Expected behavior No issues

Additional context LOGS.

DB LOG:

2023-08-25 06:24:09.279 UTC [1] LOG: starting PostgreSQL 15.4 (Debian 15.4-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit

2023-08-25 06:24:09.280 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432

2023-08-25 06:24:09.280 UTC [1] LOG: listening on IPv6 address "::", port 5432

2023-08-25 06:24:09.285 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"

2023-08-25 06:24:09.291 UTC [29] LOG: database system was interrupted; last known up at 2023-08-25 06:13:48 UTC

2023-08-25 06:24:09.364 UTC [29] LOG: database system was not properly shut down; automatic recovery in progress

2023-08-25 06:24:09.367 UTC [29] LOG: redo starts at 0/19875D8

2023-08-25 06:24:09.367 UTC [29] LOG: invalid record length at 0/1987610: wanted 24, got 0

2023-08-25 06:24:09.367 UTC [29] LOG: redo done at 0/19875D8 system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s

2023-08-25 06:24:09.372 UTC [27] LOG: checkpoint starting: end-of-recovery immediate wait

2023-08-25 06:24:09.383 UTC [27] LOG: checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.004 s, sync=0.002 s, total=0.014 s; sync files=2, longest=0.001 s, average=0.001 s; distance=0 kB, estimate=0 kB

2023-08-25 06:24:09.389 UTC [1] LOG: database system is ready to accept connections

2023-08-25 06:24:10.246 UTC [33] ERROR: relation "game" does not exist at character 2034

2023-08-25 06:24:10.246 UTC [33] STATEMENT: SELECT "Game"."id" AS "Game_id", "Game"."created_at" AS "Game_created_at", "Game"."updated_at" AS "Game_updated_at", "Game"."deleted_at" AS "Game_deleted_at", "Game"."entity_version" AS "Game_entity_version", "Game"."rawg_id" AS "Game_rawg_id", "Game"."title" AS "Game_title", "Game"."rawg_title" AS "Game_rawg_title", "Game"."version" AS "Game_version", "Game"."release_date" AS "Game_release_date", "Game"."rawg_release_date" AS "Game_rawg_release_date", "Game"."cache_date" AS "Game_cache_date", "Game"."file_path" AS "Game_file_path", "Game"."size" AS "Game_size", "Game"."description" AS "Game_description", "Game"."website_url" AS "Game_website_url", "Game"."metacritic_rating" AS "Game_metacritic_rating", "Game"."average_playtime" AS "Game_average_playtime", "Game"."early_access" AS "Game_early_access", "Game"."type" AS "Game_type", "Game"."box_image_id" AS "Game_box_image_id", "Game"."background_image_id" AS "Game_background_image_id", "Gamebox_image"."id" AS "Gamebox_image_id", "Gamebox_image"."created_at" AS "Game__box_image_created_at", "Gamebox_image"."updated_at" AS "Gamebox_image_updated_at", "Gamebox_image"."deleted_at" AS "Gamebox_image_deleted_at", "Gamebox_image"."entity_version" AS "Gamebox_image_entity_version", "Game__box_image"."source" AS "Gamebox_image_source", "Gamebox_image"."path" AS "Gamebox_image_path", "Gamebox_image"."media_type" AS "Game__box_image_media_type", "Gamebackground_image"."id" AS "Gamebackground_image_id", "Gamebackground_image"."created_at" AS "Gamebackground_image_created_at", "Gamebackground_image"."updated_at" AS "Gamebackground_image_updated_at", "Gamebackground_image"."deleted_at" AS "Gamebackground_image_deleted_at", "Gamebackground_image"."entity_version" AS "Gamebackground_image_entity_version", "Gamebackground_image"."source" AS "Gamebackground_image_source", "Gamebackground_image"."path" AS "Gamebackground_image_path", "Gamebackground_image"."media_type" AS "Gamebackground_image_media_type" FROM "game" "Game" LEFT JOIN "image" "Game__box_image" ON "Gamebox_image"."id"="Game"."box_image_id" AND ("Gamebox_image"."deleted_at" IS NULL) LEFT JOIN "image" "Gamebackground_image" ON "Game__background_image"."id"="Game"."background_image_id" AND ("Game__background_image"."deleted_at" IS NULL) WHERE "Game"."deleted_at" IS NULL

GameVault-Backend LOG:

/app/node_modules/.pnpm/typeorm@0.3.17_better-sqlite3@8.5.0_pg@8.11.2_ts-node@10.9.1/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:211

        throw new QueryFailedError_1.QueryFailedError(query, parameters, err);

              ^

QueryFailedError: relation "game" does not exist

at PostgresQueryRunner.query (/app/node_modules/.pnpm/typeorm@0.3.17_better-sqlite3@8.5.0_pg@8.11.2_ts-node@10.9.1/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:211:19)

at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

at async SelectQueryBuilder.loadRawResults (/app/node_modules/.pnpm/typeorm@0.3.17_better-sqlite3@8.5.0_pg@8.11.2_ts-node@10.9.1/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2183:25)

at async SelectQueryBuilder.executeEntitiesAndRawResults (/app/node_modules/.pnpm/typeorm@0.3.17_better-sqlite3@8.5.0_pg@8.11.2_ts-node@10.9.1/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2034:26)

at async SelectQueryBuilder.getRawAndEntities (/app/node_modules/.pnpm/typeorm@0.3.17_better-sqlite3@8.5.0_pg@8.11.2_ts-node@10.9.1/node_modules/typeorm/query-builder/SelectQueryBuilder.js:684:29)

at async SelectQueryBuilder.getMany (/app/node_modules/.pnpm/typeorm@0.3.17_better-sqlite3@8.5.0_pg@8.11.2_ts-node@10.9.1/node_modules/typeorm/query-builder/SelectQueryBuilder.js:750:25)

at async FilesService.index (/app/dist/src/modules/files/files.service.js:54:33) {

query: 'SELECT "Game"."id" AS "Game_id", "Game"."created_at" AS "Game_created_at", "Game"."updated_at" AS "Game_updated_at", "Game"."deleted_at" AS "Game_deleted_at", "Game"."entity_version" AS "Game_entity_version", "Game"."rawg_id" AS "Game_rawg_id", "Game"."title" AS "Game_title", "Game"."rawg_title" AS "Game_rawg_title", "Game"."version" AS "Game_version", "Game"."release_date" AS "Game_release_date", "Game"."rawg_release_date" AS "Game_rawg_release_date", "Game"."cache_date" AS "Game_cache_date", "Game"."file_path" AS "Game_file_path", "Game"."size" AS "Game_size", "Game"."description" AS "Game_description", "Game"."website_url" AS "Game_website_url", "Game"."metacritic_rating" AS "Game_metacritic_rating", "Game"."average_playtime" AS "Game_average_playtime", "Game"."early_access" AS "Game_early_access", "Game"."type" AS "Game_type", "Game"."box_image_id" AS "Game_box_image_id", "Game"."background_image_id" AS "Game_background_image_id", "Gamebox_image"."id" AS "Gamebox_image_id", "Gamebox_image"."created_at" AS "Game__box_image_created_at", "Gamebox_image"."updated_at" AS "Gamebox_image_updated_at", "Gamebox_image"."deleted_at" AS "Gamebox_image_deleted_at", "Gamebox_image"."entity_version" AS "Gamebox_image_entity_version", "Game__box_image"."source" AS "Gamebox_image_source", "Gamebox_image"."path" AS "Gamebox_image_path", "Gamebox_image"."media_type" AS "Game__box_image_media_type", "Gamebackground_image"."id" AS "Gamebackground_image_id", "Gamebackground_image"."created_at" AS "Gamebackground_image_created_at", "Gamebackground_image"."updated_at" AS "Gamebackground_image_updated_at", "Gamebackground_image"."deleted_at" AS "Gamebackground_image_deleted_at", "Gamebackground_image"."entity_version" AS "Gamebackground_image_entity_version", "Gamebackground_image"."source" AS "Gamebackground_image_source", "Gamebackground_image"."path" AS "Gamebackground_image_path", "Gamebackground_image"."media_type" AS "Gamebackground_image_media_type" FROM "game" "Game" LEFT JOIN "image" "Game__box_image" ON "Gamebox_image"."id"="Game"."box_image_id" AND ("Gamebox_image"."deleted_at" IS NULL) LEFT JOIN "image" "Gamebackground_image" ON "Game__background_image"."id"="Game"."background_image_id" AND ("Game__background_image"."deleted_at" IS NULL) WHERE "Game"."deleted_at" IS NULL',

parameters: [],

driverError: error: relation "game" does not exist

  at /app/node_modules/.pnpm/pg@8.11.2/node_modules/pg/lib/client.js:526:17

  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  at async PostgresQueryRunner.query (/app/node_modules/.pnpm/typeorm@0.3.17_better-sqlite3@8.5.0_pg@8.11.2_ts-node@10.9.1/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:178:25)

  at async SelectQueryBuilder.loadRawResults (/app/node_modules/.pnpm/typeorm@0.3.17_better-sqlite3@8.5.0_pg@8.11.2_ts-node@10.9.1/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2183:25)

  at async SelectQueryBuilder.executeEntitiesAndRawResults (/app/node_modules/.pnpm/typeorm@0.3.17_better-sqlite3@8.5.0_pg@8.11.2_ts-node@10.9.1/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2034:26)

  at async SelectQueryBuilder.getRawAndEntities (/app/node_modules/.pnpm/typeorm@0.3.17_better-sqlite3@8.5.0_pg@8.11.2_ts-node@10.9.1/node_modules/typeorm/query-builder/SelectQueryBuilder.js:684:29)

  at async SelectQueryBuilder.getMany (/app/node_modules/.pnpm/typeorm@0.3.17_better-sqlite3@8.5.0_pg@8.11.2_ts-node@10.9.1/node_modules/typeorm/query-builder/SelectQueryBuilder.js:750:25)

  at async FilesService.index (/app/dist/src/modules/files/files.service.js:54:33) {

length: 105,

severity: 'ERROR',

code: '42P01',

detail: undefined,

hint: undefined,

position: '2034',

internalPosition: undefined,

internalQuery: undefined,

where: undefined,

schema: undefined,

table: undefined,

column: undefined,

dataType: undefined,

constraint: undefined,

file: 'parse_relation.c',

line: '1392',

routine: 'parserOpenTable'

},

length: 105,

severity: 'ERROR',

code: '42P01',

detail: undefined,

hint: undefined,

position: '2034',

internalPosition: undefined,

internalQuery: undefined,

where: undefined,

schema: undefined,

table: undefined,

column: undefined,

dataType: undefined,

constraint: undefined,

file: 'parse_relation.c',

line: '1392',

routine: 'parserOpenTable'

}

Node.js v20.5.1

Alfagun74 commented 1 year ago

Are you starting this container from scratch? What tool are you using to deploy your container? Can you give me your censored Docker-Compose-Configuration?

60plus commented 1 year ago

Are you starting this container from scratch? Yes. I decided to deploy GameVault on my main server.

What tool are you using to deploy your container? Portainer 2.18.4

Can you give me your censored Docker-Compose-Configuration? Sure

version: "3.8"
services:
  gamevault-backend:
    image: phalcode/gamevault-backend:latest
    container_name: GameVault
    restart: unless-stopped
    environment:
      DB_HOST: db
      DB_USERNAME: gamevault
      DB_PASSWORD: PASSWORD
      # The Following Line grants Admin Role to account with this username upon registration.
      SERVER_ADMIN_USERNAME: MYNAME
      # Uncomment and Insert your RAWG API Key here if you have one (http://rawg.io/login?forward=developer)
      RAWG_API_KEY: <MYAPI>
    volumes:
      # Mount the folder where your games are
      - PATH TO STORAGE/GameVAULT/Install:/files
      # Mount the folder where gamevault should store its images
      -  PATH TO STORAGE/APPS/GameVault/Images:/images
    ports:
      - 8581:8080
  db:
    image: postgres:15
    container_name: GameVault-DB
    restart: unless-stopped
    environment:
      POSTGRES_USER: gamevault
      POSTGRES_PASSWORD: PASSWORD
      POSTGRES_DB: gamevault
    volumes:
      # Mount the folder where your postgres database files should land
      - PATH TO STORAGE /APPS/GameVault/DB:/var/lib/postgresql/data

PASSWORD is the same in both containers addig or removing "container_name:" It makes no difference same error.

Alfagun74 commented 1 year ago

can you provide me the full log of gamevault 1 minute after starting it aswell?

60plus commented 1 year ago

can you provide me the full log of gamevault 1 minute after starting it aswell? sure gamevault-backend-2023-08-25.log

Alfagun74 commented 1 year ago

The logs dont really show any error. Could you maybe try the following?

Lucqqq commented 1 year ago

Hi, I got the same. Problem.

I already tried clearing all mapped folders and starting from scratch with new containers, but noting seems to help.

60plus commented 1 year ago

Stop Gamevault And Database Service Delete everything inside of PATH TO STORAGE /APPS/GameVault/DB on your host system Stop Database and Gamevault Service

What i did alerady:

It all started yesterday. Maybe it's somehow connected to yesterday's GameVault-app update.

Alfagun74 commented 1 year ago

It sounds like some badly updated image broke us.

I can reproduce this aswell now. Will try to fix and keep you guys updated ASAP.

Alfagun74 commented 1 year ago

TL;DR: The issue has been resolved in version 4.0.1.

Post Mortem: Surprisingly, the problem wasn't caused by an external update; it was actually my mistake. During the restructuring of the project, I accidentally messed up the paths for the entities and migrations in the database configuration file. This meant that while the update worked for existing users of gamevault-backend, new installations were affected because databases were not populating. Furthermore, I neglected to update the package version when I released v4.0.0, which ended up overwriting v3.0.0 on Docker. I've just released a functional version 4.0.1. I also corrected the paths and re-published the correct v3.0.0.

Please tell me if it works.

60plus commented 1 year ago

Yep. It work again. Thank you.

Alfagun74 commented 1 year ago

@60plus Thank you so much for sponsoring!!!