@flisk-sh/flisk 1.4.6 → 1.4.7
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/README.md +2 -2
- package/cli/dist/agent-runtimes/custom.js +94 -13
- package/cli/dist/commands/agent.js +144 -123
- package/cli/dist/commands/doctor.js +12 -0
- package/cli/dist/commands/logs.js +71 -4
- package/cli/dist/commands/project.js +16 -0
- package/cli/dist/commands/resource.js +3 -1
- package/cli/dist/commands/status.js +43 -24
- package/cli/dist/commands/ui.js +41 -2
- package/cli/dist/commands/up.js +54 -11
- package/cli/dist/components/DetailPanel.js +23 -3
- package/cli/dist/mcp/tools.js +9 -6
- package/cli/dist/types/index.js +0 -2
- package/cli/dist/utils/agent-format.js +18 -0
- package/cli/dist/utils/agent-sessions.js +122 -0
- package/cli/dist/utils/agent-skills.js +64 -0
- package/cli/dist/utils/cold-preflight.js +3 -0
- package/cli/dist/utils/doctor-fix-first.js +93 -0
- package/cli/dist/utils/doctor-report.js +3 -0
- package/cli/dist/utils/native-runtime.js +3 -0
- package/cli/dist/utils/native-service.js +2 -2
- package/cli/dist/utils/service-manifest.js +8 -15
- package/cli/dist/utils/services.js +7 -10
- package/cli/dist/utils/startup-report.js +45 -3
- package/cli/dist/utils/status-groups.js +23 -0
- package/cli/dist/utils/up-hints.js +42 -0
- package/cli/dist/utils/up-progress.js +117 -0
- package/cli/dist/utils/up-readiness.js +5 -0
- package/cli/dist-bundle/{chunk-U5FCQF42.js → chunk-6OW2GVQV.js} +1 -1
- package/cli/dist-bundle/chunk-B2JOM3HN.js +35 -0
- package/cli/dist-bundle/{chunk-R7DWXISM.js → chunk-F2DLIM75.js} +1 -1
- package/cli/dist-bundle/{chunk-ETXZ5LUG.js → chunk-L6O7TT3K.js} +10 -10
- package/cli/dist-bundle/chunk-MFY7RZ76.js +130 -0
- package/cli/dist-bundle/{chunk-MUDE4DZD.js → chunk-MYAYJF4Q.js} +1 -1
- package/cli/dist-bundle/{chunk-DPQK5TIS.js → chunk-P7GZ6NGM.js} +1 -1
- package/cli/dist-bundle/{chunk-IDNES5PE.js → chunk-T44DEEL6.js} +1 -1
- package/cli/dist-bundle/{chunk-C4UFBXRD.js → chunk-TIPSERWO.js} +1 -1
- package/cli/dist-bundle/{chunk-BIVAAWBX.js → chunk-VYPB7MY5.js} +1 -1
- package/cli/dist-bundle/{chunk-WCGBVETR.js → chunk-XHENT4KO.js} +1 -1
- package/cli/dist-bundle/{chunk-CAEMWNPF.js → chunk-YTBTCAWY.js} +1 -1
- package/cli/dist-bundle/cli.js +462 -377
- package/cli/dist-bundle/{cold-preflight-KUWOL2Q2.js → cold-preflight-DQVJUGBB.js} +1 -1
- package/cli/dist-bundle/{demo-stage-QCC4IWXR.js → demo-stage-F4YA7UL2.js} +1 -1
- package/cli/dist-bundle/{open-AZNX4AC5.js → open-ZUSSVPD3.js} +1 -1
- package/cli/dist-bundle/project-JFCTPRP5.js +2 -0
- package/cli/dist-bundle/{services-EY5WKPHQ.js → services-DOHDHOCT.js} +1 -1
- package/cli/dist-bundle/{tilt-port-owner-UBU6JWOA.js → tilt-port-owner-XODQHXHX.js} +1 -1
- package/cli/package.json +1 -1
- package/cli/templates/agent-skills/flisk-agent-ops/SKILL.md +39 -0
- package/cli/templates/agent-skills/flisk-build/SKILL.md +85 -0
- package/cli/templates/agent-skills/flisk-doctor/SKILL.md +28 -0
- package/cli/templates/agent-skills/flisk-recipe-ai-agent/SKILL.md +45 -0
- package/cli/templates/agent-skills/flisk-recipe-blog/SKILL.md +36 -0
- package/cli/templates/agent-skills/flisk-recipe-saas/SKILL.md +39 -0
- package/cli/templates/agent-skills/flisk-recipe-shop/SKILL.md +41 -0
- package/cli/templates/agent-skills/flisk-recipe-starters/SKILL.md +46 -0
- package/cli/templates/agent-skills/flisk-resource/SKILL.md +27 -0
- package/cli/templates/agent-skills/flisk-status/SKILL.md +25 -0
- package/cli/templates/agent-skills/flisk-troubleshoot/SKILL.md +227 -0
- package/cli/templates/agent-skills/flisk-up/SKILL.md +37 -0
- package/package.json +1 -1
- package/runtime/engine/schemas/service-schema.json +3 -15
- package/runtime/engine/topologies/tilt/resources/orchestrator/apply_compose_resource_registration.star +7 -1
- package/cli/dist-bundle/chunk-CDKEHFW6.js +0 -35
- package/cli/dist-bundle/chunk-GT76VMUL.js +0 -130
- package/cli/dist-bundle/project-5SWIGCNP.js +0 -2
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: flisk-troubleshoot
|
|
3
|
+
description: Diagnose and fix Flisk local-dev problems with verified commands. Covers `flisk doctor`, `flisk up` or `flisk down` failing or hanging, "Docker daemon is not responding", red Tilt resources (pull access denied for golden images, missing shared-platform-engineering files, TS2688 bun types, run-only "No such image"), Postgres crash loops, services never reaching healthy, a machine overloaded by many services, Docker image size vs memory questions, and benchmarking how many services fit on a machine. Use this whenever someone works in flisk or a Flisk project (flisk-erp-system, flisk-saas-starter, flisk-restaurant-example, auth-user) and anything about flisk, Tilt, or Docker is broken, slow, or being measured, even if they never say "troubleshoot".
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Requires the flisk CLI, Docker and Tilt on the local machine. Does not deploy.
|
|
6
|
+
metadata:
|
|
7
|
+
author: flisk-sh
|
|
8
|
+
version: "1.0"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Flisk troubleshooting
|
|
12
|
+
|
|
13
|
+
This skill comes from a long session on 2026-09-25. It brought `flisk-erp-system` (107 services) up, measured it, and wasted a lot of the user's time along the way. Everything below marked **measured** or **verified** was run on the user's 16 GB MacBook Air (Docker VM: 8 CPUs, 7,934 MiB). Anything else is labelled as unknown.
|
|
14
|
+
|
|
15
|
+
## How to work (the expensive lessons)
|
|
16
|
+
|
|
17
|
+
- **Say what you measured, what you estimated, and what you don't know, in that order.** Most of the frustration came from confident claims that a later measurement contradicted, such as "memory is ~16 MiB/container" (`docker stats`, which undercounts) and "112 s boot" (actually the launcher script). "I don't know yet, here is how I'd find out" is a good answer.
|
|
18
|
+
- **Check machine load before blaming Docker, Tilt or the code.** An overloaded Mac makes every tool look broken.
|
|
19
|
+
- **Before anything that runs longer than about 5 minutes or starts dozens of containers, say so and give an estimate.** A full ERP `flisk up` froze this machine once. Ask first.
|
|
20
|
+
- **Give short status lines while waiting.** Silence during long builds reads as "nothing works".
|
|
21
|
+
- **Don't polish a proxy metric.** Shrinking images didn't touch the real bottleneck. Ask what actually hurts (time, CPU, a freeze) and measure that.
|
|
22
|
+
|
|
23
|
+
## First 60 seconds: triage
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
sysctl -n vm.loadavg; top -l 1 -n 0 | grep -E "CPU usage|PhysMem"
|
|
27
|
+
time docker ps -q | wc -l
|
|
28
|
+
pgrep -fl "tilt up"
|
|
29
|
+
docker info --format 'CPUs={{.NCPU}} MemTotal={{.MemTotal}}'
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- **`docker ps` taking more than about 5 s means overload, not breakage.** Measured: 6–13 s with 110 ERP containers plus Tilt running, load average 28–43, 99 MB free RAM. `flisk doctor` and `flisk down` both fail their own 10 s Docker check in that state.
|
|
33
|
+
- **A `tilt up` process still running recreates any container you `docker stop`** within seconds. Stop Tilt first.
|
|
34
|
+
- **Other Flisk projects share the `*-autogenerated-*` container naming** (for example kitchen, guest, operations and auth from the restaurant and auth projects). Filter by stack name before stopping anything.
|
|
35
|
+
|
|
36
|
+
## Symptoms, causes and fixes (verified)
|
|
37
|
+
|
|
38
|
+
### "Docker daemon is not responding (`docker ps` hung for 10s)"
|
|
39
|
+
|
|
40
|
+
**Cause:** overload, as above. `flisk down` is blocked by the same check.
|
|
41
|
+
|
|
42
|
+
**Fix:** stop Tilt, then stop the project's containers directly.
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pkill -TERM -f "tilt up -f $PWD/.flisk/.flisk-out/Tiltfile"
|
|
46
|
+
docker ps --format '{{.Names}}' | grep -E '^(finance|hr|sales|inventory|manufacturing|supply_chain|analytics)-autogenerated-' | xargs docker stop
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Postgres restarting with "Database is uninitialized and superuser password is not specified"
|
|
50
|
+
|
|
51
|
+
**Cause:** the container was created while `DB_PASSWORD` was empty. Environment variables are fixed when a container is created, so fixing `.env` later doesn't help.
|
|
52
|
+
|
|
53
|
+
**Check:**
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
docker inspect <project>_postgres --format '{{range .Config.Env}}{{println .}}{{end}}' | grep POSTGRES_PASSWORD
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Fix:** recreate the container (Tilt or compose `up` recreates it). The data volume survives.
|
|
60
|
+
|
|
61
|
+
### Tilt build error `pull access denied ... docker.io/library/<project>-l4-backend:latest`
|
|
62
|
+
|
|
63
|
+
**Cause:** the golden layers aren't built yet (the `golden-layers-build` resource is still running).
|
|
64
|
+
|
|
65
|
+
**Fix:** wait for it to finish. Tilt does **not** retry resources that failed before it finished, so trigger every errored resource yourself.
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
tilt get uiresources -o json | python3 -c 'import json,sys; [print(i["metadata"]["name"]) for i in json.load(sys.stdin)["items"] if i.get("status",{}).get("updateStatus")=="error"]' | xargs -n1 tilt trigger
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### `*-run-only` resources fail with `No such image: <stack>_<svc>:dev`
|
|
72
|
+
|
|
73
|
+
**Cause:** they ran `docker compose up --no-build` before the image existed.
|
|
74
|
+
|
|
75
|
+
**Fix:** once the image builds, `tilt trigger` them.
|
|
76
|
+
|
|
77
|
+
### Missing generated files in the build context
|
|
78
|
+
|
|
79
|
+
The build fails with `"/shared-platform-engineering/docker-templates/<x>.sh": not found` or `"/package.json": not found`.
|
|
80
|
+
|
|
81
|
+
**Cause:** the project is missing its generated runtime assets.
|
|
82
|
+
|
|
83
|
+
**Fix:**
|
|
84
|
+
- `flisk project --yes` copies `shared-platform-engineering/docker-templates` (verified).
|
|
85
|
+
- If the root `package.json` is still missing, add a Bun workspace manifest. This is what fixed ERP:
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{ "name": "<project>", "private": true, "type": "module", "workspaces": ["services/*/*"] }
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
- `flisk doctor` now reports both (`checkGeneratedProjectRuntimeAssets`).
|
|
92
|
+
|
|
93
|
+
### `bun run build` fails with `TS2688: Cannot find type definition file for 'bun'`
|
|
94
|
+
|
|
95
|
+
**Cause:** the generated tsconfig sets `"types": ["bun"]`, but the service's `package.json` has no `@types/bun`.
|
|
96
|
+
|
|
97
|
+
**Fix:** add `"@types/bun": "^1.4.2"` to `devDependencies`. `flisk doctor` now reports this (`checkTypeScriptTypeDependencies`).
|
|
98
|
+
|
|
99
|
+
### `flisk up <stack>` queues every stack
|
|
100
|
+
|
|
101
|
+
**Observed, not root-caused:** `flisk up finance` left 129 resources pending across all stacks.
|
|
102
|
+
|
|
103
|
+
**Protect the machine:** check the counts, then disable the other stacks.
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
tilt get uiresources -o json | python3 -c 'import json,sys,collections; print(collections.Counter(i.get("status",{}).get("updateStatus") for i in json.load(sys.stdin)["items"]))'
|
|
107
|
+
tilt disable <other-stack-resource> <...>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Engine edits have no effect
|
|
111
|
+
|
|
112
|
+
**Cause:** projects run a vendored copy of the engine at `.flisk/.flisk-out/flisk-cli-ext/`. The installed `/usr/local/bin/flisk` vendors **its own bundled engine**, so it can silently overwrite your local one.
|
|
113
|
+
|
|
114
|
+
**Fix:** re-vendor from your local checkout, then check the copy matches.
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
(cd <core>/cli && bun run build)
|
|
118
|
+
FLISK_EXTENSION_SOURCE=<core> node <core>/cli/bin/flisk.js project --yes
|
|
119
|
+
diff -rq <core>/engine/topologies/platform/docker .flisk/.flisk-out/flisk-cli-ext/engine/topologies/platform/docker
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Reading Tilt state
|
|
123
|
+
|
|
124
|
+
- Use the CLI. The HTTP API (`localhost:10350/api/view`) returns 403 "missing session token".
|
|
125
|
+
- `tilt get uiresources <name> -o json` shows a resource's state. **`buildHistory[0]` is the newest build**; reading `[-1]` shows a stale error and misleads you.
|
|
126
|
+
- `tilt logs <resource>` gives the full build log.
|
|
127
|
+
|
|
128
|
+
## ERP project layout
|
|
129
|
+
|
|
130
|
+
| Thing | Value |
|
|
131
|
+
|---|---|
|
|
132
|
+
| Service manifests | `services/<stack>/<svc>/service.json` |
|
|
133
|
+
| Image names | `<stack>_<svc>:dev` |
|
|
134
|
+
| Compose project | `<stack>-autogenerated` |
|
|
135
|
+
| Compose file | `services/<stack>/.autogenerated/docker-compose.app.autogenerated.yml` |
|
|
136
|
+
| Postgres | `services/platform/database-management/docker-compose.yml` |
|
|
137
|
+
| Traefik | `.flisk/.flisk-out/docker-compose.traefik.yml` |
|
|
138
|
+
| Databases | `<project>_<stack>`, created with `createdb` |
|
|
139
|
+
| Golden images | `<project>-l1`, `-l2`, `-l3-*`, `-l4-*` |
|
|
140
|
+
|
|
141
|
+
## Measuring without fooling yourself
|
|
142
|
+
|
|
143
|
+
### Image size is disk, not RAM
|
|
144
|
+
|
|
145
|
+
- `docker images` counts shared layers once per image. Real disk use is `docker system df`. The 107 ERP images add up to 26 GB listed, but all 151 images on the machine together use 6 GB on disk.
|
|
146
|
+
- See what fills an image, layer by layer:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
docker history <img> --format '{{.Size}}\t{{.CreatedBy}}'
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
- **Measured:** ERP backends are 176–276 MB each, but only 4.5–8.8 MB is service-specific. The rest is shared: Bun binary 93 MB, Alpine 9 MB, L1 packages 30 MB.
|
|
153
|
+
- **Measured:** `auth_auth-api-backend:dev` is 826 MB on disk, yet uses 33 MiB of RAM when running. Of the 826 MB, two copies of `node_modules` take 199 MB each, and hugo takes 57 MB. The duplicate-copy fix is only on branch `autoresearch/sep25`. The hugo removal is on `main`. Both need a rebuild to take effect.
|
|
154
|
+
|
|
155
|
+
### RAM: `docker stats` undercounts
|
|
156
|
+
|
|
157
|
+
It leaves out Docker's per-container overhead in the VM (containerd shims and the init process). Use the change in the Docker VM's own memory instead:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
docker run --rm alpine awk '/MemTotal/{t=$2}/MemAvailable/{a=$2}END{printf "%d MiB used\n",(t-a)/1024}' /proc/meminfo
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
- **Measured:** 100 idle ERP containers cost **2,076 MiB real (about 21 MiB each)**. `docker stats` reported 1,693 MiB for the same containers.
|
|
164
|
+
- The VM measurement is noisy for small counts: the same 20-container setup read 442 MiB one time and 214 MiB the next. Use 100 containers, or repeat the run and report the range.
|
|
165
|
+
|
|
166
|
+
### Time: start containers in parallel, as Tilt does
|
|
167
|
+
|
|
168
|
+
A serial `docker run` loop measures the launcher, not the services. For parallel starts on macOS:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
tr '\n' '\0' < cmds.txt | xargs -0 -n1 -P8 sh -c
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
- **Measured:** 100 ERP containers were all healthy in **31.7 s** starting 8 at a time, with 0 crashes. Starting the containers took 26.6 s of that.
|
|
175
|
+
- The website claims "full boot in under 5 seconds". Measured, that only holds for about 5 services (4.5 s).
|
|
176
|
+
|
|
177
|
+
### North-star math: 100 services in 16 GB
|
|
178
|
+
|
|
179
|
+
(Docker VM MemTotal − 512 MiB for infrastructure) ÷ 100 = the per-service budget. On this Mac that's (7,934 − 512) ÷ 100 ≈ **74 MiB per service**. The measured 21 MiB fits, but only for idle containers answering `/health`. It hasn't been measured under real load.
|
|
180
|
+
|
|
181
|
+
## Tools in this repo and how far to trust them
|
|
182
|
+
|
|
183
|
+
| Tool | Status |
|
|
184
|
+
|---|---|
|
|
185
|
+
| `bun scripts/benchmark/container-scale.ts --synthetic` | **Verified** for 5 to 100 containers. Starts containers serially, so "all healthy" is about the launch time. |
|
|
186
|
+
| `container-scale.ts` default (compose) mode | **Verified at tier 5** (2026-09-26): real generated compose files, real Postgres, real Traefik, 5/5 requests through Traefik returned 200, all healthy in 4.9s. Not yet run at 100 — that's the one that answers the north star. Its first run hung indefinitely (`Bun.spawn()` + a `Bun.sleepSync()` poll on `exitCode` never observes the exit, because `sleepSync` blocks the event loop Bun needs to record it) — fixed by launching with `spawnSync` instead. If you see a `container-scale.ts` run sit for minutes with 0% CPU while its containers are already healthy, this bug is back; check for `Bun.spawn` + `sleepSync` polling anywhere in the file. |
|
|
187
|
+
| `scripts/autoresearch/layer-eval.sh` with the `layer-autoresearch` skill | **Verified** (4 runs). Run it from a worktree outside `~/Developer/Codex`. |
|
|
188
|
+
| `scripts/measure-idle-footprint.sh <container>` | Written but **never run**. |
|
|
189
|
+
| `tilt alpha tiltfile-result -f <Tiltfile>` | Runs Starlark without starting anything. `print` output is swallowed, so return data with `fail('RESULT' + encode_json(r))`. `load()` needs a literal path. |
|
|
190
|
+
| `tests/tilt-engine/test_runtime_container_footprint.py` | Runs the real generators through Tilt. |
|
|
191
|
+
|
|
192
|
+
## Environment traps
|
|
193
|
+
|
|
194
|
+
- **`.flisk/.project-id` is not gitignored by default and is easy to accidentally stage.** It's created the first time anything checks a Premium license (`getOrCreateProjectId` in `cli/src/generator/extension-fetch.ts`) - a random UUID sent alongside `FLISK_LICENSE_KEY` to the license server for per-project tracking, not itself a secret credential, but it's local machine state that has no business in a shared repo. Found staged (`git status`, not yet committed - caught before it reached `origin/main`) in `flisk-erp-system` on 2026-09-26; `flisk-saas-starter` and `flisk-restaurant-example` had the same `.gitignore` gap with no file yet; `flisk-user-management` has **no `.gitignore` at all** (currently harmless - only 35 minimal tracked files, nothing sensitive - but unprotected the moment real development starts there). The CLI has no `.gitignore` template of its own to fix at the source (`flisk project` doesn't generate one; each starter repo ships its own) - check every project's `.gitignore` for `.flisk/.project-id` individually, and `git status`/`git log --all -- .flisk/.project-id` before assuming it's fine.
|
|
195
|
+
|
|
196
|
+
- **Auto-commit tool.** Something outside Claude commits and pushes edits in `~/Developer/Codex/*` repos to `origin/main` within about a minute, with messages like "skill" or "specs". Do experiments in a worktree outside that folder:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
git worktree add ~/Developer/<name> <branch>
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
- **macOS shell:**
|
|
203
|
+
- There's no `timeout` command.
|
|
204
|
+
- `xargs -I` has a 255-character limit, so use the `-0` form above.
|
|
205
|
+
- System `python3` is 3.9: add `from __future__ import annotations` before using `X | None` types.
|
|
206
|
+
- Bash is version 3.2.
|
|
207
|
+
- **Lint only the files you touched:**
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
cd cli && ./node_modules/.bin/biome check <files>
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
`bun run lint -- <files>` still lints the whole repo, which has many pre-existing errors.
|
|
214
|
+
- **Failures that aren't yours:**
|
|
215
|
+
- pytest `test_docker_generator_bugs.py::test_expose_line_must_be_numeric_port` and `test_health_endpoints.py::test_overall_health_endpoint_structure` also fail on the unmodified code.
|
|
216
|
+
- vitest `saas-starter-integration` and `stack-features-e2e` time out when Docker is busy.
|
|
217
|
+
|
|
218
|
+
## Resolved since the first version of this skill
|
|
219
|
+
|
|
220
|
+
- **`flisk up <stack>` queuing every stack — fixed and verified (2026-09-26).** `flisk up finance` computed the right 16-service list but passed it to Tilt as bare positional args. The generated Tiltfile's focus filter (`Config.apply_focus` / `apply_focus_filter` in `profiles.star`) only reads the `--focus` flag - the positional-args catch-all it also defines (`cfg['args']`) is never read anywhere. So every stack-scoped `flisk up` silently fell back to Tilt's default "pre-alpha" phase and enabled every stack in it (verified: 247 enabled resources instead of 16-40). Fix: `buildTiltUpArgs` (`cli/src/utils/tilt.ts`) now passes `--focus=<stackName>`, reusing the Tiltfile's own dependency-aware domain expansion. **Argument order matters**: `--focus=...` must come after a `--` separator (`tilt up -f <path> -- --focus=finance <names>`) - `tilt up` rejects `--focus` as an unrecognized top-level flag otherwise (`tilt up --help` lists its real flags; custom Tiltfile config flags only reach `config.parse()` via `--`). Verified end-to-end: `tilt get uiresources` showed 402 Disabled / 24 Enabled for `flisk up finance` after the fix, and the 24 enabled were exactly finance's services plus required infra.
|
|
221
|
+
|
|
222
|
+
- **What actually overloads a real full `flisk up` at 100+ services — tested and it held (2026-09-26).** Ran a real, uncapped `flisk up` (no stack filter, all 107 services, Tilt doing real builds and reconciliation - not the synthetic/capped benchmark) with a self-killing watchdog sampling load/free-memory/`docker ps` latency every 5s. Result: **110/110 containers reached healthy, zero crashes, zero danger-threshold strikes**, over an 18-minute run. Load peaked around 20 during the busiest build phase (~20-30 containers starting at once) and then *settled back down* to 11-16 as more services came online, finishing at 11.45 with all 110 up. `docker ps` occasionally spiked to 2-6s under load but never approached the 10s `flisk doctor` timeout for long. This is the same scenario that froze the machine on 2026-09-25 (load 28-43, 99 MB free, `docker ps` 6-13s) - it did not recur. Caveat: this is one run on one machine state, and it isn't certain which fix (or whether the host simply had less competing load this time) made the difference; the single-process-CMD image rebuild only covered a minority of services (finance + a couple of supply_chain ones) at the time of this run, so a full image rebuild wasn't a factor. Re-run with the watchdog pattern above (`sysctl -n vm.loadavg`, `vm_stat` free pages, timed `docker ps`) before trusting a "it's fine now" claim on a different machine or after further engine changes.
|
|
223
|
+
|
|
224
|
+
## Still unknown
|
|
225
|
+
|
|
226
|
+
- **Whether Bun `--smol` (`BUN_OPTIONS=--smol`) saves memory.** Bun does read the variable, but the A/B test was inconclusive.
|
|
227
|
+
- **Why auth's production `node_modules` is 199 MB.**
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: flisk-up
|
|
3
|
+
description: Start a Flisk stack with `flisk up`, preview it first with `flisk up <stack> --dry-run`, and confirm the healthy URLs. Use when the user asks to run, start, or bring up their local services, or after changing service.json files.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Requires the flisk CLI. Services that declare a `command` need only their own runtime; other services need Docker and Tilt. Does not deploy.
|
|
6
|
+
metadata:
|
|
7
|
+
author: flisk-sh
|
|
8
|
+
version: "1.0"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Flisk up
|
|
12
|
+
|
|
13
|
+
Start local services from `service.json` manifests. Flisk writes the Docker and Tilt configuration; do not write Dockerfiles, Tiltfiles, or routes by hand.
|
|
14
|
+
|
|
15
|
+
## Workflow
|
|
16
|
+
|
|
17
|
+
1. Run `flisk doctor` if the machine has not been checked yet. Stop on unresolved errors.
|
|
18
|
+
2. Preview the stack: `flisk up <stack> --dry-run`. Show the user which services and URLs will start.
|
|
19
|
+
3. Start it: `flisk up <stack>`. Omit `<stack>` to start every stack.
|
|
20
|
+
4. Confirm health with `flisk status --json`. Report each service's URL only after it reports healthy.
|
|
21
|
+
5. If `flisk up` refuses to start because generated files differ from `service.json`, regenerate from the source manifest. Use `--ignore-drift` only when the user asks to start anyway.
|
|
22
|
+
|
|
23
|
+
## Services that run without Docker
|
|
24
|
+
|
|
25
|
+
A service whose `service.json` declares `command` (for example `"command": "node server.js"`, with `appName`, `appType`, `port`, `dependsOn` and an optional `healthCheckPath`) runs as a local process. When every selected service has one, `flisk up` needs no Docker and no Tilt: it starts them in `dependsOn` order, prints `http://localhost:<port>` for each, prefixes their output, and restarts a service that exits. It stays in the foreground; `flisk down` stops it from another terminal.
|
|
26
|
+
|
|
27
|
+
- Prefer `command` services for a simple app (an API, a website, a worker). Use Docker services when the app needs a database, one gateway URL, or the container it deploys.
|
|
28
|
+
- Do not mix the two in one project: `flisk up` refuses with `MIXED_RUNTIME`.
|
|
29
|
+
- `flisk up --json` reports `"runtime": "native"` and each service's URL. Read output with `flisk logs --service <name>`.
|
|
30
|
+
- Guide: docs/run-without-docker.md.
|
|
31
|
+
|
|
32
|
+
## Guardrails
|
|
33
|
+
|
|
34
|
+
- Ask before starting a large stack or one likely to build many images; cold builds can take several minutes.
|
|
35
|
+
- Use `flisk up -f` only when the user agrees to kill the existing Tilt process.
|
|
36
|
+
- Do not edit `.autogenerated/` or other generated output. Change `service.json` instead.
|
|
37
|
+
- Flisk runs locally. Do not use it to deploy to a cluster.
|
package/package.json
CHANGED
|
@@ -120,17 +120,9 @@
|
|
|
120
120
|
]
|
|
121
121
|
},
|
|
122
122
|
"then": {
|
|
123
|
-
"
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
"appName"
|
|
127
|
-
]
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
"required": [
|
|
131
|
-
"name"
|
|
132
|
-
]
|
|
133
|
-
}
|
|
123
|
+
"required": [
|
|
124
|
+
"appName",
|
|
125
|
+
"appType"
|
|
134
126
|
],
|
|
135
127
|
"not": {
|
|
136
128
|
"anyOf": [
|
|
@@ -601,10 +593,6 @@
|
|
|
601
593
|
"pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
|
|
602
594
|
},
|
|
603
595
|
"type": "object"
|
|
604
|
-
},
|
|
605
|
-
"name": {
|
|
606
|
-
"description": "Service name. Same as appName; a command service may use either.",
|
|
607
|
-
"type": "string"
|
|
608
596
|
}
|
|
609
597
|
},
|
|
610
598
|
"required": [
|
|
@@ -587,7 +587,13 @@ DATABASE_APP_TYPES = ['backend', 'bring-your-own']
|
|
|
587
587
|
|
|
588
588
|
def resource_needs_database(manifest):
|
|
589
589
|
"""True when a resource of this manifest receives DATABASE_URL and needs its database provisioned."""
|
|
590
|
-
|
|
590
|
+
manifest = manifest or {}
|
|
591
|
+
if manifest.get('appType') in DATABASE_APP_TYPES:
|
|
592
|
+
return True
|
|
593
|
+
# An agent with postgres durability keeps its session checkpoints in the stack database, so without provisioning
|
|
594
|
+
# its /ready never turns 200.
|
|
595
|
+
agent = manifest.get('agent')
|
|
596
|
+
return manifest.get('appType') == 'agent' and type(agent) == 'dict' and agent.get('durability') == 'postgres'
|
|
591
597
|
|
|
592
598
|
|
|
593
599
|
def _has_backend_resource(resource_config, resource_manifests):
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import{createRequire as __fliskRequire}from'node:module';const require=__fliskRequire(import.meta.url);
|
|
2
|
-
import{a as $}from"./chunk-QEBN6ZVQ.js";import{b as O,c as V,d as Y,p as J,q as K,v as L,w as I,y as A}from"./chunk-MUDE4DZD.js";import{C as ie,D as G,E as W,fa as ae,h as D,i as B,ka as se,la as ce,na as le,o as h,p as b,pa as pe,q as t,qa as fe,ra as de}from"./chunk-ETXZ5LUG.js";import{N as U,P as z,R as C,b as g,f as P,m as N,o as E,x as T}from"./chunk-C4UFBXRD.js";import{execFileSync as je}from"node:child_process";import{cpSync as _e,existsSync as S,readdirSync as we,readFileSync as H,writeFileSync as xe}from"node:fs";import{basename as he,dirname as Pe,isAbsolute as Ee,join as j,resolve as M}from"node:path";import{cwd as ke}from"node:process";import{fileURLToPath as Ce}from"node:url";import{Command as Oe}from"commander";var ye="-y, --yes",be="Skip prompts and confirmations; use defaults";function ue(e,o=be){return e.option(ye,o,!1)}async function Se(e,o=!0){let l=await I({message:e,initial:o});return l||D(),l}function Le(e,o=1){e.valid||C(e.error??"Validation failed",o)}function Ie(e,o,l,s){return e.dryRun?(s?s():(console.log(`Dry run - ${o}`),console.log(`Would run: ${l}`)),!0):!1}async function qe(e,o){return await Se(e,!0)?!0:(o&&o(),!1)}var q=new Map;function me(e){e!==void 0?q.delete(e):q.clear()}function Be(e=!1){let o=T(),l=o??"";if(!e){let f=q.get(l);if(f)return f}let{resources:s,problems:p}=o?se(o):{resources:le(),problems:[]},u=de(s),n=fe(s);ce(p);let r=s.filter(f=>!f.stack),d=new Map;for(let f of s)if(f.stack){let a=d.get(f.stack)||[];a.push(f),d.set(f.stack,a)}let m={resources:s,problems:p,stacks:u,stackNames:n,unassignedResources:r,resourcesByStack:d};return q.set(l,m),m}var R={proxy:{name:"proxy",description:"Traefik reverse proxy and API gateway for routing all services",category:"core",phase:"pre_alpha",enabled_by_default:!0,dependsOn:[]},verdaccio:{name:"verdaccio",description:"Verdaccio npm registry for package management and local publishing (Premium - requires FLISK_LICENSE_KEY)",category:"premium",phase:"pre_alpha",enabled_by_default:!1,dependsOn:[]},[P]:{name:P,description:"PostgreSQL database for data persistence and SQL operations",category:"core",phase:"pre_alpha",enabled_by_default:!0,dependsOn:[]},monitoring:{name:"monitoring",description:"SigNoz or SkyWalking observability platform for monitoring and tracing",category:"optional",phase:"pre_alpha",enabled_by_default:!1,dependsOn:[P]},elk:{name:"elk",description:"Elasticsearch, Logstash, Kibana stack for log aggregation and analysis",category:"optional",phase:"pre_alpha",enabled_by_default:!1,dependsOn:[]},debezium:{name:"debezium",description:"Change Data Capture for real-time data streaming from databases",category:"optional",phase:"pre_alpha",enabled_by_default:!1,dependsOn:[P]},"golden-image":{name:"golden-image",description:"Pre-built Docker image layer for faster builds and smaller deployments",category:"optional",phase:"pre_alpha",enabled_by_default:!0,dependsOn:[]}};function Q(e,o){try{return pe(e,o)}catch{return[]}}function Ae(e){return new Set([...e.phases.pre_alpha.enabledStacks,...e.phases.alpha.enabledStacks,...e.phases.beta.enabledStacks,...e.phases.out_of_scope.enabledStacks])}function X(e,o){let l=Ae(e),s=o.filter(p=>!l.has(p));return s.length===0?(e.phases.pre_alpha.enabledStacks=Array.from(new Set(e.phases.pre_alpha.enabledStacks)),[]):(e.phases.pre_alpha.enabledStacks=Array.from(new Set([...e.phases.pre_alpha.enabledStacks,...s])),s)}function gt(e,o){let l=j(e,".flisk",N);if(!S(l))return[];let s=J(e),p=X(s,Q(e,o));return p.length>0&&O(l,s),p}function $e(){return Object.values(R).filter(e=>e.enabled_by_default&&e.category==="core").map(e=>e.name)}function Re(e,o){return o||($[e]?.repo.split("/").pop()??e).replace(/\.git$/,"")}function ge(e){return e.split(`
|
|
3
|
-
`).map(l=>l.trim()).filter(Boolean).pop()??"unknown error"}async function Fe(e,o,l,s={}){let p=$[e];if(!p){console.log(g.red(`
|
|
4
|
-
\u274C Unknown template: "${e}"`)),console.log(g.yellow(`
|
|
5
|
-
Available templates:`));for(let[r,d]of Object.entries($))console.log(` ${g.cyan(r)} ${g.gray(`- ${d.description}`)}`);console.log(g.gray("\nOr run `flisk project` with no template for a blank project.")),process.exit(1)}let u=Re(e,o);ae(u)||U.invalidPath(u).exit();let n=Ee(u)?u:M(ke(),u);S(n)&&we(n).length>0&&U.directoryExists(n).exit(),s.quiet||(B(`Cloning template: ${e}`),t(`${p.description}
|
|
6
|
-
`,0),t(`Source: ${p.bundledPath?"bundled Flisk example":p.repo}`,0),t(`Destination: ${n}
|
|
7
|
-
`,0));try{if(p.bundledPath){let r=M(Pe(Ce(new URL("../dist/commands/project.js",import.meta.url).href)),"../../../");_e(M(r,p.bundledPath),n,{recursive:!0});let d=he(n).replace(/-/g,"_");for(let m of["services/platform/messaging/docker-compose.yml","services/shop/orders-api/service.json","services/shop/orders-api/src/index.ts","services/shop/orders-worker/service.json","services/shop/orders-worker/src/index.ts"]){let f=j(n,m),a=H(f,"utf-8");xe(f,a.replaceAll("flisk_example",d))}}else je("git",["clone",p.repo,n],{stdio:["ignore","pipe","pipe"],encoding:"utf-8"})}catch(r){let d=r instanceof Error?r.message:String(r),m=p.bundledPath?`Bundled example copy failed (${ge(d)}). Reinstall the Flisk CLI package and try again.`:`git clone failed: ${ge(d)}. Check you have git installed and network access.`;if(s.quiet)throw new Error(m);C(m)}if(me(),!s.quiet){console.log(g.green(`
|
|
8
|
-
\u2705 Cloned "${e}" into ${u}/`)),t(`
|
|
9
|
-
Next steps:`,0),t(`1. cd ${u}`),t("2. flisk doctor # check Docker/Tilt are ready"),t("3. flisk up # start the stack"),t(`
|
|
10
|
-
Runtime readiness:`,0);for(let r of l)t(r,0)}}var w={version:"1.0",project:{name:"",version:"1.0.0"},phases:{pre_alpha:{name:"Pre-Alpha",description:"Core infrastructure and MVP services",enabledStacks:$e()},alpha:{name:"Alpha",description:"Essential business services",enabledStacks:[]},beta:{name:"Beta",description:"Extended features",enabledStacks:[]},out_of_scope:{name:"Out of Scope",description:"Future releases",enabledStacks:[]}},optional_infra:{monitoring:!1,elk:!1,debezium:!1,golden_image:!0,verdaccio:!1},discovery:{paths:["services/*/*"]},overrides:{}};function ht(e){let o=JSON.parse(JSON.stringify(w));o.project.name=he(e)||"my-project",V(j(e,".flisk")),O(j(e,".flisk",N),o)}var kt=ue(new Oe("project")).alias("init").description("Initialize or validate project-level master configuration").argument("[template]",`Clone a starter example instead of a blank project (${Object.keys($).join(", ")})`).option("--path <dir>","Directory to clone the template into (default: the template's repo name)").option("--check","Check if master configs exist and are in sync").option("--force","Overwrite existing configuration (dangerous)").option("--config-file <path>","Load project config from existing JSON file").option("-q, --quiet","Only print what fails; used by `flisk demo`",!1).action(async(e,o)=>{let{assertMachineReadyOrExit:l,detectRuntimePrerequisites:s,formatRuntimeNextSteps:p}=await import("./cold-preflight-KUWOL2Q2.js");await l({scope:"scaffold"});let u=p(s()),n=!!o.quiet;if(e){await z(async()=>Fe(e,o.path,u,{quiet:n}));return}await z(async()=>{let r=T();r||(r=ke(),n||(b(`\u{1F680} Initializing new Flisk project...
|
|
11
|
-
`),t(`Location: ${r}
|
|
12
|
-
`,0)));let d=j(r,".flisk"),m=j(d,N);if(o.check){let c=E.every(k=>S(j(r,".flisk",".flisk-out",k))),v=S(m);if(c&&v){let k=J(r);h("Project configuration is valid"),t(`Project: ${k.project.name}`,3),t(`Phases: ${Object.keys(k.phases).join(", ")}`,3),process.exit(0)}else{if(console.log(g.yellow("\u26A0\uFE0F Project configuration incomplete:")),v||t(".flisk/project.json (not found)",3),!c)for(let k of E.filter(_=>!S(j(r,".flisk/.flisk-out",_))))t(`.flisk/.flisk-out/${k} (not found)`,3);t("Run `flisk project` to create them."),process.exit(1)}}n||(B("Project Configuration"),t(`Project root: ${r}
|
|
13
|
-
`,0)),S(d)||(V(d),n||h("Created: .flisk/ directory"));let f=S(m);if(f&&!o.force){n||h(".flisk/project.json exists");let c=JSON.parse(H(m,"utf-8")),v=J(r),k=Q(r),_=X(v,k);if((_.length>0||!c.phases)&&O(m,v),_.length>0&&!n&&t(`Auto-enabled discovered service stacks: ${_.join(", ")}`,0),n||b(`
|
|
14
|
-
\u{1F4CB} Regenerating master configuration files...
|
|
15
|
-
`),await K(r,{quiet:n}),W(r))n||h("Created: .env (the defaults work as-is)");else{let y=G(r);y.length>0&&!n&&h(`Updated: .env (added ${y.join(", ")}; existing values unchanged)`)}let F=Y(r);if(F.length>0&&!n&&h(`Added to .gitignore: ${F.join(", ")}`),!n){console.log(g.green(`
|
|
16
|
-
\u2705 Project configuration regenerated!`)),t(`
|
|
17
|
-
Generated in .flisk/.flisk-out/:`,0);for(let y of E)t(`- ${y}`);t(`
|
|
18
|
-
Runtime readiness:`,0);for(let y of u)t(y,0)}return}if(f&&o.force&&!o.yes&&(console.log(g.red(`
|
|
19
|
-
\u26A0\uFE0F WARNING: --force will overwrite .flisk/project.json!`)),!await I({message:"This will reset your project configuration. Continue?",initial:!1}))){D();return}let a,Z=Q(r);if(o.configFile){let c=M(o.configFile);S(c)||C(`Config file not found: ${c}`);let v=H(c,"utf-8");a=JSON.parse(v),n||h(`Loaded config from: ${c}`)}else if(o.yes)a=JSON.parse(JSON.stringify(w)),a.project.name=r.split("/").pop()||"my-project",n||console.log(g.gray("Using default configuration (non-interactive mode)"));else{b(`\u{1F4DD} Project Setup Wizard
|
|
20
|
-
`);let c=await L({message:"Project name:",initial:r.split("/").pop()||"my-project",validate:i=>i.trim()!==""||"Project name is required"}),v=await L({message:"Project version:",initial:"1.0.0-alpha"}),k=Object.values(R).filter(i=>i.category==="core"&&i.phase==="pre_alpha"),_=new Set(k.map(i=>i.name)),ne=await A({message:"Select Pre-Alpha enabled stacks (core infrastructure):",choices:[...k.map(i=>({title:i.description,value:i.name,selected:i.enabled_by_default})),...Z.filter(i=>!_.has(i)).map(i=>({title:`${i} (discovered service stack)`,value:i,selected:!0}))]}),F=await A({message:"Select Alpha enabled stacks (core business):",choices:[{title:"api (Backend API)",value:"api"},{title:"app (Frontend app)",value:"app"}]}),y=await A({message:"Select Beta enabled stacks (extended features):",choices:[{title:"worker (Background jobs)",value:"worker"},{title:"migrator (Database migrations)",value:"migrator"}]}),x=await A({message:"Enable optional infrastructure (high resource):",choices:Object.values(R).filter(i=>i.category==="optional").concat(Object.values(R).filter(i=>i.category==="premium")).map(i=>({title:i.description,value:i.name,selected:i.enabled_by_default}))});b(`
|
|
21
|
-
\u{1F4C2} Service discovery`),t("What: folder patterns Flisk scans for a service.json in each match."),t("Where: type one or more globs, comma-separated."),t("How: saved as discovery.paths in .flisk/project.json - editable later."),t(`Example: ${w.discovery.paths.join(", ")}
|
|
22
|
-
`);let ve=await L({message:"Folders to scan:",initial:w.discovery.paths.join(", ")});a=JSON.parse(JSON.stringify(w)),a.project.name=c,a.project.version=v,a.phases.pre_alpha.enabledStacks=Array.from(new Set(ne)),a.phases.alpha.enabledStacks=Array.from(new Set(F)),a.phases.beta.enabledStacks=Array.from(new Set(y)),a.optional_infra.monitoring=x.includes("monitoring"),a.optional_infra.elk=x.includes("elk"),a.optional_infra.debezium=x.includes("debezium"),a.optional_infra.golden_image=x.includes("golden_image"),a.optional_infra.verdaccio=x.includes("verdaccio");let re=ve.split(",").map(i=>i.trim()).filter(i=>i.length>0);a.discovery.paths=re.length>0?re:w.discovery.paths}let ee=X(a,Z);if(ee.length>0&&!n&&t(`Auto-enabled discovered service stacks: ${ee.join(", ")}`,0),n||b(`
|
|
23
|
-
\u{1F4CB} Creating project configuration...
|
|
24
|
-
`),O(m,a),n||(h("Created: .flisk/project.json"),t(`\u2192 Project: ${a.project.name}`),b(`
|
|
25
|
-
\u{1F4CB} Generating master configuration files...
|
|
26
|
-
`)),await K(r,{quiet:n}),n||b(`
|
|
27
|
-
\u{1F527} Setting up environment variables...
|
|
28
|
-
`),W(r))n||h("Created: .env (the defaults work as-is)");else{let c=G(r);c.length>0?n||h(`Updated: .env (added ${c.join(", ")}; existing values unchanged)`):n||h("Found: .env (environment already configured)")}let te=ie(r);if(te.missing.length>0){console.log(g.yellow(`
|
|
29
|
-
\u26A0\uFE0F Missing required environment variables:`));for(let c of te.missing)t(`- ${c}`,1);t("\u2192 Edit .env and fill in these values before running `flisk up`",1)}let oe=Y(r);if(oe.length>0&&!n&&h(`Added to .gitignore: ${oe.join(", ")}`),!n){console.log(g.green(`
|
|
30
|
-
\u2705 Project configuration complete!`)),t(`
|
|
31
|
-
Generated files in .flisk/.flisk-out/:`,0);for(let c of E)t(`- ${c}`);t(`
|
|
32
|
-
Environment configuration:`,0),t("- .env (contains all required variables)"),t(`
|
|
33
|
-
Source file:`,0),t("- .flisk/project.json (edit this to change project structure)"),t(`
|
|
34
|
-
Next steps:`,0),t("1. flisk resource api --type backend --stack app # scaffold a service"),t("2. flisk up app # start it"),t(`
|
|
35
|
-
Runtime readiness:`,0);for(let c of u)t(c,0);t("\nAfter editing .flisk/project.json, run `flisk config regenerate`.",0)}})});export{me as a,Be as b,ue as c,Le as d,Ie as e,qe as f,gt as g,Re as h,Fe as i,ht as j,kt as k};
|