Skip to main content

Installation

Requirementsโ€‹

  • Docker โ‰ฅ 24 & Docker Compose โ‰ฅ 2 (recommended)
  • Or: Node.js โ‰ฅ 18, .NET SDK 8.0, Python 3.11

Step 1 โ€” Cloneโ€‹

git clone https://github.com/NguyenTriBaoThang/AirSafeNet.git
cd AirSafeNet

Step 2 โ€” Environmentโ€‹

cp .env.example .env

Required variables:

  • POSTGRES_PASSWORD โ€” any strong password
  • JWT_SECRET โ€” at least 32 characters
  • ADMIN_KEY โ€” any string
  • OPENAQ_API_KEY โ€” get free at explore.openaq.org

Optional:

  • TELEGRAM_BOT_TOKEN โ€” for Telegram alerts
  • SMTP_* โ€” for email alerts
  • GEMINI_API_KEY โ€” for AI Assistant

Step 3 โ€” Startโ€‹

docker compose up -d --build

First build takes 3โ€“5 minutes. Subsequent starts: ~30 seconds.

Step 4 โ€” Verifyโ€‹

# Check all containers running
docker compose ps

# Check AI server cache
curl http://localhost:8000/health

Expected health response:

{
"status": "ok",
"model_exists": true,
"forecast_cache_exists": true,
"compute_running": false
}
info

If forecast_cache_exists is false, the AI server is still computing its first cache. Wait 3โ€“8 minutes and refresh.

Troubleshootingโ€‹

Backend can't connect to database:

docker compose logs db
# Wait for "database system is ready to accept connections"
docker compose restart backend

AI server import error:

docker compose logs ai_server
# Usually a missing package โ€” rebuild the image
docker compose up -d --build ai_server

Frontend shows blank page:

# Check VITE_API_BASE_URL in .env
docker compose logs frontend