Files
aars/setup.sh
T
IT狗 eafc1c33fc Add full AARS system - Attendance & Accident Record System
- FastAPI backend with SQLite database
- React + TailwindCSS frontend
- JWT authentication
- Excel upload/download for attendance and accident records
- Shift roster management with S7a/S7b split
- Lateness/OT calculation based on shift times
- Roster info API endpoints
- Export API with token query parameter support
- Docker compose deployment
2026-07-16 03:16:33 +08:00

53 lines
1.2 KiB
Bash

#!/bin/bash
# AARS Setup Script
# Run this on VPS to setup the project
set -e
echo "=== AARS Setup Script ==="
echo ""
# Generate JWT secret if not exists
if [ ! -f backend/secret.py ] || grep -q "change-me" backend/secret.py; then
JWT_SECRET="aars-jwt-$(date +%s)-$(head -c 32 /dev/urandom | base64)"
echo "JWT_SECRET=$JWT_SECRET" > backend/secret.py
echo "✅ Generated JWT secret"
else
echo "✅ JWT secret already exists"
fi
# Create data directory
mkdir -p data
chmod 755 data
# Build Docker image
echo ""
echo "=== Building Docker image ==="
docker compose build
echo ""
echo "=== Starting container ==="
docker compose up -d
echo ""
echo "=== Waiting for container to be healthy ==="
sleep 5
# Check health
for i in {1..10}; do
if curl -sf http://localhost:18775/api/auth/me > /dev/null 2>&1; then
echo "✅ Container is healthy!"
break
fi
echo "⏳ Waiting for container... ($i/10)"
sleep 3
done
echo ""
echo "=== Setup Complete! ==="
echo ""
echo "📍 AARS URL: http://187.127.116.15:18775"
echo "👤 Default login: admin@aars.hk / admin123"
echo ""
echo "⚠️ Please change the default password after first login!"