koel / docker

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

Looping: WARN Cannot connect to the database. Let's set it up. #178

Closed viasux closed 1 year ago

viasux commented 1 year ago

I keep getting the error, "WARN Cannot connect to the database. Let's set it up."

relevant output from docker ps:

8351417fe0ad   phanan/koel                       "koel-entrypoint apa…"   18 minutes ago   Up 18 minutes (healthy)             80/tcp, 0.0.0.0:87->87/tcp, :::87->87/tcp                               docker_koel_1
b154ac65a56f   postgres:13                       "docker-entrypoint.s…"   18 minutes ago   Up 18 minutes                       5432/tcp                                                                docker_database_1

docker exec --user www-data -it docker_koel_1 bash www-data@:~/html$ php artisan koel:init --no-assets:

Your DB driver of choice [MySQL/MariaDB]:
  [mysql     ] MySQL/MariaDB
  [pgsql     ] PostgreSQL
  [sqlsrv    ] SQL Server
  [sqlite-e2e] SQLite
 > pgsql

 DB host:
 > docker_database_1

 DB port (leave empty for default):
 > (tried 5432, 87:87 (what was in compose), and default)

 DB name:
 > koel

 DB user:
 > koel

 DB password:
 > password from compose

   WARN  Cannot connect to the database. Let's set it up.  

docker compose:


services:
  koel:
    image: phanan/koel
    depends_on:
      - database
    ports:
      - 87:87
    environment:
      - DB_CONNECTION=pgsql
      - DB_HOST=database
      - DB_USERNAME=koel
      - DB_PASSWORD=password
      - DB_DATABASE=koel
    volumes:
      - music:/music
      - covers:/var/www/html/public/img/covers
      - search_index:/var/www/html/storage/search-indexes

  database:
    image: postgres:13
    volumes:
      - db:/var/lib/postgresql/data'
    environment:
      - POSTGRES_DB=koel
      - POSTGRES_USER=koel
      - POSTGRES_PASSWORD=password (same as before, not sure if this was supposed to be a different password?)
viasux commented 1 year ago

possibly related to #168

viasux commented 1 year ago

even with the updated docker-compose, the issue persists:

version: '3'

services:
  koel:
    image: phanan/koel
    depends_on:
      - database
    ports:
      - 87:87
    environment:
      - DB_PORT=5432
      - DB_CONNECTION=pgsql
      - DB_HOST=database
      - DB_USERNAME=koel
      - DB_PASSWORD=password
      - DB_DATABASE=koel
    volumes:
      - music:/music
      - covers:/var/www/html/public/img/covers
      - search_index:/var/www/html/storage/search-indexes

  database:
    image: postgres:13
    volumes:
      - db:/var/lib/postgresql/data'
    environment:
      - POSTGRES_DB=koel
      - POSTGRES_USER=koel
      - POSTGRES_PASSWORD=password
volumes:
  db:
    driver: local
  music:
    driver: local
  covers:
    driver: local
  search_index:
    driver: local
viasux commented 1 year ago

the issue was using docker-compose instead of docker compose