diskover-community icon indicating copy to clipboard operation
diskover-community copied to clipboard

There was an error connecting to the database! unable to open database file

Open prochuk opened this issue 1 year ago • 7 comments

Getting error "There was an error connecting to the database! unable to open database file" when try to run crawl

prochuk avatar Aug 19 '24 19:08 prochuk

@prochuk Are you running lsio dockerhub diskover ce 2.3.0? Do you have env var DATABASE set to anything?

shirosaidev avatar Aug 20 '24 04:08 shirosaidev

@shirosaidev Yes, running lsio docker image diskover-web v2.3.0 community edition (ce). Don't have any var related to database, only ES_HOST, ES_PORT and TZ.

prochuk avatar Aug 21 '24 08:08 prochuk

@prochuk please post a message in lsio discord container support.

shirosaidev avatar Aug 22 '24 05:08 shirosaidev

The error is coming from '/app/diskover/diskover_db.py' line 45.

'diskover_db.py' gets the DATABASE parameter from '/app/diskover/config_defaults.py'. Out of the box it is set to:

'DATABASE': '/var/www/diskover-web/diskoverdb.sqlite3'

But it should be:

'DATABASE': '/config/diskoverdb.sqlite3'

Apparently 'diskover_db.py' is not changed by setting env vars. It only works if you change '/app/diskover/config_defaults.py' in the diskover container.

OpenCV-Peter avatar Aug 26 '24 13:08 OpenCV-Peter

@OpenCV-Peter In line 35 to 39 in diskover_db.py looks for DATABASE env var. In lsio diskover docker container start up, it is not set. Either the config_defaults.py file needs to be changed or DATABASE env var set.

# Get database file path from config defaults
dbfile = conf['DATABASE']
# Check for env var
if os.getenv('DATABASE') is not None:
    dbfile = os.getenv('DATABASE')

shirosaidev avatar Aug 26 '24 15:08 shirosaidev

Hey guys,

Thanks @shirosaidev for the info. I fixed the issue by adding the DATABASE environment variable to my docker compose file. Here's an example:

diskover:
  image: lscr.io/linuxserver/diskover
  container_name: diskover
  hostname: diskover
  environment:
    PUID: 1000
    PGID: 1000
    TZ: Europe/Paris
    ES_HOST: elasticsearch
    ES_PORT: 9200
    RUN_ON_START: true
    DATABASE: /config/diskoverdb.sqlite3
  volumes:
    # ...

ts-sz avatar Aug 29 '24 18:08 ts-sz

Hey guys,

Thanks @shirosaidev for the info. I fixed the issue by adding the DATABASE environment variable to my docker compose file. Here's an example:

diskover:
  image: lscr.io/linuxserver/diskover
  container_name: diskover
  hostname: diskover
  environment:
    PUID: 1000
    PGID: 1000
    TZ: Europe/Paris
    ES_HOST: elasticsearch
    ES_PORT: 9200
    RUN_ON_START: true
    DATABASE: /config/diskoverdb.sqlite3
  volumes:
    # ...

I was having the same issue and can confirm adding the DATABASE env fixed it.

felipemeres avatar Sep 02 '24 16:09 felipemeres