Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postgress is set but tries to use sqlite? #189

Open
Serph91P opened this issue Aug 10, 2024 · 4 comments
Open

postgress is set but tries to use sqlite? #189

Serph91P opened this issue Aug 10, 2024 · 4 comments

Comments

@Serph91P
Copy link

Serph91P commented Aug 10, 2024

After this koel/koel#1811 I setup the container on another server.
Accesssed the docker like this: docker exec --user www-data -it koel bash
Tried to run php artisan koel:init --no-assets command but it fails because it cannot migrate. After looking at the logs it says it cannot open the database file and its using the sqliteEngine? System is running Unraid with docker-compose.

docker-compose.yml:

services:
  koel:
    image: phanan/koel
    container_name: koel
    depends_on:
      - database
    ports:
      - 8181:80
    environment:
      - DB_CONNECTION=pgsql
      - DB_HOST=koel-database
      - DB_PORT=5432
      - DB_USERNAME=koel
      - DB_PASSWORD=password
      - DB_DATABASE=koel
      - APP_KEY=appkey
    volumes:
      - /mnt/user/data/media/koel-music:/music
      - /mnt/cache/appdata/koel/covers:/var/www/html/public/img/covers
      - /mnt/cache/appdata/koel/search_index:/var/www/html/storage/search-indexes
    networks:
      - koel-network

  database:
    image: postgres:13
    container_name: koel-database
    volumes:
      - /mnt/cache/appdata/koel/db:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=koel
      - POSTGRES_USER=koel
      - POSTGRES_PASSWORD=password
    networks:
      - koel-network

networks:
  koel-network:
    driver: bridge

Logs:

php artisan koel:init --no-assets
************************************
*     KOEL INSTALLATION WIZARD     *
************************************

As a reminder, you can always install/upgrade manually following the guide at https://docs.koel.dev

  Clearing caches ..................................................................................................... 4ms DONE
  Copying .env file ................................................................................................... 0ms DONE
  Retrieving app key .................................................................................................. 0ms DONE
  Using app key: base64:uE4kX7J5V.. ....................................................................................... DONE
  Migrating database ................................................................................................. 20ms FAIL

   ERROR  Oops! Koel installation or upgrade didn't finish successfully.  

   ERROR  Please check the error log at storage/logs/laravel.log and try again.  

   ERROR  For further troubleshooting, visit https://docs.koel.dev/troubleshooting.  

   ERROR  😥 Sorry for this. You deserve better.  

www-data@46d92dabb7d4:~/html$ cd storage/logs/
www-data@46d92dabb7d4:~/html/storage/logs$ cat laravel.log 
[2024-08-10 06:50:57] production.ERROR: PDOException: SQLSTATE[HY000] [14] unable to open database file in /var/www/html/vendor/teamtnt/tntsearch/src/Engines/SqliteEngine.php:61
Stack trace:
#0 /var/www/html/vendor/teamtnt/tntsearch/src/Engines/SqliteEngine.php(61): PDO->__construct()
#1 /var/www/html/vendor/teamtnt/tntsearch/src/Indexer/TNTIndexer.php(119): TeamTNT\TNTSearch\Engines\SqliteEngine->createIndex()
#2 /var/www/html/vendor/teamtnt/tntsearch/src/TNTSearch.php(75): TeamTNT\TNTSearch\Indexer\TNTIndexer->createIndex()
#3 /var/www/html/vendor/teamtnt/laravel-scout-tntsearch-driver/src/Engines/TNTSearchEngine.php(327): TeamTNT\TNTSearch\TNTSearch->createIndex()
#4 /var/www/html/vendor/teamtnt/laravel-scout-tntsearch-driver/src/Engines/TNTSearchEngine.php(55): TeamTNT\Scout\Engines\TNTSearchEngine->initIndex()
#5 /var/www/html/vendor/laravel/scout/src/Searchable.php(63): TeamTNT\Scout\Engines\TNTSearchEngine->update()
#6 /var/www/html/vendor/laravel/scout/src/Searchable.php(42): App\Models\Artist->queueMakeSearchable()
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Macroable/Traits/Macroable.php(123): Illuminate\Database\Eloquent\Collection->Laravel\Scout\{closure}()
#8 /var/www/html/vendor/laravel/scout/src/Searchable.php(183): Illuminate\Support\Collection->__call()
#9 /var/www/html/vendor/laravel/scout/src/ModelObserver.php(109): App\Models\Artist->searchable()
#10 /var/www/html/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(478): Laravel\Scout\ModelObserver->saved()
#11 /var/www/html/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(286): Illuminate\Events\Dispatcher->Illuminate\Events\{closure}()
#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(266): Illuminate\Events\Dispatcher->invokeListeners()
#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php(216): Illuminate\Events\Dispatcher->dispatch()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1176): Illuminate\Database\Eloquent\Model->fireModelEvent()
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1149): Illuminate\Database\Eloquent\Model->finishSave()
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1024): Illuminate\Database\Eloquent\Model->save()
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/helpers.php(307): Illuminate\Database\Eloquent\Builder->Illuminate\Database\Eloquent\{closure}()
#18 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1025): tap()
#19 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php(23): Illuminate\Database\Eloquent\Builder->create()
#20 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(2334): Illuminate\Database\Eloquent\Model->forwardCallTo()
#21 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(2346): Illuminate\Database\Eloquent\Model->__call()
#22 /var/www/html/database/migrations/2016_04_16_082627_create_various_artists.php(44): Illuminate\Database\Eloquent\Model::__callStatic()
#23 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(493): CreateVariousArtists->up()
#24 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(410): Illuminate\Database\Migrations\Migrator->runMethod()
#25 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Concerns/ManagesTransactions.php(30): Illuminate\Database\Migrations\Migrator->Illuminate\Database\Migrations\{closure}()
#26 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(418): Illuminate\Database\Connection->transaction()
#27 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(216): Illuminate\Database\Migrations\Migrator->runMigration()
#28 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/View/Components/Task.php(37): Illuminate\Database\Migrations\Migrator->Illuminate\Database\Migrations\{closure}()
#29 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(756): Illuminate\Console\View\Components\Task->render()
#30 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(216): Illuminate\Database\Migrations\Migrator->write()
#31 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(181): Illuminate\Database\Migrations\Migrator->runUp()
#32 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(124): Illuminate\Database\Migrations\Migrator->runPending()
#33 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(92): Illuminate\Database\Migrations\Migrator->run()
#34 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(633): Illuminate\Database\Console\Migrations\MigrateCommand->Illuminate\Database\Console\Migrations\{closure}()
#35 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(104): Illuminate\Database\Migrations\Migrator->usingConnection()
#36 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Database\Console\Migrations\MigrateCommand->handle()
#37 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#38 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#39 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#40 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\Container\BoundMethod::call()
#41 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\Container\Container->call()
#42 /var/www/html/vendor/symfony/console/Command/Command.php(326): Illuminate\Console\Command->execute()
#43 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(181): Symfony\Component\Console\Command\Command->run()
#44 /var/www/html/vendor/symfony/console/Application.php(1096): Illuminate\Console\Command->run()
#45 /var/www/html/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand()
#46 /var/www/html/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
#47 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Application.php(163): Symfony\Component\Console\Application->run()
#48 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(400): Illuminate\Console\Application->call()
#49 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(355): Illuminate\Foundation\Console\Kernel->call()
#50 /var/www/html/app/Console/Commands/InitCommand.php(270): Illuminate\Support\Facades\Facade::__callStatic()
#51 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/View/Components/Task.php(37): App\Console\Commands\InitCommand::App\Console\Commands\{closure}()
#52 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/View/Components/Factory.php(58): Illuminate\Console\View\Components\Task->render()
#53 /var/www/html/app/Console/Commands/InitCommand.php(271): Illuminate\Console\View\Components\Factory->__call()
#54 /var/www/html/app/Console/Commands/InitCommand.php(58): App\Console\Commands\InitCommand->migrateDatabase()
#55 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Console\Commands\InitCommand->handle()
#56 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#57 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#58 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#59 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\Container\BoundMethod::call()
#60 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\Container\Container->call()
#61 /var/www/html/vendor/symfony/console/Command/Command.php(326): Illuminate\Console\Command->execute()
#62 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(181): Symfony\Component\Console\Command\Command->run()
#63 /var/www/html/vendor/symfony/console/Application.php(1096): Illuminate\Console\Command->run()
#64 /var/www/html/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand()
#65 /var/www/html/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
#66 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\Component\Console\Application->run()
#67 /var/www/html/artisan(35): Illuminate\Foundation\Console\Kernel->handle()
#68 {main}  
@Serph91P
Copy link
Author

If I connect without a user and run the command, it runs fine?

root@b97b9bfd39ee:/var/www/html# php artisan koel:init --no-assets
************************************
*     KOEL INSTALLATION WIZARD     *
************************************

As a reminder, you can always install/upgrade manually following the guide at https://docs.koel.dev

  Clearing caches ..................................................................................................... 5ms DONE
  .env file exists -- skipping ............................................................................................ DONE
  Retrieving app key .................................................................................................. 0ms DONE
  Using app key: base64:uE4kX7J5V.. ....................................................................................... DONE
  Migrating database ................................................................................................ 631ms DONE
  Creating default admin account ..................................................................................... 56ms DONE
  Seeding data ...................................................................................................... 125ms DONE

The absolute path to your media directory. You can leave it blank and set it later via the web interface.
If you plan to use Koel with a cloud provider (S3 or Dropbox), you can also skip this.

 Media path [/music]:
 > /music

   INFO  Trying to install Koel scheduler….  

   INFO  Koel scheduler installed successfully.  


                                                                                                                        
 [OK] All done!                                                                                                         
                                                                                                                        

Koel can now be run from localhost with `php artisan serve`.
Log in with email [email protected] and password KoelIsCool
Again, visit 📙 https://docs.koel.dev for more tips and tweaks.
Feeling generous and want to support Koel’s development? Check out https://github.com/users/phanan/sponsorship 🤗
Thanks for using Koel. You rock! 🤘

But the error with the access to the database remains.

@sbialka
Copy link

sbialka commented Aug 14, 2024

Fix for your compose:

services:
  koel:
    image: phanan/koel
    container_name: koel

    depends_on:
      - database

    ports:
      - 8181:80

    environment:
      - DB_CONNECTION=pgsql
      - DB_HOST=koel-database
      - DB_PORT=5432
      - DB_USERNAME=koel
      - DB_PASSWORD=password
      - DB_DATABASE=koel
      - APP_KEY=appkey

    volumes:
    #  - /mnt/user/data/media/koel-music:/music
    #  - /mnt/cache/appdata/koel/covers:/var/www/html/public/img/covers
    #  - /mnt/cache/appdata/koel/search_index:/var/www/html/storage/search-indexes
      - music:/music
      - covers:/var/www/html/public/img/covers
      - search_index:/var/www/html/storage/search-indexes

    networks:
      - koel-network

  database:
    image: postgres:13
    container_name: koel-database

    volumes:
    #  - /mnt/cache/appdata/koel/db:/var/lib/postgresql/data
      - db:/var/lib/postgresql/data

    environment:
      - POSTGRES_DB=koel
      - POSTGRES_USER=koel
      - POSTGRES_PASSWORD=password

    networks:
      - koel-network

networks:
  koel-network:
    driver: bridge

# Add following
volumes:
  music:
    driver: local
    driver_opts:
       o: bind
       type: none
       device: /mnt/user/data/media/koel-music

  covers:
    driver: local
    driver_opts:
       o: bind
       type: none
       device: /mnt/cache/appdata/koel/covers

  search_index:
    driver: local
    driver_opts:
       o: bind
       type: none
       device: /mnt/cache/appdata/koel/search_index

  db:
    driver: local
    driver_opts:
       o: bind
       type: none
       device: /mnt/cache/appdata/koel/db

@Serph91P
Copy link
Author

Fix for your compose:

services:
  koel:
    image: phanan/koel
    container_name: koel

    depends_on:
      - database

    ports:
      - 8181:80

    environment:
      - DB_CONNECTION=pgsql
      - DB_HOST=koel-database
      - DB_PORT=5432
      - DB_USERNAME=koel
      - DB_PASSWORD=password
      - DB_DATABASE=koel
      - APP_KEY=appkey

    volumes:
    #  - /mnt/user/data/media/koel-music:/music
    #  - /mnt/cache/appdata/koel/covers:/var/www/html/public/img/covers
    #  - /mnt/cache/appdata/koel/search_index:/var/www/html/storage/search-indexes
      - music:/music
      - covers:/var/www/html/public/img/covers
      - search_index:/var/www/html/storage/search-indexes

    networks:
      - koel-network

  database:
    image: postgres:13
    container_name: koel-database

    volumes:
    #  - /mnt/cache/appdata/koel/db:/var/lib/postgresql/data
      - db:/var/lib/postgresql/data

    environment:
      - POSTGRES_DB=koel
      - POSTGRES_USER=koel
      - POSTGRES_PASSWORD=password

    networks:
      - koel-network

networks:
  koel-network:
    driver: bridge

# Add following
volumes:
  music:
    driver: local
    driver_opts:
       o: bind
       type: none
       device: /mnt/user/data/media/koel-music

  covers:
    driver: local
    driver_opts:
       o: bind
       type: none
       device: /mnt/cache/appdata/koel/covers

  search_index:
    driver: local
    driver_opts:
       o: bind
       type: none
       device: /mnt/cache/appdata/koel/search_index

  db:
    driver: local
    driver_opts:
       o: bind
       type: none
       device: /mnt/cache/appdata/koel/db

you changed my bindings to volumes but how does that fix my problem?

@qweryty
Copy link

qweryty commented Aug 29, 2024

It looks like a permission issue. Adding +w on directories solved this for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants