@zabaca/zbc 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +63 -0
- package/package.json +2 -1
- package/templates/apps/inbox/package.json +1 -1
- package/templates/apps/walgit/CONTEXT.md +135 -0
- package/templates/apps/walgit/Dockerfile +40 -18
- package/templates/apps/walgit/README.md +518 -55
- package/templates/apps/walgit/e2e/README.md +100 -6
- package/templates/apps/walgit/e2e/harness.ts +262 -1
- package/templates/apps/walgit/e2e/live.ts +588 -0
- package/templates/apps/walgit/e2e/scenarios.ts +367 -5
- package/templates/apps/walgit/e2e/suite.ts +5 -5
- package/templates/apps/walgit/examples/watch.ts +209 -0
- package/templates/apps/walgit/package.json +12 -3
- package/templates/apps/walgit/registry.json +6 -11
- package/templates/apps/walgit/shared/capabilities.ts +189 -0
- package/templates/apps/walgit/shared/container-env.ts +114 -0
- package/templates/apps/walgit/shared/credentials.ts +81 -0
- package/templates/apps/walgit/shared/events.ts +277 -0
- package/templates/apps/walgit/shared/landing.ts +1241 -0
- package/templates/apps/walgit/shared/llms.ts +463 -0
- package/templates/apps/walgit/shared/outbox.ts +266 -0
- package/templates/apps/walgit/shared/policy.ts +59 -0
- package/templates/apps/walgit/shared/protocol.ts +197 -0
- package/templates/apps/walgit/shared/provenance.ts +154 -0
- package/templates/apps/walgit/shared/ref-cache.ts +181 -0
- package/templates/apps/walgit/shared/telemetry.ts +219 -0
- package/templates/apps/walgit/src/announce-main.ts +37 -0
- package/templates/apps/walgit/src/announce.ts +98 -0
- package/templates/apps/walgit/src/append-only.ts +112 -0
- package/templates/apps/walgit/src/cache.ts +172 -0
- package/templates/apps/walgit/src/cli.ts +493 -0
- package/templates/apps/walgit/src/compact.ts +25 -23
- package/templates/apps/walgit/src/delete-repo.ts +237 -0
- package/templates/apps/walgit/src/expire.ts +248 -0
- package/templates/apps/walgit/src/gc.ts +8 -16
- package/templates/apps/walgit/src/git-backend.ts +29 -0
- package/templates/apps/walgit/src/git.ts +78 -0
- package/templates/apps/walgit/src/hook-main.ts +259 -17
- package/templates/apps/walgit/src/hooks.ts +4 -3
- package/templates/apps/walgit/src/http.ts +237 -45
- package/templates/apps/walgit/src/instructions.ts +240 -0
- package/templates/apps/walgit/src/keys.ts +126 -0
- package/templates/apps/walgit/src/limits.ts +158 -0
- package/templates/apps/walgit/src/materialize.bench.ts +10 -10
- package/templates/apps/walgit/src/materialize.ts +48 -40
- package/templates/apps/walgit/src/mkdir-lock.ts +66 -0
- package/templates/apps/walgit/src/orphans.ts +2 -5
- package/templates/apps/walgit/src/pending.ts +201 -0
- package/templates/apps/walgit/src/push-cert.ts +254 -0
- package/templates/apps/walgit/src/push.ts +233 -46
- package/templates/apps/walgit/src/reconcile.ts +5 -8
- package/templates/apps/walgit/src/repo.ts +22 -77
- package/templates/apps/walgit/src/server.ts +148 -26
- package/templates/apps/walgit/src/signers.ts +577 -0
- package/templates/apps/walgit/src/store-env.ts +5 -4
- package/templates/apps/walgit/src/store.ts +47 -24
- package/templates/apps/walgit/src/usage.ts +404 -0
- package/templates/apps/walgit/src/verify.ts +171 -0
- package/templates/apps/walgit/src/wal-index.ts +189 -11
- package/templates/apps/walgit/tsconfig.json +8 -2
- package/templates/apps/walgit/tsconfig.worker.json +24 -0
- package/templates/apps/walgit/worker/events-do.ts +259 -0
- package/templates/apps/walgit/worker/index.ts +572 -0
- package/templates/apps/walgit/wrangler.jsonc +95 -0
- package/templates/apps/warehouse/package.json +1 -1
- package/templates/infra/modules/cloudflare/index.ts +77 -6
- package/templates/infra/modules/cloudflare-access/index.ts +85 -14
- package/templates/infra/modules/fly/index.ts +150 -10
- package/templates/infra/modules/turso/index.ts +43 -3
- package/templates/infra/package.json +1 -1
- package/templates/apps/walgit/entrypoint.sh +0 -59
- package/templates/apps/walgit/fly.toml +0 -52
- package/templates/apps/walgit/src/ssh-shell.ts +0 -36
- package/templates/apps/walgit/sshd_config +0 -38
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# walgit on Fly. The topology lives here, not in the zbc `fly` module — the
|
|
2
|
-
# module only runs `fly deploy` against this file.
|
|
3
|
-
#
|
|
4
|
-
# The app name is a per-project identity, so an instance in a consumer's
|
|
5
|
-
# environment overrides it with `appName`. This default is what `fly deploy`
|
|
6
|
-
# uses if nothing does.
|
|
7
|
-
app = "walgit"
|
|
8
|
-
primary_region = "sjc"
|
|
9
|
-
|
|
10
|
-
[build]
|
|
11
|
-
|
|
12
|
-
# SSH: RAW TCP PASS-THROUGH. The absence of `handlers` is what makes it raw —
|
|
13
|
-
# adding one would make Fly Proxy try to speak HTTP or TLS to a git client and
|
|
14
|
-
# every connection would fail. Verified against real Fly in the walgit M0 spike
|
|
15
|
-
# (docs/research/walgit-m0-spike/ in the zbc repository).
|
|
16
|
-
#
|
|
17
|
-
# A dedicated IPv4 is REQUIRED for this to be reachable at all: shared IPv4
|
|
18
|
-
# covers ports 80/443 only, and nothing reports the difference. The instance
|
|
19
|
-
# sets `ipv4: "dedicated"`.
|
|
20
|
-
[[services]]
|
|
21
|
-
protocol = "tcp"
|
|
22
|
-
internal_port = 22
|
|
23
|
-
auto_stop_machines = "stop"
|
|
24
|
-
auto_start_machines = true
|
|
25
|
-
min_machines_running = 0
|
|
26
|
-
|
|
27
|
-
[[services.ports]]
|
|
28
|
-
port = 22
|
|
29
|
-
|
|
30
|
-
# smart-HTTP. Same autostop policy, so both front doors wake the same machine;
|
|
31
|
-
# the M0 spike measured a raw-TCP cold start at ~1.35 s, which a git client
|
|
32
|
-
# spends waiting and never notices.
|
|
33
|
-
[[services]]
|
|
34
|
-
protocol = "tcp"
|
|
35
|
-
internal_port = 8080
|
|
36
|
-
auto_stop_machines = "stop"
|
|
37
|
-
auto_start_machines = true
|
|
38
|
-
min_machines_running = 0
|
|
39
|
-
|
|
40
|
-
[[services.ports]]
|
|
41
|
-
port = 80
|
|
42
|
-
handlers = ["http"]
|
|
43
|
-
force_https = true
|
|
44
|
-
|
|
45
|
-
[[services.ports]]
|
|
46
|
-
port = 443
|
|
47
|
-
handlers = ["tls", "http"]
|
|
48
|
-
|
|
49
|
-
# No [[mounts]]. Deliberate: see the Dockerfile — the repo on disk is a cache.
|
|
50
|
-
[[vm]]
|
|
51
|
-
size = "shared-cpu-1x"
|
|
52
|
-
memory = "512mb"
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
/**
|
|
3
|
-
* The SSH forced command.
|
|
4
|
-
*
|
|
5
|
-
* Every authorized key is pinned to this script (`command="..."` in
|
|
6
|
-
* authorized_keys), so an SSH session can do exactly one thing: run one git
|
|
7
|
-
* transport verb against one repository. The client's own command line arrives
|
|
8
|
-
* in SSH_ORIGINAL_COMMAND and is parsed, never executed.
|
|
9
|
-
*
|
|
10
|
-
* git's transport is stdio: upload-pack/receive-pack speak the pack protocol
|
|
11
|
-
* over the same stdin/stdout the SSH channel provides, which is why this
|
|
12
|
-
* process replaces itself with git rather than proxying bytes.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import { spawnSync } from 'node:child_process'
|
|
16
|
-
import { ensureBareRepo, parseSshCommand, resolveRepo } from './repo'
|
|
17
|
-
import { storeFromEnv } from './store-env'
|
|
18
|
-
import { syncRepo } from './sync'
|
|
19
|
-
|
|
20
|
-
const reposDir = process.env.WALGIT_REPOS_DIR ?? '/srv/walgit/repos'
|
|
21
|
-
|
|
22
|
-
try {
|
|
23
|
-
const { service, requested } = parseSshCommand(process.env.SSH_ORIGINAL_COMMAND)
|
|
24
|
-
const repo = ensureBareRepo(resolveRepo(reposDir, requested))
|
|
25
|
-
// Before a byte of the pack protocol is exchanged: an upload-pack that
|
|
26
|
-
// advertises stale refs sends the client a repository that no longer exists,
|
|
27
|
-
// and a receive-pack negotiating against them computes its ref updates from
|
|
28
|
-
// a state the log has already moved past.
|
|
29
|
-
await syncRepo(storeFromEnv(), repo)
|
|
30
|
-
const res = spawnSync(service, [repo.dir], { stdio: 'inherit' })
|
|
31
|
-
process.exit(res.status ?? 1)
|
|
32
|
-
} catch (err) {
|
|
33
|
-
// Goes back over the SSH channel to the client, which prints it verbatim.
|
|
34
|
-
process.stderr.write(`walgit: ${(err as Error).message}\n`)
|
|
35
|
-
process.exit(1)
|
|
36
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# walgit sshd. Everything here narrows what a session can be: the forced command
|
|
2
|
-
# on each authorized key is the real gate, and this file removes every other way
|
|
3
|
-
# in.
|
|
4
|
-
|
|
5
|
-
Port 22
|
|
6
|
-
AddressFamily any
|
|
7
|
-
HostKey /etc/ssh/ssh_host_ed25519_key
|
|
8
|
-
|
|
9
|
-
# Only the `git` account, only by public key.
|
|
10
|
-
AllowUsers git
|
|
11
|
-
PermitRootLogin no
|
|
12
|
-
PasswordAuthentication no
|
|
13
|
-
KbdInteractiveAuthentication no
|
|
14
|
-
ChallengeResponseAuthentication no
|
|
15
|
-
PubkeyAuthentication yes
|
|
16
|
-
AuthorizedKeysFile /srv/walgit/.ssh/authorized_keys
|
|
17
|
-
|
|
18
|
-
# git speaks over the session channel and needs nothing else. A forwarded port
|
|
19
|
-
# would turn a repo credential into network access to the machine.
|
|
20
|
-
AllowTcpForwarding no
|
|
21
|
-
AllowAgentForwarding no
|
|
22
|
-
X11Forwarding no
|
|
23
|
-
PermitTunnel no
|
|
24
|
-
PermitTTY no
|
|
25
|
-
|
|
26
|
-
# Fly Proxy holds the client connection; sshd sees only the proxy, so keepalives
|
|
27
|
-
# here are what notice a client that vanished mid-fetch.
|
|
28
|
-
ClientAliveInterval 60
|
|
29
|
-
ClientAliveCountMax 3
|
|
30
|
-
|
|
31
|
-
# Machines stop when idle and start on a raw TCP connection, so an unauthenticated
|
|
32
|
-
# connection is a real cost, not just a socket. Keep the window short.
|
|
33
|
-
LoginGraceTime 20
|
|
34
|
-
MaxStartups 20:30:60
|
|
35
|
-
|
|
36
|
-
# stderr, so Fly captures it in the machine log rather than a file on a disk
|
|
37
|
-
# that disappears.
|
|
38
|
-
LogLevel INFO
|