Support a genuinely headless install (UI_TYPE=none without Django)

Open
#598 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
28/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Quiet
Tech stack
django, python, sqlite
Domain
build-system

Research direction

Start by grepping LOGGER_MANAGER_DATABASE and setup_django in utils/install_openrvdas.sh and reading where the supervisord config is generated, then run a UI_TYPE=none install to see what it still pulls in. Audit logger/readers/database_reader.py and the installer-written database/settings.py for guarded ORM use, and compare server/sqlite_server_api.py against django_gui/django_server_api.py to judge backend parity. Done means a fresh headless install completes with pure-Python deps only and LoggerManager runs on the sqlite backend.

Written by the indexing model from the issue text.

Description

enhancement

Summary

UI_TYPE=none is meant to be the logger-only install: run loggers on a box that reports to a server elsewhere, with no web console. It works today (as of #597), but it still installs and configures Django, because the installer treats the Django ORM as LoggerManager's backing store regardless of UI choice.

For constrained hardware — a Raspberry Pi running a handful of sensors — that's a database engine, a migration step, and a settings file that nothing subsequently uses.

Why Django is still required

Two places assume it, independent of UI_TYPE:

  1. utils/install_openrvdas.sh runs setup_django unconditionally. Its comment reads "always needed — logger_manager uses Django ORM regardless of which web UI is selected". It copies django_gui/settings.py, then runs manage.py makemigrations and manage.py migrate.
  2. LOGGER_MANAGER_DATABASE=django is written into the supervisord config for every UI type except react, so the running LoggerManager is pointed at the Django backend.

This is why #592's attempt to make Django optional broke headless installs, and why #597 put it back in core.

What already exists

server/logger_manager.py supports three backends and imports them conditionally:

if args.database == 'django':
    from django_gui.django_server_api import DjangoServerAPI
elif args.database == 'memory':
    from server.in_memory_server_api import InMemoryServerAPI
elif args.database == 'sqlite':
    from server.sqlite_server_api import SQLiteServerAPI

server/sqlite_server_api.py is a full ServerAPI implementation with no Django dependency. So the capability is there — the installer just never selects it.

Proposed change

When UI_TYPE=none:

  1. Set LOGGER_MANAGER_DATABASE=sqlite instead of django.
  2. Skip setup_django — no django_gui/settings.py, no migrations.
  3. Move django, djangorestframework and drf-spectacular out of core dependencies into a django extra, installed when UI_TYPE != none. (uwsgi stays in the web extra, installed when UI_TYPE == django, as #597 established.)

Result: a logger-only install pulls 8 pure-Python packages, needs no compiler, no GDAL, and no database engine.

Open questions for whoever picks this up

  • Does anything else in the headless path touch the Django ORM? database/settings.py is written by the installer and imported (guarded) by logger/readers/database_reader.py; that needs checking before Django is removed. Worth auditing rather than assuming.
  • Is sqlite backend parity good enough? It should be verified that cruise load, mode changes and logger status all behave the same under SQLiteServerAPI as under DjangoServerAPI before this becomes the default for any install mode.
  • Migration path for existing headless installs. Someone who installed with UI_TYPE=none today has a Django-backed state DB. Switching backends on upgrade would orphan it. This may need to apply only to fresh installs, or need an explicit opt-in.
  • Does supervisord still make sense here, or should a logger-only mode be lighter still? Out of scope for this issue, but related — see the discussion of an install_minimal.sh, which was considered and set aside in favor of making UI_TYPE=none work properly.

Context

Came out of the v2.6.1 packaging work (#591, #592, #593, #595, #597), which made a compiler-free and GDAL-free install possible. This is the remaining step to make the logger-only case genuinely minimal rather than merely working.

Dominant language
Python
Stars
57
Forks
30
Avg merge
3h 14m
Merged PRs (30d)
56

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OceanDataTools/openrvdas

All issues in OceanDataTools/openrvdas

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.