2.3 KiB
2.3 KiB
Specification: Fix LiteFS Configuration and Process Management (fix_litefs_config)
Overview
Reconfigure the Navidrome/LiteFS process management to ensure Navidrome and its Consul service registration only occur on the Primary node. This will be achieved by leveraging the LiteFS exec block and updating the entrypoint.sh logic. Additionally, correct the Navidrome database and storage paths to properly utilize the LiteFS replicated mount.
Functional Requirements
- LiteFS Configuration (
litefs.yml):- Enable the
execblock to trigger/usr/local/bin/entrypoint.sh. - This allows LiteFS to manage the lifecycle of the application.
- Enable the
- Entrypoint Logic (
entrypoint.sh):- Implement a supervision loop that monitors leadership via the
/data/.primaryfile. - On Primary:
- Register the node as the
navidrome(primary) service in Consul. - Start the Navidrome process.
- Register the node as the
- On Replica:
- Ensure Navidrome is NOT running.
- Deregister the
navidromeprimary service if previously registered. - (Optional) Register as a replica service or simply wait.
- On Transition: Handle graceful shutdown of Navidrome if the node loses leadership.
- Implement a supervision loop that monitors leadership via the
- Storage and Path Configuration (
navidrome-litefs-v2.nomad):- Set
ND_DATAFOLDERto/data(the LiteFS FUSE mount). - Set
ND_CACHEFOLDERto/shared_data/cache(shared persistent storage). - Set
ND_BACKUP_PATHto/shared_data/backup(shared persistent storage).
- Set
- Dockerfile Updates:
- Update
ENTRYPOINTto["litefs", "mount"]to allow LiteFS to act as the supervisor.
- Update
Non-Functional Requirements
- Robustness: Use a simple bash loop for process management to avoid extra dependencies.
- Signal Handling: Ensure signals (SIGTERM) are correctly forwarded to Navidrome for graceful shutdown.
Acceptance Criteria
- Navidrome process runs ONLY on the Primary node.
- Consul service
navidromecorrectly points to the current Primary. - Navidrome database (
navidrome.db) is confirmed to be on the/datamount. - Cluster failover correctly stops Navidrome on the old primary and starts it on the new one.
Out of Scope
- Implementation of complex init systems like
tini(bash loop selected by user).