- Add configuration system (config/*.exs, OrgGarden.Config) - Refactor supervision tree with DynamicSupervisor and Registry - Add OrgGarden.Server for serve mode lifecycle management - Add health check HTTP endpoints (Bandit/Plug on :9090) - Add telemetry events for export and watcher operations - Implement graceful shutdown with SIGTERM handling - Add Mix Release support with overlay scripts - Add NixOS module for systemd service deployment - Update documentation with service usage
40 lines
1.1 KiB
Elixir
40 lines
1.1 KiB
Elixir
defmodule OrgGarden.Application do
|
|
@moduledoc """
|
|
OTP Application for org-garden.
|
|
|
|
Starts core infrastructure services:
|
|
- Finch HTTP client pool
|
|
- Process registry for named lookups
|
|
- DynamicSupervisor for runtime-started services
|
|
- Health check HTTP server
|
|
|
|
Service-mode components (Watcher, Quartz) are started dynamically
|
|
via OrgGarden.Server when running in serve mode.
|
|
"""
|
|
use Application
|
|
|
|
@impl true
|
|
def start(_type, _args) do
|
|
children = [
|
|
# HTTP client pool for Zotero/external requests
|
|
{Finch, name: OrgGarden.Finch},
|
|
|
|
# Process registry for named lookups
|
|
{Registry, keys: :unique, name: OrgGarden.Registry},
|
|
|
|
# Dynamic supervisor for serve mode components
|
|
{DynamicSupervisor, name: OrgGarden.DynamicSupervisor, strategy: :one_for_one},
|
|
|
|
# Health check HTTP server
|
|
{Bandit, plug: OrgGarden.Health, port: health_port(), scheme: :http}
|
|
]
|
|
|
|
opts = [strategy: :one_for_one, name: OrgGarden.AppSupervisor]
|
|
Supervisor.start_link(children, opts)
|
|
end
|
|
|
|
defp health_port do
|
|
Application.get_env(:org_garden, :health_port, 9090)
|
|
end
|
|
end
|