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 passwordJWT_SECRETโ at least 32 charactersADMIN_KEYโ any stringOPENAQ_API_KEYโ get free at explore.openaq.org
Optional:
TELEGRAM_BOT_TOKENโ for Telegram alertsSMTP_*โ for email alertsGEMINI_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