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

Default Admin Account Not Working #119

Closed Brancliff closed 2 years ago

Brancliff commented 2 years ago

I picked the MySQL docker-compose for koel if that changes anything- but, I just can't get past the login screen.

image

The readme states that with newer versions, it should automatically create a default admin account of email: admin@koel.dev | KoelIsCool. It just hasn't been working for me, and I copy/pasted it, so I know I didn't mistype it or anything.

Am I missing something really obvious here?

Hyzual commented 2 years ago

Hi, you should exec into the container the command php artisan koel:init --no-assets before logging in. This command will run DB migrations and finish setup. Please see the First run section of the README for the commands.

It is not done automatically by the container, see #68 for more details about that.

Brancliff commented 2 years ago

Thank you! I cant believe I was missing something really obvious after all. I did see this in the README, but I guessed that it was an either-or situation-- like, v5.1.0 users would use the default account while anyone v5.0 and below users would go through the DB creation setup. I now know it's not quite like that- my bad!

I've gotten to the Web UI itself and now I have two questions:

  1. I'm having trouble connecting my music folder. The absolute path from root to the music folder is /share/CE_CACHEDEV1_DATA/Library/Projects/Koel/music/. I know the path works since I copy/pasted the path when looking for it through SFTP, but koel says its either not valid or readable. Is there a command I need to run to give koel permission to the folder? The folder itself wasn't made with any special permissions in mind, I'm the only person using my NAS.
  2. The Koel demo website has support for displaying YouTube videos - I don't see that in mine. Is there any way to enable that?
Hyzual commented 2 years ago

Sorry for the misunderstanding, it is still required to run the command the first time you run the container. Let me know if you have ideas on how to phrase it better in the README :wink:.

About question 1., you should make sure the music folder is readable / accessible by the www-data user which should have uid/gid = 1000. The easiest way to check is to exec into the container with docker exec -it <container_name_for_koel> bash and then ls -la /share/CE_CACHEDEV1_DATA/Library/Projects/Koel/music/. Those commands should let you know if there is a filesystem permission problem.

About question 2., I have never done so myself but there is a section in the documentation related to that: Youtube setup. As for the docker container, you can pass it the YOUTUBE_API_KEY env variable. As it should stay secret, I suggest to create an .env file and restrict its permissions and then pass it via docker-compose, for example:

#koel.env
YOUTUBE_API_KEY=<key>
#docker-compose.yml
koel:
  #...
  ports: #...
  env_file:
    - koel.env
  volumes: #...
Brancliff commented 2 years ago

Oh, this was another silly oversight for me - since I mounted the music folder in my docker-compose, /music links to /Library/Projects/Koel/music/, so actually, all I needed to do was tell the container to point to /music to find my audio.

Thanks a lot! I've actually gotten things set up, connected my music, and my YouTube api key. Things are moving well and I'm able to start moving everything over! I just have two things I'm still thinking about:

  1. Sometimes when rescanning my library, I'll just get "unknown error" as the red popup in the top right. Since all I have to type is /music (and its autofilled when I show up), I know its typed correctly-- and, it'll work if I just tell it to rescan again a few times, but do you have any ideas why it sometimes takes and sometimes doesn't? Kinda feels like when the USB only goes in on the third try
  2. On the topic of rescanning my library, could you guide me through how to [https://docs.koel.dev/watch.html#_2-set-up-a-watcher-script](set up the watcher script) on docker? It seems like the guidance here is moreso if you're running on a desktop, rather than a headless container - I'm just not sure what the docker equivalents of what it's asking for are, and I'm actually not great with Linux either, I'm just some kid who bought a NAS qnq

Thanks so much for helping me get this far!

Hyzual commented 2 years ago

Hi, I'm glad you could make it work :smiley:.

  1. Sometimes when rescanning my library, I'll just get "unknown error" as the red popup in the top right.

I've encountered that too, and frankly I don't have ideas on why it works sometimes. This is why I preferred to run the scan on the command-line because it gives you more feedback for what the errors were. Maybe you can find the errors in the log files at /var/www/html/storage/laravel.log ? The file might not exist, which would mean there are no logs.

  1. On the topic of rescanning my library, could you guide me through how to [https://docs.koel.dev/watch.html#_2-set-up-a-watcher-script](set up the watcher script) on docker?

Unfortunately, I don't know if I can help you, I've never set this up :sweat_smile:. I don't have the setup to try right now but if inotifywait does not exist on the container, maybe it's possible to install it with apt-get install inotifywait or something similar. The docker image is based on Debian, so commands like apt-get might work.

You're welcome !

mqu commented 1 year ago

hello

using docker-compose + postgresql is not working ; defaut admin account is created with latest koel version, but unable to login.

when I try to change password, I have this issue ; can't explain why.

marc@nas:~/docker/kalif/music-koel$ docker-compose exec koel bash
root@872051bd5ca8:/var/www/html# php artisan koel:admin:change-password

   Illuminate\Database\QueryException 

  SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "users" does not exist
LINE 1: select * from "users" where "is_admin" = $1 limit 1
                      ^ (SQL: select * from "users" where "is_admin" = 1 limit 1)

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:759
    755▕         // If an exception occurs when attempting to run a query, we'll format the error
    756▕         // message to include the bindings with SQL, which will make this exception a
    757▕         // lot more helpful to the developer instead of just the database's errors.
    758▕         catch (Exception $e) {
  ➜ 759▕             throw new QueryException(
    760▕                 $query, $this->prepareBindings($bindings), $e
    761▕             );
    762▕         }
    763▕     }

      +12 vendor frames 
  13  app/Console/Commands/Admin/ChangePasswordCommand.php:30
      Illuminate\Database\Eloquent\Builder::first()

      +13 vendor frames 
  27  artisan:35
      Illuminate\Foundation\Console\Kernel::handle()

switching to mysql database is OK for me. Docker-compose.yml file are nearly same as in this repo.