97a9f3fd9ad39fd4a0d2defcea0a61c3c48a2583
Update Server
Flask-based update server that bots query to check for new versions and send modmail notifications when updates are available.
Features
- API Server (Port 5555) - Bots query this for version information
- Admin GUI (Port 5566) - Web interface to easily manage bot versions
- Simple JSON-based version storage
- Health check endpoint
Setup
Local Development
-
Install dependencies:
pip install -r requirements.txt -
Run the server:
python app.py- API Server: http://localhost:5555
- Admin GUI: http://localhost:5566
Production Deployment
Using Docker
docker build -t update-server .
docker run -p 5555:5555 -p 5566:5566 update-server
Using Docker Compose
From the parent directory:
docker-compose up botupdateserver
This exposes:
- Port 5555 for API calls (public-facing)
- Port 5566 for Admin GUI (should be protected, e.g., behind Authentik)
Production with Nginx (HTTPS)
Configure nginx as a reverse proxy:
# Public API endpoint
server {
listen 443 ssl http2;
server_name updts.slfhstd.uk;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/key.pem;
location / {
proxy_pass http://localhost:5555;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
# Admin GUI with authentication (Authentik, etc.)
server {
listen 443 ssl http2;
server_name updts-admin.slfhstd.uk;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/key.pem;
# Protect with Authentik (or your auth system)
auth_request /auth;
location / {
proxy_pass http://localhost:5566;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Managing Versions
Using the Admin GUI
- Navigate to
http://localhost:5566(or your admin domain for production) - Fill in the bot details:
- Bot Name: The name of the bot (e.g.,
TestPostsBot) - Version: The current version (e.g.,
0.2) - Changelog URL: (Optional) Link to the changelog
- Bot Name: The name of the bot (e.g.,
- Click "Save Version"
- View all current versions in the right panel
- Edit by clicking "Edit" on any bot, or delete with "Delete"
Manual Edit (versions.json)
If preferred, directly edit versions.json:
{
"TestPostsBot": {
"version": "0.2",
"changelog_url": "https://github.com/yourrepo/releases/tag/v0.2"
},
"AnotherBot": {
"version": "1.0",
"changelog_url": "https://github.com/yourrepo/AnotherBot/releases"
}
}
API Endpoints (Port 5555)
Public API
GET /- Server info and available endpointsGET /health- Health checkGET /api/versions- Get all bot versionsGET /api/version/<bot_name>- Get specific bot version
Example:
curl https://updts.slfhstd.uk/api/version/TestPostsBot
Response:
{
"version": "0.2",
"changelog_url": "https://github.com/yourrepo/releases/tag/v0.2"
}
Admin API (Port 5566)
Note: These endpoints should be protected. Secure with Authentik or another authentication method.
Add/Update Version
curl -X POST http://localhost:5566/admin/api/add \
-H "Content-Type: application/json" \
-d '{
"bot_name": "TestPostsBot",
"version": "0.3",
"changelog_url": "https://github.com/yourrepo/releases/tag/v0.3"
}'
Delete Version
curl -X POST http://localhost:5566/admin/api/delete \
-H "Content-Type: application/json" \
-d '{"bot_name": "TestPostsBot"}'
Logs
Update check requests are logged to update_checks.log with timestamps and bot names.
Architecture
- API Server (Port 5555): Public endpoint for bots to check versions
- Admin GUI (Port 5566): Web interface for managing versions
- Single versioning source: Both use the same
versions.jsonfile - No authentication built-in: Use a reverse proxy (Authentik, etc.) for security
Hosting Options
- Heroku - Easy deployment with free tier
- Railway.app - Simple alternative to Heroku
- DigitalOcean/AWS/GCP - Full control, more expensive
- VPS with Nginx - Most control, requires setup
Description
Languages
Python
97.8%
Dockerfile
2.2%