Monorepo for Aesthetic.Computer
aesthetic.computer
1#!/usr/bin/env fish
2# DNS Cutover — Update all Netlify-pointing records to the new lith droplet IP
3#
4# Usage: fish scripts/dns-cutover.fish <NEW_IP>
5#
6# This updates 36 DNS records across 8 Cloudflare zones.
7# Records are changed from aesthetic-computer.netlify.app / 75.2.60.5 → NEW_IP
8
9set RED '\033[0;31m'
10set GREEN '\033[0;32m'
11set YELLOW '\033[1;33m'
12set NC '\033[0m'
13
14if test (count $argv) -lt 1
15 echo "Usage: fish scripts/dns-cutover.fish <NEW_IP>"
16 exit 1
17end
18
19set NEW_IP $argv[1]
20
21# Load Cloudflare credentials
22set SCRIPT_DIR (dirname (status --current-filename))
23set VAULT_DIR "$SCRIPT_DIR/../../aesthetic-computer-vault"
24
25if test -f "$VAULT_DIR/cloudflare.env"
26 for line in (cat "$VAULT_DIR/cloudflare.env" | grep -v '^#' | grep -v '^$' | grep '=')
27 set -l parts (string split '=' $line)
28 if test (count $parts) -ge 2
29 set -gx $parts[1] (string join '=' $parts[2..-1])
30 end
31 end
32else
33 # Fallback to feed.env
34 set FEED_ENV "$SCRIPT_DIR/../../.devcontainer/envs/feed.env"
35 if test -f $FEED_ENV
36 set -gx CF_EMAIL (grep CLOUDFLARE_EMAIL $FEED_ENV | head -1 | cut -d= -f2 | tr -d '"')
37 set -gx CF_KEY (grep CLOUDFLARE_API_KEY $FEED_ENV | head -1 | cut -d= -f2 | tr -d '"')
38 end
39end
40
41if test -z "$CF_EMAIL" -o -z "$CF_KEY"
42 echo -e "$RED x Cloudflare credentials not found$NC"
43 exit 1
44end
45
46function cf_headers
47 echo -H "X-Auth-Email: $CF_EMAIL" -H "X-Auth-Key: $CF_KEY" -H "Content-Type: application/json"
48end
49
50# Helper: update or create an A record
51function update_a_record -a zone_id name
52 echo -e "$GREEN -> $name → $NEW_IP$NC"
53
54 # Find existing record
55 set record_id (curl -s "https://api.cloudflare.com/client/v4/zones/$zone_id/dns_records?type=A&name=$name" \
56 -H "X-Auth-Email: $CF_EMAIL" -H "X-Auth-Key: $CF_KEY" \
57 | python3 -c "import json,sys; r=json.load(sys.stdin)['result']; print(r[0]['id'] if r else '')")
58
59 if test -n "$record_id"
60 # Update existing A record
61 curl -s -X PATCH "https://api.cloudflare.com/client/v4/zones/$zone_id/dns_records/$record_id" \
62 -H "X-Auth-Email: $CF_EMAIL" -H "X-Auth-Key: $CF_KEY" -H "Content-Type: application/json" \
63 --data "{\"type\":\"A\",\"content\":\"$NEW_IP\",\"proxied\":true}" | python3 -c "import json,sys; print(' OK' if json.load(sys.stdin)['success'] else ' FAIL')"
64 else
65 # Check for CNAME and delete it first
66 set cname_id (curl -s "https://api.cloudflare.com/client/v4/zones/$zone_id/dns_records?type=CNAME&name=$name" \
67 -H "X-Auth-Email: $CF_EMAIL" -H "X-Auth-Key: $CF_KEY" \
68 | python3 -c "import json,sys; r=json.load(sys.stdin)['result']; print(r[0]['id'] if r else '')")
69
70 if test -n "$cname_id"
71 curl -s -X DELETE "https://api.cloudflare.com/client/v4/zones/$zone_id/dns_records/$cname_id" \
72 -H "X-Auth-Email: $CF_EMAIL" -H "X-Auth-Key: $CF_KEY" > /dev/null
73 end
74
75 # Create new A record
76 curl -s -X POST "https://api.cloudflare.com/client/v4/zones/$zone_id/dns_records" \
77 -H "X-Auth-Email: $CF_EMAIL" -H "X-Auth-Key: $CF_KEY" -H "Content-Type: application/json" \
78 --data "{\"type\":\"A\",\"name\":\"$name\",\"content\":\"$NEW_IP\",\"proxied\":true}" | python3 -c "import json,sys; print(' OK' if json.load(sys.stdin)['success'] else ' FAIL')"
79 end
80end
81
82echo -e "$YELLOW=== DNS Cutover: 36 records → $NEW_IP ===$NC"
83echo ""
84
85# --- aesthetic.computer (da794a6ae8f17b80424907f81ed0db7c) ---
86set Z da794a6ae8f17b80424907f81ed0db7c
87echo -e "$YELLOW[aesthetic.computer]$NC"
88update_a_record $Z "aesthetic.computer"
89update_a_record $Z "api.aesthetic.computer"
90update_a_record $Z "bills.aesthetic.computer"
91update_a_record $Z "give.aesthetic.computer"
92update_a_record $Z "keeps.aesthetic.computer"
93update_a_record $Z "l5.aesthetic.computer"
94update_a_record $Z "news.aesthetic.computer"
95update_a_record $Z "p5.aesthetic.computer"
96update_a_record $Z "pals.aesthetic.computer"
97update_a_record $Z "papers.aesthetic.computer"
98update_a_record $Z "processing.aesthetic.computer"
99update_a_record $Z "sitemap.aesthetic.computer"
100update_a_record $Z "www.aesthetic.computer"
101
102# --- false.work (0fa28e0097b24e187f41fea0ec036c0d) ---
103set Z 0fa28e0097b24e187f41fea0ec036c0d
104echo -e "$YELLOW[false.work]$NC"
105update_a_record $Z "builds.false.work"
106
107# --- jas.life (79e214366285134e1fc7952db8aff75e) ---
108set Z 79e214366285134e1fc7952db8aff75e
109echo -e "$YELLOW[jas.life]$NC"
110update_a_record $Z "jas.life"
111
112# --- justanothersystem.org (a3366b124c7ca95fe902a54f868dcc51) ---
113set Z a3366b124c7ca95fe902a54f868dcc51
114echo -e "$YELLOW[justanothersystem.org]$NC"
115update_a_record $Z "justanothersystem.org"
116update_a_record $Z "www.justanothersystem.org"
117
118# --- kidlisp.com (bac7b811ac7b4df664b696fafa9e6207) ---
119set Z bac7b811ac7b4df664b696fafa9e6207
120echo -e "$YELLOW[kidlisp.com]$NC"
121update_a_record $Z "kidlisp.com"
122update_a_record $Z "www.kidlisp.com"
123update_a_record $Z "buy.kidlisp.com"
124update_a_record $Z "calm.kidlisp.com"
125update_a_record $Z "device.kidlisp.com"
126update_a_record $Z "keep.kidlisp.com"
127update_a_record $Z "keeps.kidlisp.com"
128update_a_record $Z "learn.kidlisp.com"
129update_a_record $Z "pj.kidlisp.com"
130update_a_record $Z "top.kidlisp.com"
131
132# --- notepat.com (8d289a1e56563dbcc9bc88747428c8ee) ---
133set Z 8d289a1e56563dbcc9bc88747428c8ee
134echo -e "$YELLOW[notepat.com]$NC"
135update_a_record $Z "notepat.com"
136update_a_record $Z "www.notepat.com"
137
138# --- prompt.ac (1f93ca86e2d9de0def0acb0b8c4e722b) ---
139set Z 1f93ca86e2d9de0def0acb0b8c4e722b
140echo -e "$YELLOW[prompt.ac]$NC"
141update_a_record $Z "prompt.ac"
142update_a_record $Z "api.prompt.ac"
143update_a_record $Z "l5.prompt.ac"
144update_a_record $Z "p5.prompt.ac"
145update_a_record $Z "papers.prompt.ac"
146update_a_record $Z "processing.prompt.ac"
147update_a_record $Z "sitemap.prompt.ac"
148
149# --- sotce.net (1f56f8b5fd7b3db92d31bad0714a518f) ---
150set Z 1f56f8b5fd7b3db92d31bad0714a518f
151echo -e "$YELLOW[sotce.net]$NC"
152update_a_record $Z "sotce.net"
153update_a_record $Z "www.sotce.net"
154
155echo ""
156echo -e "$GREEN=== Done. 36 records updated. ===$NC"
157echo -e "$YELLOW Cloudflare propagation: ~30 seconds (proxied) or ~5 minutes (DNS-only)$NC"