This repository houses the core Python/Django application framework for the ktinoscare tracking ecosystem. This guide details the explicit configuration steps required to spin up the thin vertical slice (Walking Skeleton) development sandbox on your local machine using containerized components.
Ensure your local workstation has the following base engine configurations installed:
- Docker Desktop (with Docker Compose v2.0+)
- Python 3.12 (for local shell validation loops)
- OSGeo4W (required only when running Django GIS commands from a Windows virtual environment)
winget install OSGeo.OSGeo4WFollow this terminal command workflow sequence exactly to initialize the workspace:
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
Create a .env file in the project's root directory to seed local secrets:
# For Windows Command Prompt or PowerShell
set DJANGO_SECRET_KEY=local_development_secure_key_string_123456789
echo DJANGO_SECRET_KEY="django-insecure-your-hardcoded-fallback-secret-key-here" >> .env
echo DEBUG=True >> .env
The Docker image already installs GDAL, GEOS, and PostgreSQL client headers. If you run Django commands directly from a Windows virtual environment, install native GIS libraries first:
winget install OSGeo.OSGeo4W
$env:GDAL_LIBRARY_PATH = "C:\OSGeo4W\bin\gdal311.dll"
$env:PATH = "C:\OSGeo4W\bin;$env:PATH"
python manage.py makemigrationsIf your OSGeo4W install contains a different GDAL DLL, use the matching file name from C:\OSGeo4W\bin, such as gdal310.dll, gdal309.dll, or gdal308.dll.
Spin up the coordinated database and caching broker network layers in the background:
docker-compose down
docker-compose up -d --build
This command launches 8 structural containers including TimescaleDB (with PostGIS), EMQX Enterprise Broker, Redis, Daphne application hosts, and an Nginx proxy.
Confirm all local ecosystem containers are running securely:
docker-compose ps
Once your container fleet indicates a running status loop, apply migrations to activate the spatial-temporal extensions and convert tables into hypertables:
# Execute migrations inside the web runtime box container
docker-compose exec web python manage.py migrate
If migration fails with an error like:
could not access file "$libdir/timescaledb-tsl-2.28.3": No such file or directory
the existing PostgreSQL volume was initialized with TimescaleDB metadata that expects the TSL-enabled library, but the running database image does not include it. Keep the DB volume and restart with the pinned TSL-enabled image from docker-compose.yml:
docker compose pull db
docker compose up -d db
docker compose exec db psql -U admin -d ktinoscare_db -c "ALTER EXTENSION timescaledb UPDATE;"
docker compose exec web python manage.py migrateFor a disposable development database only, you can instead recreate the volume:
docker compose down -v
docker compose up -d --build
docker compose exec web python manage.py migrate
docker compose up -d --build && docker image prune -fTo debug or monitor local transactions directly on your workbench, access these interface routes:
- 🌐 Django REST API Server Console:
http://localhost:8000/ - 📊 EMQX Management Dashboard UI:
http://localhost:18083/(User:admin| Pass:public) - 🐘 pgAdmin DB Management Tool:
http://localhost:5050/(User:admin@admin.com| Pass:your_pgadmin_password) - 🗲 Local Redis Ingest Broker Port: Exposed on Host Port
16379to prevent Windows socket exclusion conflicts.
To mock and test the asynchronous serverless S3 ingestion webhook pipeline locally without executing live AWS calls, pass a simulated S3 Object Put Event block to your internal webhook listener via curl or Postman:
curl -X POST http://localhost:8000/api/v1/internal/s3-webhook/ \
-H "Content-Type: application/json" \
-d "{\"Records\": [{\"s3\": {\"bucket\": {\"name\": \"ktinoscare-telemetry-bucket\"}, \"object\": {\"key\": \"telemetry/imei/869342061123456/data.csv\"}}}]}"
Executing this ensures your view layer successfully calls the boto3 client emulator, extracts positional CSV markers, passes coordinates to the boundary-safe ST_Covers() predicate, and registers system alert profiles smoothly.