koel / docker

A minimal docker image for the koel music streaming server.
https://hub.docker.com/r/phanan/koel/
MIT License
178 stars 54 forks source link

Error 500 - personal_access_tokens table remains empty #105

Open Extarys opened 2 years ago

Extarys commented 2 years ago

After installation I ssh inside the container and ran php artisan koel:init --no-assets which created a bunch of tables inside the database. I can see the default admin user inside the users table, personal_access_tokens table is empty.

When I try to log in I get error 500 and this is the log:

[2021-10-25 21:53:22] production.ERROR: SQLSTATE[08006] [7] FATAL:  password authentication failed for user "koel" (SQL: select * from "personal_
access_tokens" where "token" = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 limit 1) {"exception":"[object] (Illuminate\\Data
base\\QueryException(code: 7): SQLSTATE[08006] [7] FATAL:  password authentication failed for user \"koel\" (SQL: select * from \"personal_access
_tokens\" where \"token\" = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 limit 1) at /var/www/html/vendor/laravel/framework/s
rc/Illuminate/Database/Connection.php:692)
[stacktrace]
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(652): Illuminate\\Database\\Connection->runQueryCallback()
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(360): Illuminate\\Database\\Connection->run()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2350): Illuminate\\Database\\Connection->select()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2338): Illuminate\\Database\\Query\\Builder->runSelect()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2872): Illuminate\\Database\\Query\\Builder->Illuminate\\Data
base\\Query\\{closure}()
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2339): Illuminate\\Database\\Query\\Builder->onceWithColumns(
)
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(602): Illuminate\\Database\\Query\\Builder->get()
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(586): Illuminate\\Database\\Eloquent\\Builder->getModels()
#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php(259): Illuminate\\Database\\Eloquent\\Builder->get()

It looks like it cannot create the token or something - although the error is different maybe it is related somehow to #54 ? Since artisan was able to create the tables I doubt it's a read/write permission issue, but to be safe I make the koel user a superuser.

I'm using Postgresql on a Pi 4. This pulled the latest docker version - not sure which one. If you need more info please ask.

Hyzual commented 2 years ago

Hi, sorry for the delay, I haven't tried reproducing since I use MySQL. Does it still occur on the latest version ?

Extarys commented 2 years ago

Hi! No worries I also didn't have the patience or the time to test :smile: I restarted from the beginning. I uses DB_* environment variable in my docker compose. It does seem to create some tables, or is it when I run the initial artisan command, I'm not sure but still.

When I run php artisan koel:init --no-assets:

From koel docker I get:

Migrating database
Oops! Koel installation or upgrade didn't finish successfully.
Please try again, or visit https://docs.koel.dev for manual installation.
šŸ˜„ Sorry for this. You deserve better.

From postgres I get:

    Connection matched pg_hba.conf line 99: "host all all all md5"
2022-01-09 20:14:18.078 UTC [90] ERROR:  cannot drop index artists_name_unique because constraint artists_name_unique on table artists requires it
2022-01-09 20:14:18.078 UTC [90] HINT:  You can drop constraint artists_name_unique on table artists instead.
2022-01-09 20:14:18.078 UTC [90] STATEMENT:  drop index "artists_name_unique"
2022-01-09 20:14:18.080 UTC [90] ERROR:  current transaction is aborted, commands ignored until end of transaction block
2022-01-09 20:14:18.080 UTC [90] STATEMENT:  DEALLOCATE pdo_stmt_00000058

Maybe my previous mistake was that I tried to connect without seeing that error above, therefore login attemps might return code 500.

Between every try, I do:

DROP DATABASE koel;
CREATE DATABASE koel;
GRANT CONNECT ON DATABASE koel TO koel;

As for the settings, I use host postgres with port 5432 user and db koel and it's password.

Koel image: ID: ba74268b845d64bdc0acee5e8955dceaeffb6eddf824f7012f9cf400958dc6cd Date: 2021-12-30 23:04:16 Arch: arm64

I use Postgres version 12. Everything is managed inside Portainer.

Extarys commented 2 years ago

Might be the same issue as https://github.com/koel/koel/issues/1401

DySprozin commented 2 years ago

just

docker exec -it koel_koel_1 bash
chown -R www-data:www-data
exit

and

docker exec --user www-data -it koel_koel_1 bash
php artisan koel:init --no-assets
Archpanda commented 2 years ago
docker exec -it koel_koel_1 bash
chown -R www-data:www-data
exit

Isn't there a missing argument for the 'chown' call ?