This commit is contained in:
ilyastar9999
2025-12-02 14:01:34 +03:00
parent 96e1e5a7e0
commit cffbd77b74
31 changed files with 3335 additions and 0 deletions

140
QUICKSTART.md Normal file
View File

@@ -0,0 +1,140 @@
# Quick Start Guide
## Prerequisites
- Docker and Docker Compose installed
- Git installed
- A Telegram bot token (optional but recommended)
## Installation Steps
### 1. Clone and Configure
```bash
git clone <your-repo-url>
cd attack-defence-infr-control
cp .env.example .env
```
### 2. Edit Configuration
Open `.env` and configure:
```bash
# Required
SECRET_TOKEN=<generate random string>
POSTGRES_PASSWORD=<secure password>
# Telegram (for alerts)
TELEGRAM_BOT_TOKEN=<your bot token>
TELEGRAM_CHAT_ID=<your chat id>
# Game settings
OUR_TEAM_ID=<your team number>
SCOREBOARD_WS_URL=ws://<scoreboard-ip>:8080/api/events
```
### 3. Start Infrastructure
```bash
docker-compose up -d
```
Wait for all services to start (about 30 seconds).
### 4. Access Dashboard
Open your browser to: http://localhost:8000
Default login password: `admin123` (change in .env: `WEB_PASSWORD`)
### 5. Setup A/D Services
```bash
cd setuper
chmod +x setup.sh
./setup.sh
```
Follow the prompts to install:
- Packmate (traffic analysis)
- moded_distructive_farm (attack farm)
- Firegex (flag checker)
## First Steps in Dashboard
1. **Navigate to Services page** - You'll see registered services
2. **Start a service** - Click the green play button
3. **Monitor Attacks page** - Real-time attack feed
4. **Check Alerts page** - Critical alerts and notifications
## Testing
### Test Telegram Bot
```bash
curl -X POST http://localhost:8003/send \
-H "Authorization: Bearer YOUR_SECRET_TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "Test alert from A/D Control"}'
```
### Register a Test Service
```bash
curl -X POST http://localhost:8001/services \
-H "Authorization: Bearer YOUR_SECRET_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "test-service", "path": "/services/test"}'
```
## Common Tasks
### View Logs
```bash
# All services
docker-compose logs -f
# Specific service
docker-compose logs -f web
docker-compose logs -f controller
```
### Restart Services
```bash
docker-compose restart
```
### Stop Everything
```bash
docker-compose down
```
### Update Code
```bash
git pull
docker-compose up -d --build
```
## Troubleshooting
### Can't access dashboard
- Check if containers are running: `docker-compose ps`
- Check web logs: `docker-compose logs web`
- Verify port 8000 is not in use: `netstat -tulpn | grep 8000`
### Database connection errors
- Check PostgreSQL: `docker-compose logs postgres`
- Verify DATABASE_URL format in logs
- Restart: `docker-compose restart postgres`
### Telegram not working
- Verify bot token is correct
- Check chat ID is correct (must be numeric)
- Test bot: `docker-compose logs tg-bot`
## Next Steps
1. Configure your team's specific settings in `.env`
2. Setup your attack/defense services using the setuper script
3. Configure alert thresholds in `.env`:
- `ALERT_THRESHOLD_POINTS=100` (points before alert)
- `ALERT_THRESHOLD_TIME=300` (time window in seconds)
4. Start monitoring the scoreboard and attacks!
## Getting Help
- Check the main README.md for detailed documentation
- Review service logs: `docker-compose logs <service-name>`
- Ensure all environment variables are set correctly in `.env`