Skip to content

Commit 175268b

Browse files
authored
Merge pull request #49 from stackql/feature/updates
updated `get-app`
2 parents f1a87d7 + 53423fa commit 175268b

13 files changed

Lines changed: 2213 additions & 79 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ stackql_history.txt
88
stackql.log
99
stackql-zip
1010
stackql-deploy
11+
stackql-deploy.exe
1112
.stackql-deploy-exports
1213
.env
1314
nohup.out

get-app/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
.wrangler/
3+
.dev.vars

get-app/README.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# get-stackql-deploy.io
2+
3+
Cloudflare Worker that backs `https://get-stackql-deploy.io`. It detects the
4+
calling platform and points the caller at the correct `stackql-deploy` release
5+
asset on GitHub.
6+
7+
Behaviour (unchanged from the previous Deno Deploy app):
8+
9+
- `GET /` - reads the `User-Agent` and `302`-redirects to the matching release
10+
asset (`windows-x86_64.zip`, `macos-universal.tar.gz`, or
11+
`linux-x86_64.tar.gz`). Keeps the
12+
`curl -L https://get-stackql-deploy.io | tar xzf -` one-liner working.
13+
- `GET /install` - universal installer. Detects the calling shell from the
14+
User-Agent and serves the matching script: the POSIX `sh` installer for
15+
curl/wget, or the PowerShell installer for `irm`/`iwr`. Use it as
16+
`curl -fsSL https://get-stackql-deploy.io/install | sh` (Linux/macOS) or
17+
`irm https://get-stackql-deploy.io/install | iex` (Windows).
18+
- `GET /install.sh` - always the POSIX `sh` installer. Runs `uname` client-side
19+
to pick the right OS + arch asset.
20+
- `GET /install.ps1` - always the PowerShell installer. Downloads and expands the
21+
Windows zip into the current directory.
22+
- Any other path - `301`-redirects to `https://stackql-deploy.io`.
23+
24+
### Wrong-shell guards
25+
26+
The installers give friendly guidance instead of cryptic interpreter errors when
27+
run in the wrong shell:
28+
29+
- Fetch `/install.sh` with PowerShell -> served a short PowerShell message
30+
pointing at `irm .../install.ps1 | iex`.
31+
- Fetch `/install.ps1` with curl/wget -> served a short `sh` message pointing at
32+
`curl -fsSL .../install.sh | sh`.
33+
- `install.sh` run in a POSIX shell on Windows (Git Bash/MSYS - `uname` reports
34+
`MINGW*`/`MSYS*`/`CYGWIN*`) -> message pointing at the PowerShell command.
35+
- `install.ps1` run under PowerShell on macOS/Linux (`$PSVersionTable.Platform`
36+
is `Unix`) -> message pointing at the `sh` command.
37+
- Unsupported CPU architectures get a "no prebuilt binary for your CPU" message
38+
with a link to the releases page, not "unsupported".
39+
40+
## Develop
41+
42+
```sh
43+
npm install
44+
npm run dev # wrangler dev - serves on http://localhost:8787
45+
```
46+
47+
Test locally:
48+
49+
```sh
50+
curl -A "curl/8.4.0" http://localhost:8787/install # -> sh installer
51+
curl -A "WindowsPowerShell/5.1" http://localhost:8787/install # -> PowerShell installer
52+
curl -A "WindowsPowerShell/5.1" http://localhost:8787/install.sh # -> "use install.ps1" guide
53+
curl -A "curl/8.4.0" http://localhost:8787/install.ps1 # -> "use install.sh" guide
54+
curl -sI -A "Mozilla/5.0 (Macintosh)" http://localhost:8787/ # -> 302 to macos asset
55+
curl -sI -A "curl/8.4.0" http://localhost:8787/ # -> 302 to linux asset
56+
```
57+
58+
## Deploy
59+
60+
One-time auth (uses your Cloudflare login):
61+
62+
```sh
63+
npx wrangler login
64+
```
65+
66+
Deploy:
67+
68+
```sh
69+
npm run deploy # wrangler deploy
70+
```
71+
72+
`wrangler.toml` uses a `custom_domain` route for `get-stackql-deploy.io`. On the
73+
first deploy Wrangler creates and manages the proxied DNS record for the apex
74+
automatically - no manual DNS entry required. The `get-stackql-deploy.io` zone
75+
must already exist in the target Cloudflare account.
76+
77+
Tail live logs:
78+
79+
```sh
80+
npm run tail
81+
```
82+
83+
## Cutover from Deno Deploy
84+
85+
The zone is already on Cloudflare, so cutover is just pointing the apex at the
86+
Worker instead of Deno Deploy.
87+
88+
1. Authenticate and deploy the Worker:
89+
90+
```sh
91+
npm install
92+
npx wrangler login
93+
npm run deploy
94+
```
95+
96+
Confirm the build output reports the route
97+
`get-stackql-deploy.io (custom domain)`.
98+
99+
2. Resolve the apex DNS conflict. On the first deploy the Worker script uploads
100+
fine but the custom-domain trigger fails with a `409 Conflict` on
101+
`.../domains/records` and the output reads `No targets deployed` - because the
102+
apex still holds the old Deno Deploy record. To clear it:
103+
- Cloudflare dashboard -> `get-stackql-deploy.io` zone -> DNS -> Records.
104+
- Delete the old Deno record on the apex (name `get-stackql-deploy.io` / `@`) -
105+
a `CNAME` to `<project>.deno.dev`, or `A`/`AAAA` records. Note it first if you
106+
want a rollback path.
107+
- Re-run `npm run deploy`. Wrangler now creates its own managed proxied record
108+
and attaches the custom domain; the output should report
109+
`get-stackql-deploy.io (custom domain)`.
110+
111+
Deleting the apex record briefly takes the hostname offline until the redeploy
112+
attaches the Worker (seconds on Cloudflare). To avoid any gap, instead use
113+
Workers & Pages -> get-stackql-deploy -> Settings -> Domains & Routes -> Add ->
114+
Custom Domain -> `get-stackql-deploy.io`, which prompts to override the existing
115+
record in a single step.
116+
117+
3. Verify the live site once DNS propagates (usually seconds on Cloudflare):
118+
119+
```sh
120+
curl -sI -A "curl/8.4.0" https://get-stackql-deploy.io/ | grep -i location
121+
curl -fsSL https://get-stackql-deploy.io/install.sh | head -5
122+
curl -L https://get-stackql-deploy.io | tar tzf - | head # full one-liner
123+
```
124+
125+
Confirm responses are served by Cloudflare (response header
126+
`server: cloudflare`) and not Deno Deploy.
127+
128+
4. Decommission the Deno Deploy project once verified: delete or pause it in the
129+
Deno Deploy dashboard so it no longer bills or risks serving stale content.
130+
The previous Deno source lives in git history if you ever need it.
131+
132+
No consumers need changing - `get-stackql-deploy.io`, `/install.sh`, and the
133+
`curl | tar` one-liner all keep the same URLs and behaviour.

get-app/deno.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

get-app/main.ts

Lines changed: 0 additions & 74 deletions
This file was deleted.

0 commit comments

Comments
 (0)