Deploy this website folder on another Windows server
Everything required to run api.iraqcore.net-style FastAPI (or any hostname) is inside the website directory: app code, data/serverlist.json, manifest template, static docs, admin UI, SSL scripts, nginx sample.
1. Copy the folder
Copy the entire website folder to the new machine (e.g. C:\iraqcore-website). Paths with spaces work; a junction is fine.
2. Install Python 3.10+
Install 64-bit Python and ensure py or python works in PowerShell.
3. Install dependencies
cd C:\path\to\website
py -3 -m pip install -r requirements.txt
4. Environment variables (admin + sessions)
Copy config.example.env values into the system environment or a .env file loaded by your process manager. Default admin login is admin / admin123 if you do not set a password. For production, set:
ADMIN_USERNAME— defaultadminADMIN_PASSWORD— optional override (recommended: strong unique password)SESSION_SECRET— long random string (signs session cookies)
Example (PowerShell for current session):
$env:ADMIN_USERNAME = "admin"
$env:ADMIN_PASSWORD = "your-secure-password"
$env:SESSION_SECRET = "your-long-random-secret"
5. Run locally (HTTP, port 8000)
cd C:\path\to\website
$env:PYTHONPATH = "."
$env:SESSION_SECRET = "..."
py -3 -m uvicorn app.main:app --host 127.0.0.1 --port 8000
Open http://127.0.0.1:8000/admin, sign in, manage servers. API: http://127.0.0.1:8000/sapi/public/serverlist
6. Production HTTPS (port 443)
Use start-production.ps1 after Let’s Encrypt certificates exist under C:\Certbot\live\api.iraqcore.net\ (see renew-cert.ps1 and nginx\api.iraqcore.net.conf). Run PowerShell as Administrator so binding to 443 is allowed.
cd C:\path\to\website
.\start-production.ps1
7. Firewall
Allow inbound TCP 443 (and 80 if you use HTTP-01 challenge for Certbot).
8. Scheduled task (optional)
Run start-production.ps1 at boot as SYSTEM or a service account so the API restarts after reboot.
9. Files you must keep
| Path | Purpose |
|---|---|
app/main.py | FastAPI routes (serverlist, manifest, banned) |
app/admin_routes.py | Admin login + CRUD API |
app/serverlist_store.py | Atomic read/write data/serverlist.json |
data/serverlist.json | Live server list (edited via Admin or by hand) |
data/manifest_template.json | Manifest shell; Servers.Official filled from serverlist IPs |
admin/login.html, admin/dashboard.html | Admin UI |
requirements.txt | Python deps |
start-production.ps1 | HTTPS uvicorn |
10. Rebuild / restart after code changes
- Stop the running
uvicornprocess (Task Manager orStop-Process). - Pull or copy updated
websitefiles. pip install -r requirements.txtifrequirements.txtchanged.- Start
start-production.ps1or your dev command again.