certtools / intelmq-api

FastAPI-based API for the IntelMQ project
https://docs.intelmq.org/latest/user/api/
1 stars 7 forks source link

hug -m intelmq_api.serve #34

Closed oscarliz closed 3 years ago

oscarliz commented 3 years ago
Loading config from /etc/intelmq/api-config.json
Traceback (most recent call last):
  File "/usr/local/bin/hug", line 8, in <module>
    sys.exit(development_runner.hug.interface.cli())
  File "/usr/local/lib/python3.8/dist-packages/hug/interface.py", line 650, in __call__
    raise exception
  File "/usr/local/lib/python3.8/dist-packages/hug/interface.py", line 646, in __call__
    result = self.output(self.interface(**pass_to_function), context)
  File "/usr/local/lib/python3.8/dist-packages/hug/interface.py", line 129, in __call__
    return __hug_internal_self._function(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/hug/development_runner.py", line 91, in hug
    _start_api(
  File "/usr/local/lib/python3.8/dist-packages/hug/development_runner.py", line 42, in _start_api
    API(api_module).http.serve(host, port, no_404_documentation, show_intro)
  File "/usr/local/lib/python3.8/dist-packages/hug/api.py", line 277, in serve
    api = self.server()
  File "/usr/local/lib/python3.8/dist-packages/hug/api.py", line 371, in server
    self.api._ensure_started()
  File "/usr/local/lib/python3.8/dist-packages/hug/api.py", line 638, in _ensure_started
    startup_handler(self)
  File "/usr/local/lib/python3.8/dist-packages/intelmq_api/serve.py", line 46, in setup
    intelmq_api.api.initialize_api(api_config)
  File "/usr/local/lib/python3.8/dist-packages/intelmq_api/api.py", line 80, in initialize_api
    session_store = session.SessionStore(str(session_file),
  File "/usr/local/lib/python3.8/dist-packages/intelmq_api/session.py", line 86, in __init__
    self.init_sqlite_db()
  File "/usr/local/lib/python3.8/dist-packages/intelmq_api/session.py", line 100, in init_sqlite_db
    with self.connect() as con:
  File "/usr/local/lib/python3.8/dist-packages/intelmq_api/session.py", line 91, in connect
    return sqlite3.connect(self.dbname, check_same_thread=False,
sqlite3.OperationalError: unable to open database file
ghost commented 3 years ago

sqlite3.OperationalError: unable to open database file

Is the file and the directory containing it writeable for the user?

oscarliz commented 3 years ago

The steps that I followed were with the native packages these have the problem that they do not create the directory called dbconfig-common that contains the sqlite3 subdirectory and then inside it contains the intelmq-api which houses the api database to solve it I went to the path /var/lib and create the directory with its respective subdirectories

ghost commented 3 years ago

Which exact operating system and version do you use? Which user did you use to run hug?

oscarliz commented 3 years ago

2.3.3

oscarliz commented 3 years ago

ubuntu 20.4 intelmq 2.3.3

ghost commented 3 years ago

The steps that I followed were with the native packages these have the problem that they do not create the directory called dbconfig-common that contains the sqlite3 subdirectory and then inside it contains the intelmq-api which houses the api database to solve it I went to the path /var/lib and create the directory with its respective subdirectories

We are unable to reproduce the missing dbconfig-common directory. The database and directoey should be created automatically by the package, so there's not manual intervention needed. Which session database file path do you now have in /etc/intelmq/api-config.json?

ghost commented 3 years ago

Closing because of inactivity. Please reopen if needed.