Deploy GeoIntel as DockerMan native container
This commit is contained in:
@@ -33,20 +33,12 @@ git reset --hard 'origin/$RemoteBranch'
|
||||
git branch -M '$RemoteBranch'
|
||||
chmod +x scripts/*.sh backend/docker_start.sh deploy/unraid/*.sh || true
|
||||
|
||||
if [ -d /boot/config/plugins/dockerMan ]; then
|
||||
mkdir -p /boot/config/plugins/dockerMan/templates-user /boot/config/plugins/dockerMan/images
|
||||
cp deploy/unraid/geointel-unraid-template.xml /boot/config/plugins/dockerMan/templates-user/my-geointel.xml
|
||||
cp deploy/unraid/geointel-icon.png /boot/config/plugins/dockerMan/images/geointel-icon.png
|
||||
fi
|
||||
|
||||
docker compose down --remove-orphans || true
|
||||
docker compose -f docker-compose.unraid.yml config >/dev/null
|
||||
docker compose -f docker-compose.unraid.yml build geointel
|
||||
docker compose -f docker-compose.unraid.yml up -d
|
||||
docker compose -f docker-compose.unraid.yml ps
|
||||
bash deploy/unraid/run-dockerman-container.sh
|
||||
|
||||
if [ -x scripts/live_migration_smoke.sh ]; then
|
||||
COMPOSE_FILE=docker-compose.unraid.yml bash scripts/live_migration_smoke.sh
|
||||
LIVE_SMOKE_CONTAINER=geointel bash scripts/live_migration_smoke.sh
|
||||
fi
|
||||
|
||||
if [ -x scripts/verify_browser_runtime.sh ]; then
|
||||
|
||||
+2
-10
@@ -34,20 +34,12 @@ git fetch origin "$REMOTE_BRANCH"
|
||||
git checkout -B "$REMOTE_BRANCH" "origin/$REMOTE_BRANCH"
|
||||
chmod +x scripts/*.sh backend/docker_start.sh deploy/unraid/*.sh || true
|
||||
|
||||
if [[ -d /boot/config/plugins/dockerMan ]]; then
|
||||
mkdir -p /boot/config/plugins/dockerMan/templates-user /boot/config/plugins/dockerMan/images
|
||||
cp deploy/unraid/geointel-unraid-template.xml /boot/config/plugins/dockerMan/templates-user/my-geointel.xml
|
||||
cp deploy/unraid/geointel-icon.png /boot/config/plugins/dockerMan/images/geointel-icon.png
|
||||
fi
|
||||
|
||||
docker compose down --remove-orphans || true
|
||||
docker compose -f docker-compose.unraid.yml config >/dev/null
|
||||
docker compose -f docker-compose.unraid.yml build geointel
|
||||
docker compose -f docker-compose.unraid.yml up -d
|
||||
docker compose -f docker-compose.unraid.yml ps
|
||||
bash deploy/unraid/run-dockerman-container.sh
|
||||
|
||||
if [[ -x scripts/live_migration_smoke.sh ]]; then
|
||||
COMPOSE_FILE=docker-compose.unraid.yml bash scripts/live_migration_smoke.sh
|
||||
LIVE_SMOKE_CONTAINER=geointel bash scripts/live_migration_smoke.sh
|
||||
fi
|
||||
|
||||
if [[ -x scripts/verify_browser_runtime.sh ]]; then
|
||||
|
||||
@@ -5,6 +5,7 @@ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
PYTHON_BIN="${PYTHON_BIN:-}"
|
||||
LIVE_SMOKE_USE_DOCKER="${LIVE_SMOKE_USE_DOCKER:-auto}"
|
||||
COMPOSE_FILE_PATH="${COMPOSE_FILE:-docker-compose.yml}"
|
||||
LIVE_SMOKE_CONTAINER="${LIVE_SMOKE_CONTAINER:-}"
|
||||
|
||||
run_docker_smoke() {
|
||||
service_name="$1"
|
||||
@@ -91,6 +92,98 @@ echo "== Live migration smoke passed =="
|
||||
CONTAINER_SCRIPT
|
||||
}
|
||||
|
||||
run_container_smoke() {
|
||||
container_name="$1"
|
||||
cd "$ROOT"
|
||||
|
||||
echo "== GeoIntel live migration smoke =="
|
||||
echo "Using Docker container: ${container_name}."
|
||||
|
||||
docker exec -i "$container_name" sh <<'CONTAINER_SCRIPT'
|
||||
set -eu
|
||||
cd /app
|
||||
|
||||
echo "Database URL is read from backend container settings / DATABASE_URL."
|
||||
|
||||
python - <<'PY'
|
||||
import time
|
||||
|
||||
from sqlalchemy import text
|
||||
from sqlalchemy.exc import OperationalError
|
||||
|
||||
from app.db.session import get_engine
|
||||
|
||||
last_error = None
|
||||
for attempt in range(1, 61):
|
||||
try:
|
||||
with get_engine().connect() as connection:
|
||||
connection.execute(text("SELECT 1"))
|
||||
print(f"Database connection: ok after attempt {attempt}")
|
||||
break
|
||||
except OperationalError as exc:
|
||||
last_error = exc
|
||||
print(f"Database not ready yet ({attempt}/60): {exc}")
|
||||
time.sleep(2)
|
||||
else:
|
||||
raise SystemExit(f"Database did not become ready: {last_error}")
|
||||
PY
|
||||
|
||||
python -m alembic upgrade head
|
||||
|
||||
python - <<'PY'
|
||||
from sqlalchemy import text
|
||||
|
||||
from app.db.session import get_engine
|
||||
|
||||
required_objects = [
|
||||
"public.projects",
|
||||
"public.areas",
|
||||
"public.datasets",
|
||||
"public.jobs",
|
||||
"public.vector_features",
|
||||
"public.quality_checks",
|
||||
"public.metrics",
|
||||
"public.analysis_runs",
|
||||
"public.detections",
|
||||
"public.segmentations",
|
||||
"public.ix_vector_features_geometry",
|
||||
"public.ix_detections_geometry",
|
||||
"public.ix_segmentations_geometry",
|
||||
]
|
||||
|
||||
with get_engine().connect() as connection:
|
||||
postgis_version = connection.execute(text("SELECT PostGIS_Version()")).scalar()
|
||||
print(f"PostGIS version: {postgis_version}")
|
||||
|
||||
missing = [
|
||||
object_name
|
||||
for object_name in required_objects
|
||||
if connection.execute(text("SELECT to_regclass(:object_name)"), {"object_name": object_name}).scalar() is None
|
||||
]
|
||||
if missing:
|
||||
raise SystemExit(f"Missing expected migrated schema objects: {', '.join(missing)}")
|
||||
print("Required runtime schema objects: ok")
|
||||
PY
|
||||
|
||||
HEAD_COUNT="$(python -m alembic heads | grep -c 'head')"
|
||||
if [ "$HEAD_COUNT" -ne 1 ]; then
|
||||
echo "Expected exactly one Alembic head, found $HEAD_COUNT" >&2
|
||||
python -m alembic heads >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
python -m alembic heads
|
||||
echo "== Live migration smoke passed =="
|
||||
CONTAINER_SCRIPT
|
||||
}
|
||||
|
||||
if [ -n "$LIVE_SMOKE_CONTAINER" ] && command -v docker >/dev/null 2>&1; then
|
||||
if docker ps --format '{{.Names}}' | grep -qx "$LIVE_SMOKE_CONTAINER"; then
|
||||
run_container_smoke "$LIVE_SMOKE_CONTAINER"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$LIVE_SMOKE_USE_DOCKER" != "0" ] && command -v docker >/dev/null 2>&1 && [ -f "$ROOT/$COMPOSE_FILE_PATH" ]; then
|
||||
cd "$ROOT"
|
||||
for service_name in geointel backend; do
|
||||
|
||||
Reference in New Issue
Block a user