Add Unraid deployment template
This commit is contained in:
@@ -41,15 +41,18 @@ def test_compose_does_not_require_missing_root_env_file() -> None:
|
||||
compose = (ROOT / "docker-compose.yml").read_text(encoding="utf-8")
|
||||
|
||||
assert "env_file:" not in compose
|
||||
assert "DATABASE_URL: postgresql+psycopg://geointel:geointel@db:5432/geointel" in compose
|
||||
assert "DATABASE_URL: postgresql+psycopg://${GEOINTEL_POSTGRES_USER:-geointel}" in compose
|
||||
|
||||
|
||||
def test_compose_exposes_frontend_on_host_port_1202_with_cors_origin() -> None:
|
||||
def test_compose_exposes_frontend_on_configurable_host_port_with_cors_origin() -> None:
|
||||
compose = (ROOT / "docker-compose.yml").read_text(encoding="utf-8")
|
||||
env_example = (ROOT / ".env.example").read_text(encoding="utf-8")
|
||||
|
||||
assert '"1202:80"' in compose
|
||||
assert "CORS_ORIGINS: http://localhost:1202,http://127.0.0.1:1202" in compose
|
||||
assert '"${GEOINTEL_FRONTEND_PORT:-1202}:80"' in compose
|
||||
assert '"${GEOINTEL_BACKEND_PORT:-8000}:8000"' in compose
|
||||
assert "CORS_ORIGINS: ${GEOINTEL_CORS_ORIGINS:-http://localhost:1202,http://127.0.0.1:1202}" in compose
|
||||
assert "GEOINTEL_FRONTEND_PORT=1202" in env_example
|
||||
assert "GEOINTEL_BACKEND_PORT=8000" in env_example
|
||||
assert "http://localhost:1202" in env_example
|
||||
assert "http://127.0.0.1:1202" in env_example
|
||||
|
||||
@@ -92,7 +95,7 @@ def test_compose_does_not_publish_postgis_on_default_host_port() -> None:
|
||||
def test_compose_waits_for_healthy_database_and_applies_migrations() -> None:
|
||||
compose = (ROOT / "docker-compose.yml").read_text(encoding="utf-8")
|
||||
|
||||
assert "pg_isready -U geointel -d geointel" in compose
|
||||
assert "pg_isready -U ${GEOINTEL_POSTGRES_USER:-geointel} -d ${GEOINTEL_POSTGRES_DB:-geointel}" in compose
|
||||
assert "condition: service_healthy" in compose
|
||||
assert "sh /app/docker_start.sh" in compose
|
||||
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
|
||||
|
||||
def test_unraid_template_documents_editable_runtime_settings() -> None:
|
||||
template = (ROOT / "deploy" / "unraid" / "geointel-unraid-template.xml").read_text(encoding="utf-8")
|
||||
|
||||
assert "<Name>GeoIntel Kempen</Name>" in template
|
||||
assert "GeoIntel is a multi-container Docker Compose stack" in template
|
||||
assert "<WebUI>http://[IP]:[PORT:1202]/</WebUI>" in template
|
||||
assert "<Icon>http://[IP]:[PORT:1202]/geointel-icon.svg</Icon>" in template
|
||||
assert 'Target="GEOINTEL_FRONTEND_PORT"' in template
|
||||
assert 'Target="GEOINTEL_BACKEND_PORT"' in template
|
||||
assert 'Target="GEOINTEL_STORAGE_PATH"' in template
|
||||
assert 'Target="GEOINTEL_POSTGRES_PASSWORD"' in template
|
||||
assert 'Mask="true">change-me-before-shared-use</Config>' in template
|
||||
|
||||
|
||||
def test_unraid_env_template_matches_compose_variables() -> None:
|
||||
compose = (ROOT / "docker-compose.yml").read_text(encoding="utf-8")
|
||||
env_template = (ROOT / "deploy" / "unraid" / "geointel.env.example").read_text(encoding="utf-8")
|
||||
|
||||
for key in (
|
||||
"GEOINTEL_FRONTEND_PORT",
|
||||
"GEOINTEL_BACKEND_PORT",
|
||||
"GEOINTEL_STORAGE_PATH",
|
||||
"GEOINTEL_POSTGRES_DB",
|
||||
"GEOINTEL_POSTGRES_USER",
|
||||
"GEOINTEL_POSTGRES_PASSWORD",
|
||||
"GEOINTEL_CORS_ORIGINS",
|
||||
"GEOINTEL_MAX_UPLOAD_MB",
|
||||
):
|
||||
assert key in compose
|
||||
assert f"{key}=" in env_template
|
||||
|
||||
assert "GEOINTEL_FRONTEND_PORT=1202" in env_template
|
||||
assert "GEOINTEL_STORAGE_PATH=/mnt/user/appdata/geointel/storage" in env_template
|
||||
|
||||
|
||||
def test_unraid_readme_explains_port_changes_and_safe_cleanup() -> None:
|
||||
readme = (ROOT / "deploy" / "unraid" / "README.md").read_text(encoding="utf-8")
|
||||
|
||||
assert "cp deploy/unraid/geointel.env.example .env" in readme
|
||||
assert "GEOINTEL_FRONTEND_PORT=1203" in readme
|
||||
assert "docker compose up -d --build" in readme
|
||||
assert "bash scripts/live_migration_smoke.sh" in readme
|
||||
assert "docker builder prune -af" in readme
|
||||
assert "Avoid broad volume pruning" in readme
|
||||
|
||||
|
||||
def test_frontend_and_unraid_icon_assets_are_present() -> None:
|
||||
deploy_icon = (ROOT / "deploy" / "unraid" / "geointel-icon.svg").read_text(encoding="utf-8")
|
||||
frontend_icon = (ROOT / "frontend" / "public" / "geointel-icon.svg").read_text(encoding="utf-8")
|
||||
index = (ROOT / "frontend" / "index.html").read_text(encoding="utf-8")
|
||||
|
||||
assert "<svg" in deploy_icon
|
||||
assert "GeoIntel Kempen" in deploy_icon
|
||||
assert deploy_icon == frontend_icon
|
||||
assert '<link rel="icon" type="image/svg+xml" href="/geointel-icon.svg" />' in index
|
||||
Reference in New Issue
Block a user