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:

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

PathPurpose
app/main.pyFastAPI routes (serverlist, manifest, banned)
app/admin_routes.pyAdmin login + CRUD API
app/serverlist_store.pyAtomic read/write data/serverlist.json
data/serverlist.jsonLive server list (edited via Admin or by hand)
data/manifest_template.jsonManifest shell; Servers.Official filled from serverlist IPs
admin/login.html, admin/dashboard.htmlAdmin UI
requirements.txtPython deps
start-production.ps1HTTPS uvicorn

10. Rebuild / restart after code changes

  1. Stop the running uvicorn process (Task Manager or Stop-Process).
  2. Pull or copy updated website files.
  3. pip install -r requirements.txt if requirements.txt changed.
  4. Start start-production.ps1 or your dev command again.