# Response: Subdomain Seed Data for server_config

**Date:** 2026-04-14
**Filed by:** Chronicler #87
**Re:** Subdomain field additions to server_config table and seed data

---

## New Field to Add to server_config

```sql
ALTER TABLE server_config ADD COLUMN IF NOT EXISTS subdomain VARCHAR(64) UNIQUE;
```

---

## Full Seed Data — Subdomains

Add `subdomain` to the existing seed script. Use `ON CONFLICT DO UPDATE` pattern already in place.

| server_identifier (short) | Pterodactyl Name | subdomain | IP | Port | DNS exists? |
|---------------------------|-----------------|-----------|-----|------|-------------|
| a0efbfe8 | Stoneblock 4 | stoneblock4 | 38.68.14.26 | 25565 | ✅ |
| 9310d0a6 | Society: Sunlit Valley | society | 38.68.14.28 | 25565 | ✅ |
| f408e832 | All the Mods 10: To the Sky | atm10tts | 216.239.104.130 | 25565 | ✅ |
| c4bc5892 | All the Mons | atmons | 216.239.104.130 | 25566 | ✅ |
| b90ced3c | Mythcraft 5 | mythcraft5 | 216.239.104.130 | 25567 | ✅ |
| e1c6ff8d | All of Create (Creative) | aocc | 216.239.104.130 | 25568 | ✅ |
| 82e63949 | All The Mods 10 | atm10 | 216.239.104.130 | 25569 | ✅ |
| d4790f45 | Otherworld [Dungeons & Dragons] | otherworld | 216.239.104.130 | 25570 | ✅ |
| 8950fa1e | DeceasedCraft | deceasedcraft | 216.239.104.130 | 25571 | ❌ needs provisioning |
| 7c9c2dc0 | Sneak's Pirate Pack | sneakspiratpack | 216.239.104.130 | 25572 | ❌ needs provisioning |
| f5befeab | Homestead - A Cozy Survival Experience | homestead | 216.239.104.130 | 25574 | ✅ (SRV fixed by Chronicler #87) |
| 25b23f6e | Farm Crossing 6 | farmcrossing6 | 216.239.104.130 | 25573 | ❌ needs provisioning |
| e95ed4a8 | Beyond Depth | beyonddepth | 38.68.14.26 | 25568 | ✅ |
| 3f842757 | Beyond Ascension | beyondascension | 38.68.14.26 | 25569 | ✅ |
| fcbe0a1d | Wold's Vaults | vaults | 38.68.14.26 | 25570 | ✅ |
| 576342b8 | Submerged 2 | submerged2 | 38.68.14.26 | 25571 | ✅ |
| 7a9754ad | Cottage Witch | cottagewitch | 38.68.14.26 | 25572 | ✅ |
| 668a5220 | All The Mons (Private) - TX | allthemons | 38.68.14.30 | 25565 | ✅ |

**NOT included (no subdomain needed):**
- FoundryVTT — different service (port 30000)
- Hytale — different service (port 5520)
- Vanilla — internal only
- Create Plus Video Sandbox — internal only

---

## Cloudflare Integration for Provision Subdomain Button

**Zone ID:** `7604c173d802f154035f7e998018c1a9`
**API Token:** Already in `.env` as `CLOUDFLARE_API_TOKEN`

When **Provision Subdomain** is clicked on the card, Arbiter calls:

### 1. Create A Record
```
POST /client/v4/zones/{zone_id}/dns_records
{
  "type": "A",
  "name": "{subdomain}.firefrostgaming.com",
  "content": "{server_ip}",
  "ttl": 1,
  "proxied": false
}
```

### 2. Create SRV Record
```
POST /client/v4/zones/{zone_id}/dns_records
{
  "type": "SRV",
  "name": "_minecraft._tcp.{subdomain}.firefrostgaming.com",
  "data": {
    "priority": 0,
    "weight": 0,
    "port": {server_port},
    "target": "{subdomain}.firefrostgaming.com"
  },
  "ttl": 1
}
```

### 3. Save to server_config
After successful Cloudflare calls, update `server_config` with the subdomain.

---

## Card Display Logic

```
If subdomain exists:
  🌐 {subdomain}.firefrostgaming.com  ✅
      {ip}:{port}

If no subdomain:
  🌐 No subdomain assigned
      {ip}:{port}
      [+ Provision Subdomain]
```

Provision Subdomain button opens inline input for the subdomain prefix,
then fires POST `/:identifier/provision-subdomain` with `{ subdomain: 'farmcrossing6' }`.

---

## Notes
- Subdomain naming convention: no hyphens, no dots, lowercase only (matches existing pattern)
- Cloudflare API base: `https://api.cloudflare.com/client/v4`
- All records proxied: false (Minecraft needs direct TCP connection, can't go through Cloudflare proxy)
- SRV record fix: Homestead was pointing to port 25572 — already corrected to 25574 by Chronicler #87

---

*Filed by Chronicler #87 — April 14, 2026*
