@foliwake/cli 0.10.2 → 0.11.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.
Files changed (94) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +196 -14
  3. package/config/docker/compose.varnish.yaml +44 -0
  4. package/config/docker/compose.yaml +165 -0
  5. package/dist/commands/dev.d.ts +3 -0
  6. package/dist/commands/dev.js +58 -21
  7. package/dist/commands/docker/backup.d.ts +12 -0
  8. package/dist/commands/docker/backup.js +29 -0
  9. package/dist/commands/docker/configure.d.ts +23 -0
  10. package/dist/commands/docker/configure.js +73 -0
  11. package/dist/commands/docker/exec.d.ts +8 -0
  12. package/dist/commands/docker/exec.js +26 -0
  13. package/dist/commands/docker/install.d.ts +33 -0
  14. package/dist/commands/docker/install.js +126 -0
  15. package/dist/commands/docker/link.d.ts +12 -0
  16. package/dist/commands/docker/link.js +24 -0
  17. package/dist/commands/docker/list.d.ts +7 -0
  18. package/dist/commands/docker/list.js +16 -0
  19. package/dist/commands/docker/logs.d.ts +15 -0
  20. package/dist/commands/docker/logs.js +33 -0
  21. package/dist/commands/docker/remove.d.ts +13 -0
  22. package/dist/commands/docker/remove.js +35 -0
  23. package/dist/commands/docker/restart.d.ts +9 -0
  24. package/dist/commands/docker/restart.js +18 -0
  25. package/dist/commands/docker/restore.d.ts +14 -0
  26. package/dist/commands/docker/restore.js +34 -0
  27. package/dist/commands/docker/start.d.ts +9 -0
  28. package/dist/commands/docker/start.js +18 -0
  29. package/dist/commands/docker/status.d.ts +10 -0
  30. package/dist/commands/docker/status.js +22 -0
  31. package/dist/commands/docker/stop.d.ts +9 -0
  32. package/dist/commands/docker/stop.js +18 -0
  33. package/dist/commands/docker/update.d.ts +14 -0
  34. package/dist/commands/docker/update.js +42 -0
  35. package/dist/commands/project/publish.d.ts +1 -0
  36. package/dist/commands/project/publish.js +9 -2
  37. package/dist/core-command.d.ts +4 -1
  38. package/dist/core-command.js +6 -2
  39. package/dist/core-types.d.ts +1 -0
  40. package/dist/dev/container.d.ts +45 -0
  41. package/dist/dev/container.js +128 -0
  42. package/dist/dev/remote-html.js +2 -2
  43. package/dist/docker/asker.d.ts +4 -0
  44. package/dist/docker/asker.js +34 -0
  45. package/dist/docker/backup.d.ts +21 -0
  46. package/dist/docker/backup.js +114 -0
  47. package/dist/docker/cache-plan.d.ts +17 -0
  48. package/dist/docker/cache-plan.js +58 -0
  49. package/dist/docker/compose-file.d.ts +18 -0
  50. package/dist/docker/compose-file.js +58 -0
  51. package/dist/docker/context.d.ts +55 -0
  52. package/dist/docker/context.js +12 -0
  53. package/dist/docker/engine.d.ts +8 -0
  54. package/dist/docker/engine.js +51 -0
  55. package/dist/docker/env-block.d.ts +19 -0
  56. package/dist/docker/env-block.js +117 -0
  57. package/dist/docker/env-keys.d.ts +4 -0
  58. package/dist/docker/env-keys.js +33 -0
  59. package/dist/docker/env-verify.d.ts +17 -0
  60. package/dist/docker/env-verify.js +62 -0
  61. package/dist/docker/install-plan.d.ts +81 -0
  62. package/dist/docker/install-plan.js +332 -0
  63. package/dist/docker/install.d.ts +22 -0
  64. package/dist/docker/install.js +118 -0
  65. package/dist/docker/instance.d.ts +105 -0
  66. package/dist/docker/instance.js +184 -0
  67. package/dist/docker/lifecycle.d.ts +19 -0
  68. package/dist/docker/lifecycle.js +70 -0
  69. package/dist/docker/ports.d.ts +14 -0
  70. package/dist/docker/ports.js +50 -0
  71. package/dist/docker/process-context.d.ts +8 -0
  72. package/dist/docker/process-context.js +26 -0
  73. package/dist/docker/remove.d.ts +7 -0
  74. package/dist/docker/remove.js +82 -0
  75. package/dist/docker/report.d.ts +32 -0
  76. package/dist/docker/report.js +109 -0
  77. package/dist/docker/runner.d.ts +28 -0
  78. package/dist/docker/runner.js +55 -0
  79. package/dist/docker/settings-files.d.ts +40 -0
  80. package/dist/docker/settings-files.js +125 -0
  81. package/dist/docker/trace-url.d.ts +5 -0
  82. package/dist/docker/trace-url.js +36 -0
  83. package/dist/docker/update.d.ts +29 -0
  84. package/dist/docker/update.js +317 -0
  85. package/dist/docker-command.d.ts +17 -0
  86. package/dist/docker-command.js +37 -0
  87. package/dist/project-preview.d.ts +8 -0
  88. package/dist/project-preview.js +27 -5
  89. package/dist/project-publish.d.ts +8 -7
  90. package/dist/project-publish.js +124 -57
  91. package/dist/publish-code.d.ts +75 -0
  92. package/dist/publish-code.js +223 -0
  93. package/dist/render/site-status.js +2 -2
  94. package/package.json +13 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,53 @@
1
1
  # @foliwake/cli
2
2
 
3
+ ## 0.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 24e4a66: `npx foliwake` is enough for the whole quickstart, with Docker as the only other requirement.
8
+
9
+ - `foliwake docker install | list | status | start | stop | restart | logs | link | update | backup | restore |
10
+ configure | remove | exec` now ship in the CLI: they drive this computer's own `docker` and `docker compose`
11
+ (Compose 2.24 or later) and need no engine checkout. They are the engine's commands, moved here: the same
12
+ flags, texts, settings folder (`~/.config/foliwake/docker/<name>/`) and labels, so instances installed by
13
+ either are the same.
14
+ - `docker install` no longer asks for the image: it uses `ghcr.io/foliwake/foliwake:main` and names it in the
15
+ «Ready» line; `--image` still pins a tag, digest or local build.
16
+ - `foliwake dev` without `--remote` works without the engine on this computer: it runs the engine's own `dev` in a
17
+ throwaway container of the Foliwake image (the image of the Docker instance the folder is linked to, or of the
18
+ only one; `--image` names another). The folder is mounted at the same path, the port is published on
19
+ 127.0.0.1 only, the container runs as you and gets none of your environment. `--watch`, `--watch-polling`,
20
+ `--config`, `--site` and `--content` are passed to it. It needs an image whose engine reads
21
+ `FOLIWAKE_DEV_LISTEN_HOST`.
22
+ - Commands that need the engine now say how to run them in a Foliwake server in Docker:
23
+ `foliwake docker exec -- <command>`.
24
+ - c538cc2: `foliwake publish` in a linked folder publishes a preview built with new site code together with that code
25
+ (foliwake/foliwake#10).
26
+
27
+ - `foliwake preview` takes the code of the last commit; when that code is not live, it now says so: publishing
28
+ the preview also releases that code, which changes every page of the site. It no longer prints a
29
+ `publish --expect` command that the server would refuse.
30
+ - `foliwake publish` then asks one question that names both the code and the pages. Yes: it releases the
31
+ reviewed code, rebuilds the preview from the same source snapshots on that code (no new push) and publishes
32
+ its pages, so live holds exactly the reviewed content and code. No: nothing changes, and it prints the two
33
+ commands to do it by hand.
34
+ - New flag `--with-code`: `publish --yes` alone never releases code and refuses such a preview, naming the flag;
35
+ `publish --yes --with-code` does both.
36
+ - When a step after the code release fails, it says that the code is live but the pages are not, with the
37
+ command that finishes the publication and the one that rolls the code back.
38
+ - A refused publication no longer always says "run preview again": it names the command that works for the
39
+ refusal. "Published 1 page(s) did not succeed" now reads "Publishing 1 page failed".
40
+
41
+ ### Patch Changes
42
+
43
+ - Updated dependencies [3434ce0]
44
+ - create-foliwake@0.11.0
45
+ - @foliwake/block-kit@0.11.0
46
+ - @foliwake/blocks-contract@0.11.0
47
+ - @foliwake/core-contract@0.11.0
48
+ - @foliwake/server@0.11.0
49
+ - @foliwake/site-check@0.11.0
50
+
3
51
  ## 0.10.2
4
52
 
5
53
  ### Patch Changes
package/README.md CHANGED
@@ -1,16 +1,18 @@
1
1
  # @foliwake/cli
2
2
 
3
- The `foliwake` command without the Foliwake engine: sign in to a Foliwake server and run your site's commands
4
- there. Nothing renders or stores content on your computer; the server does the work, as it does for the
5
- dashboard.
3
+ The `foliwake` command without the Foliwake engine: install a Foliwake server in Docker on your computer, sign in
4
+ to a Foliwake server and run your site's commands there. This package renders and stores no content itself: the
5
+ server does the work, as it does for the dashboard, and `dev` runs the engine's own development server in Docker.
6
6
 
7
7
  ```sh
8
- npx @foliwake/cli login https://foliwake.example
9
- npx @foliwake/cli whoami
8
+ npx foliwake docker install # a Foliwake server in Docker: http://localhost:8080
9
+ npx foliwake create my-site # a site frontend, created and linked on that server
10
+ cd my-site && npx foliwake dev --watch # the working files at http://127.0.0.1:3000/
10
11
  ```
11
12
 
12
- Foliwake Cloud is not available yet: sign in to your own Foliwake server (the Docker package, or one your team
13
- runs). The server name `cloud` is reserved for it.
13
+ Docker (with Compose 2.24 or later) is the only other requirement. Foliwake Cloud is not available yet: sign in to
14
+ your own Foliwake server (`foliwake docker install`, or one your team runs). The server name `cloud` is reserved
15
+ for it.
14
16
 
15
17
  Or install it: `npm i -g @foliwake/cli`, then `foliwake …`. Node.js 22.22 or later.
16
18
 
@@ -47,6 +49,9 @@ Each command calls one operation of the server and prints the same text and `--j
47
49
  - `operation get | list | cancel | recover`
48
50
  - `credential set | list | rm`
49
51
  - `account keys create | list | revoke`
52
+ - `docker install | list | status | start | stop | restart | logs | link | update | backup | restore | configure |
53
+ remove | exec`: Foliwake servers in Docker on this computer (see [Docker](#docker))
54
+ - `dev [--watch]`: the working files with live diagnostics, served by the engine in Docker (see [dev](#dev))
50
55
  - `dev --remote [preview|live]`, `dev --remote-url <url>`: your blocks over a deployed site's pages
51
56
 
52
57
  `foliwake <command> --help` describes each; `--debug` prints the underlying error. The full list with flags
@@ -67,13 +72,34 @@ is linked already is refused: `--force` replaces the link, `foliwake site unlink
67
72
 
68
73
  Without any of these a command stops and says so. Unlike the engine's CLI, nothing runs locally:
69
74
  `FOLIWAKE_CONFIG` and `foliwake.config.json` are not read, and `--config` or `--content` answer that they need
70
- the engine.
75
+ the engine (`dev` excepted: it passes them to the engine in Docker).
71
76
 
72
77
  ## CI
73
78
 
74
79
  Create a CI key on the server (`foliwake account keys create`), then set `FOLIWAKE_SERVER` and
75
80
  `FOLIWAKE_TOKEN` in the job. The key is sent only to `FOLIWAKE_SERVER`, never to a server another flag names.
76
81
 
82
+ ## Docker
83
+
84
+ `foliwake docker install` installs a Foliwake server in Docker: it asks what the flags leave open (the image is
85
+ never asked: `--image` pins a tag, digest or local build), writes `~/.config/foliwake/docker/<name>/compose.yaml`
86
+ and `.env` (0600), pulls `ghcr.io/foliwake/foliwake:main`, starts it, waits until it is healthy and prints the
87
+ owner's one-time sign-in link. The `docker` commands drive this computer's own `docker` and `docker compose`
88
+ (Docker Desktop, OrbStack, colima or the Docker engine; Compose 2.24 or later) and find instances by their
89
+ `dev.foliwake.*` labels. Those that need the engine run it in a container of the instance's image: `link` and
90
+ `exec` in the server container, `backup` and `restore` in a helper container on the data volume. The engine's
91
+ Docker guide describes every command.
92
+
93
+ ## dev
94
+
95
+ Without the engine on this computer, `foliwake dev` runs the engine's own `dev` in a throwaway container of the
96
+ Foliwake image: the image of the Docker instance this folder is linked to (or of the only one; `--image` names
97
+ another, the default is `ghcr.io/foliwake/foliwake:main`). The folder is mounted at the same path, the port
98
+ (`--port`, default 3000) is published on 127.0.0.1 only, the container runs as you, gets none of your environment
99
+ and is removed when you press Ctrl+C. `--watch`, `--watch-polling`, `--config`, `--site` and `--content` are passed
100
+ to it. A configuration that names credentials or other hosts needs `foliwake config trust`, which only the engine
101
+ has; the configuration `foliwake create` writes needs none.
102
+
77
103
  ## dev --remote
78
104
 
79
105
  ```sh
@@ -113,8 +139,9 @@ engine and contract.
113
139
 
114
140
  ## Limits
115
141
 
116
- - No command renders or stores content locally: `dev` without `--remote`, `blocks render`, `serve`, `server`,
117
- `api serve`, `admin`, `docker …`, `config trust`, `account bootstrap|invite|link` need the engine.
142
+ - No command renders or stores content locally: `blocks render`, `serve`, `server`, `api serve`, `admin`,
143
+ `config trust`, `account bootstrap|invite|link` need the engine (a server in Docker runs them:
144
+ `foliwake docker exec -- <command>`). `dev` without `--remote` runs the engine in Docker.
118
145
  - `--config`, `--content`, `preview|publish --site`, and `operation recover --break-lock` (they act on a local
119
146
  configuration or state) answer that they need the engine.
120
147
  - `--timings` prints only the total time; the phase timings are measured by the engine.
@@ -122,7 +149,8 @@ engine and contract.
122
149
  `create`. The server choice and sign-in questions are the same.
123
150
  - Commands default waits to a 30 s settle delay, as the engine CLI does against a server (the server's own delay
124
151
  is not read).
125
- - `dev` serves only remote content (`--remote`, `--remote-url`); serving local Markdown needs the engine.
152
+ - `dev` without `--remote` needs Docker and an image whose engine has `FOLIWAKE_DEV_LISTEN_HOST` (older images
153
+ listen inside the container only, and the page does not open).
126
154
  - `dev --remote` has no block catalog: `/_dev/blocks` and `/_foliwake/blocks` answer 501 until the open block
127
155
  renderer exists (the engine's `foliwake dev` has it).
128
156
  - `dev --remote` signs in to a protected site with HTTP Basic only, not with your `foliwake login`.
@@ -321,8 +349,12 @@ uses it without a restart. The value is read from a file or stdin, never from th
321
349
 
322
350
  ### `foliwake dev`
323
351
 
324
- Develop blocks against a deployed site: its content, this checkout’s code (dev --remote)
352
+ Serve working files with live diagnostics (http://127.0.0.1:3000)
325
353
 
354
+ - `--config <value>`: project configuration (default: $FOLIWAKE_CONFIG, else ./foliwake.config.json in this folder)
355
+ - `--content <value>`: this folder instead of the site's content sources; refused when they need the page ledger
356
+ - `--image <value>`: without the engine on this computer: the Foliwake image dev runs in (default: the image of the
357
+ Docker instance this folder is linked to, or of the only one; else ghcr.io/foliwake/foliwake:main)
326
358
  - `--port <value>`: port to listen on (default 3000)
327
359
  - `--remote <[preview|live]>`: content from the deployed preview (default) or live site, local components/, scripts/ and
328
360
  styles/; endpoints from ./foliwake.remote.json. Live only when named; never a fallback
@@ -333,12 +365,161 @@ Develop blocks against a deployed site: its content, this checkout’s code (dev
333
365
  secret-free)
334
366
  - `--remote-url <value>`: remote mode with this site origin instead of foliwake.remote.json (https; http only for
335
367
  loopback)
336
- - `--watch`: watch local components/, scripts/, styles/ and reload open browser pages after changes (one reload per
337
- burst of saves; problems are shown in the page until fixed). Without it, refresh by hand
368
+ - `--site <value>`: site id from the project configuration (required when it lists several sites)
369
+ - `--watch`: watch local components/, scripts/, styles/ and Markdown content and reload open browser pages after changes
370
+ (one reload per burst of saves; problems are shown in the page until fixed). Without it, refresh by hand
338
371
  - `--watch-polling` / --no-watch-polling: with --watch: detect code changes by polling file stats (default on macOS);
339
372
  --no-watch-polling: native file-system events (default elsewhere). Precedence: this flag, then
340
373
  FOLIWAKE_WATCH_POLLING=1|0, then CHOKIDAR_USEPOLLING, then the platform default
341
374
 
375
+ ### `foliwake docker backup [name]`
376
+
377
+ Back up an instance's data volume to one .tar.gz on this computer: consistent copies of its databases,
378
+
379
+ - `--interactive` / --no-interactive: ask for missing values (default: only when stdin and stdout are a terminal)
380
+ - `--out <value>`: the archive to write (default:
381
+ ~/.config/foliwake/docker/&lt;name&gt;/backups/&lt;name&gt;-&lt;time&gt;.tar.gz)
382
+
383
+ ### `foliwake docker configure [name]`
384
+
385
+ Change settings of an instance, then recreate it (the data volume stays). Only the given flags change; other lines of
386
+ its .env are kept.
387
+
388
+ - `--bind <value>`: address the port is published on (127.0.0.1 or 0.0.0.0)
389
+ - `--cache <value>`: a Varnish in front of the live sites, on a port of its own (none: remove it)
390
+ - `--cache-port <value>`: with --cache varnish: its port (default: the first free one from 8090)
391
+ - `--domain <value>`: sites at &lt;site&gt;.live.&lt;domain&gt; and &lt;site&gt;.preview.&lt;domain&gt;
392
+ - `--image <value>`: the image (tag or digest)
393
+ - `--interactive` / --no-interactive: ask for missing values (default: only when stdin and stdout are a terminal)
394
+ - `--jaeger-port <value>`: with --traces jaeger: the UI port on 127.0.0.1
395
+ - `--jaeger-store <value>`: with --traces jaeger: in memory (default) or on disk for a week
396
+ - `--otlp-endpoint <value>`: with --traces external: the OTLP/HTTP endpoint (headers from $OTEL_EXPORTER_OTLP_HEADERS or
397
+ asked hidden)
398
+ - `--port <value>`: port on this computer (the public address follows when it was the default
399
+ http://localhost:&lt;port&gt;)
400
+ - `--public-origin <value>`: where browsers and `foliwake login` reach the server
401
+ - `--trace-url-template <value>`: with traces to your own collector: its trace page with {traceId}
402
+ (FOLIWAKE_TRACE_URL_TEMPLATE; "" removes it). With Jaeger the CLI sets it
403
+ - `--traces <value>`: traces: none, Jaeger beside the server, or your own OTLP collector
404
+
405
+ ### `foliwake docker exec`
406
+
407
+ Run the foliwake CLI inside an instance's server container (it reads the container's settings):
408
+ `docker exec [name] -- <args>`
409
+
410
+ - `--interactive` / --no-interactive: ask for missing values (default: only when stdin and stdout are a terminal)
411
+
412
+ ### `foliwake docker install [name]`
413
+
414
+ Install a Foliwake instance in Docker: questions, then pull, start, and the owner's sign-in link
415
+
416
+ - `--bind <value>`: address the port is published on: 127.0.0.1 (this computer only, default) or 0.0.0.0 (everywhere;
417
+ put HTTPS in front; FOLIWAKE_TRUST_PROXY is then not set)
418
+ - `--cache <value>`: a Varnish in front of the live sites, on a port of its own (default: none)
419
+ - `--cache-port <value>`: with --cache varnish: its port (default: the first free one from 8090)
420
+ - `--domain <value>`: sites at &lt;site&gt;.live.&lt;domain&gt; and &lt;site&gt;.preview.&lt;domain&gt; (default: the
421
+ public origin's host)
422
+ - `--image <value>`: the image: a tag, digest or local build (default ghcr.io/foliwake/foliwake:main; never asked)
423
+ - `--interactive` / --no-interactive: ask for missing values (default: only when stdin and stdout are a terminal)
424
+ - `--jaeger-port <value>`: with --traces jaeger: the UI port on 127.0.0.1 (default: the first free one from 16686)
425
+ - `--jaeger-store <value>`: with --traces jaeger: keep traces in memory (default) or on disk for a week
426
+ - `--open` / --no-open: open the owner's sign-in link in the browser (default: asked in a terminal, else no)
427
+ - `--otlp-endpoint <value>`: with --traces external: the OTLP/HTTP endpoint (headers from $OTEL_EXPORTER_OTLP_HEADERS or
428
+ asked hidden)
429
+ - `--owner-email <value>`: the owner account made at the first start (no mail is sent); not needed when the data volume
430
+ is reused
431
+ - `--port <value>`: port on this computer (default: the first free one from 8080; a taken port is refused, never swapped
432
+ silently)
433
+ - `--public-origin <value>`: where browsers and `foliwake login` reach the server (default:
434
+ http://localhost:&lt;port&gt;)
435
+ - `--pull <value>`: always (default): pull the image, a failed pull stops the install; missing: use the image if it is
436
+ on this engine already (a local build), pull only otherwise
437
+ - `--storage <value>`: where sites are kept: the data volume (default) or S3-compatible storage; fixed at the first
438
+ start
439
+ - `--storage-bucket <value>`: with --storage s3: the bucket name of each site (default foliwake-{org}-{site})
440
+ - `--storage-create-buckets` / --no-storage-create-buckets: with --storage s3: the key may create buckets (default yes)
441
+ - `--storage-endpoint <value>`: with --storage s3: the S3 endpoint (https://…)
442
+ - `--storage-region <value>`: with --storage s3: the region (default us-east-1; `auto` on R2)
443
+ - `--trace-url-template <value>`: with --traces external: your collector's trace page with {traceId}
444
+ (FOLIWAKE_TRACE_URL_TEMPLATE), for links from the dashboard and `operation get`
445
+ - `--traces <value>`: traces: none (default), Jaeger beside the server (UI on 127.0.0.1), or your own OTLP collector
446
+ - `--yes`: do not ask «Install?» at the end of the questions
447
+
448
+ ### `foliwake docker link [name]`
449
+
450
+ A new one-time sign-in link (15 minutes) for the owner or another account of an instance
451
+
452
+ - `--email <value>`: the account's e-mail address (default: the owner of the instance)
453
+ - `--interactive` / --no-interactive: ask for missing values (default: only when stdin and stdout are a terminal)
454
+
455
+ ### `foliwake docker list`
456
+
457
+ Foliwake instances on this Docker engine, found by their labels (removed ones whose data was kept: "data only")
458
+
459
+ - `--interactive` / --no-interactive: ask for missing values (default: only when stdin and stdout are a terminal)
460
+
461
+ ### `foliwake docker logs [name]`
462
+
463
+ The log of an instance's server (or its Jaeger); it holds one-time sign-in links, so keep it private
464
+
465
+ - `--follow`: keep printing new lines
466
+ - `--interactive` / --no-interactive: ask for missing values (default: only when stdin and stdout are a terminal)
467
+ - `--service <value>`: which service (default foliwake)
468
+ - `--since <value>`: only lines since a time or duration (e.g. 10m, 2026-11-13T10:00:00)
469
+ - `--tail <value>`: only the last N lines
470
+
471
+ ### `foliwake docker remove [name]`
472
+
473
+ Stop and remove an instance's containers and network, and its settings on this computer. The data volume is kept unless
474
+ --delete-data (then the name is typed to confirm, or --yes without a terminal).
475
+
476
+ - `--delete-data`: also delete its volumes: sites, accounts, storage (cannot be undone)
477
+ - `--interactive` / --no-interactive: ask for missing values (default: only when stdin and stdout are a terminal)
478
+ - `--yes`: do not ask; required without a terminal
479
+
480
+ ### `foliwake docker restart [name]`
481
+
482
+ Restart the containers of an instance
483
+
484
+ - `--interactive` / --no-interactive: ask for missing values (default: only when stdin and stdout are a terminal)
485
+
486
+ ### `foliwake docker restore [name]`
487
+
488
+ Restore a `docker backup` archive into an instance's data volume. The instance must be stopped.
489
+
490
+ - `--from <value>`: the archive `docker backup` wrote
491
+ - `--interactive` / --no-interactive: ask for missing values (default: only when stdin and stdout are a terminal)
492
+ - `--replace`: delete the data the volume holds first (cannot be undone)
493
+ - `--yes`: do not ask before --replace; required without a terminal
494
+
495
+ ### `foliwake docker start [name]`
496
+
497
+ Start the containers of a stopped instance
498
+
499
+ - `--interactive` / --no-interactive: ask for missing values (default: only when stdin and stdout are a terminal)
500
+
501
+ ### `foliwake docker status [name]`
502
+
503
+ State, health, image, ports, address, traces and data of an instance; secrets only as "set"
504
+
505
+ - `--interactive` / --no-interactive: ask for missing values (default: only when stdin and stdout are a terminal)
506
+
507
+ ### `foliwake docker stop [name]`
508
+
509
+ Stop the containers of an instance (data and settings stay)
510
+
511
+ - `--interactive` / --no-interactive: ask for missing values (default: only when stdin and stdout are a terminal)
512
+
513
+ ### `foliwake docker update [name]`
514
+
515
+ Pull the instance's image; when it changed, back up the data volume (`docker backup`), recreate the server and
516
+
517
+ - `--backup` / --no-backup: back up the data volume before the switch (default; --no-backup skips it)
518
+ - `--image <value>`: pin another image (tag, digest, or the id of a local build), kept in the settings
519
+ - `--interactive` / --no-interactive: ask for missing values (default: only when stdin and stdout are a terminal)
520
+ - `--pull <value>`: always (default): pull, a failed pull stops the update; missing: use the image if it is on this
521
+ engine already (e.g. the id of a local build to roll back to)
522
+
342
523
  ### `foliwake login [server]`
343
524
 
344
525
  Sign this computer in to a Foliwake server through the browser (device code)
@@ -485,6 +666,7 @@ Preview this project's pages on its site's server (a folder linked with site cre
485
666
  Publish the pages your last preview changed (or the pages of the given files and folders) to live
486
667
 
487
668
  - `--expect <value>`: the preview release you reviewed (sr_…); default: the one the last `foliwake preview` here made
669
+ - `--with-code`: with --yes: also release the preview's new site code (styles, scripts, blocks) with the pages
488
670
  - `--yes`: do not ask (scripts)
489
671
 
490
672
  ### `foliwake project unpublish [paths]`
@@ -0,0 +1,44 @@
1
+ # Merged into an instance's compose.yaml by `foliwake docker` with `--cache varnish`
2
+ # (packages/cli/src/docker/compose-file.ts): a Varnish in front of the live sites, on a port of its own. The server
3
+ # writes the multi-site VCL (the engine's config/varnish/sites.vcl.template, a purge token per site) into the `vcl`
4
+ # volume whenever its sites change (src/server/one-port/varnish-vcl.ts); this container reloads it when
5
+ # the file changes. Unknown hosts (the dashboard, preview, a site created since the last reload) are
6
+ # passed to the server uncached. `$$` is Compose's escape for the shell's `$`.
7
+ services:
8
+ varnish:
9
+ image: varnish:9.0.4@sha256:8630ca5549864dd6ab87572286e83ab1011e04e160c23630e6da45cfadc23fdf
10
+ command:
11
+ - sh
12
+ - -c
13
+ - |
14
+ set -eu
15
+ vcl=/etc/varnish/foliwake/default.vcl
16
+ until [ -s "$$vcl" ]; do sleep 1; done
17
+ varnishd -F -f "$$vcl" -a http=:80,HTTP -s "malloc,$${VARNISH_SIZE:-256M}" &
18
+ pid=$$!
19
+ trap 'kill -TERM "$$pid"; wait "$$pid"; exit 0' TERM INT
20
+ sum=$$(cksum < "$$vcl")
21
+ while kill -0 "$$pid" 2>/dev/null; do
22
+ sleep 5 & wait $$!
23
+ now=$$(cksum < "$$vcl")
24
+ if [ "$$now" != "$$sum" ] && varnishreload "$$vcl"; then sum=$$now; fi
25
+ done
26
+ wait "$$pid"
27
+ environment:
28
+ VARNISH_SIZE: ${VARNISH_SIZE:-256M}
29
+ ports:
30
+ - '${FOLIWAKE_BIND:-127.0.0.1}:${VARNISH_PORT:-8090}:80'
31
+ volumes:
32
+ - vcl:/etc/varnish/foliwake:ro
33
+ depends_on:
34
+ foliwake:
35
+ condition: service_started
36
+ read_only: true
37
+ tmpfs:
38
+ # varnishd compiles the VCL into a shared object here and loads it (exec), as its user (uid 1000).
39
+ - /var/lib/varnish:exec,uid=1000,gid=1000,mode=0750
40
+ security_opt: [no-new-privileges:true]
41
+ restart: unless-stopped
42
+ logging:
43
+ driver: json-file
44
+ options: {max-size: 10m, max-file: '3'}
@@ -0,0 +1,165 @@
1
+ # The template of `foliwake docker` (packages/cli/src/docker/compose-file.ts): one instance = one Compose
2
+ # project. The CLI writes its own copy to ~/.config/foliwake/docker/<instance>/compose.yaml with the instance
3
+ # name, its labels and the services it chose (the `jaeger` service and its configurations only
4
+ # with Jaeger traces). Values come from the .env (mode 0600) next to it; this file names variables only,
5
+ # never a secret value. Same image, ports and hardening as the engine's deploy/docker/compose.yaml (the
6
+ # engine's test/docker/compose-template.test.js keeps the two in step).
7
+ name: foliwake
8
+
9
+ # The Jaeger configurations of deploy/docker/jaeger/, inline: Jaeger reads the chosen one from its
10
+ # environment (`--config=env:…`), so there is no folder on the host (a remote Docker context works)
11
+ # and the container stays read-only. `$$` is Compose's escape for the `$` of Jaeger's own ${env:…}.
12
+ x-jaeger-memory: &jaeger-memory |
13
+ service:
14
+ extensions: [jaeger_storage, jaeger_query, healthcheckv2]
15
+ pipelines:
16
+ traces:
17
+ receivers: [otlp]
18
+ processors: [batch]
19
+ exporters: [jaeger_storage_exporter]
20
+ telemetry:
21
+ metrics:
22
+ level: none
23
+ traces:
24
+ level: none
25
+ logs:
26
+ level: info
27
+ extensions:
28
+ healthcheckv2:
29
+ use_v2: true
30
+ http:
31
+ endpoint: 0.0.0.0:13133
32
+ jaeger_query:
33
+ storage:
34
+ traces: traces
35
+ http:
36
+ endpoint: 0.0.0.0:16686
37
+ grpc:
38
+ endpoint: 127.0.0.1:16685
39
+ jaeger_storage:
40
+ backends:
41
+ traces:
42
+ memory:
43
+ max_traces: $${env:JAEGER_MAX_TRACES:-50000}
44
+ receivers:
45
+ otlp:
46
+ protocols:
47
+ http:
48
+ endpoint: 0.0.0.0:4318
49
+ processors:
50
+ batch:
51
+ exporters:
52
+ jaeger_storage_exporter:
53
+ trace_storage: traces
54
+ x-jaeger-badger: &jaeger-badger |
55
+ service:
56
+ extensions: [jaeger_storage, jaeger_query, healthcheckv2]
57
+ pipelines:
58
+ traces:
59
+ receivers: [otlp]
60
+ processors: [batch]
61
+ exporters: [jaeger_storage_exporter]
62
+ telemetry:
63
+ metrics:
64
+ level: none
65
+ traces:
66
+ level: none
67
+ logs:
68
+ level: info
69
+ extensions:
70
+ healthcheckv2:
71
+ use_v2: true
72
+ http:
73
+ endpoint: 0.0.0.0:13133
74
+ jaeger_query:
75
+ storage:
76
+ traces: traces
77
+ http:
78
+ endpoint: 0.0.0.0:16686
79
+ grpc:
80
+ endpoint: 127.0.0.1:16685
81
+ jaeger_storage:
82
+ backends:
83
+ traces:
84
+ badger:
85
+ directories:
86
+ keys: /tmp/badger/keys
87
+ values: /tmp/badger/values
88
+ ephemeral: false
89
+ ttl:
90
+ spans: $${env:JAEGER_TTL:-168h}
91
+ receivers:
92
+ otlp:
93
+ protocols:
94
+ http:
95
+ endpoint: 0.0.0.0:4318
96
+ processors:
97
+ batch:
98
+ exporters:
99
+ jaeger_storage_exporter:
100
+ trace_storage: traces
101
+
102
+ services:
103
+ foliwake:
104
+ image: ${FOLIWAKE_IMAGE:-ghcr.io/foliwake/foliwake:main}
105
+ ports:
106
+ - '${FOLIWAKE_BIND:-127.0.0.1}:${FOLIWAKE_HOST_PORT:-8080}:8080'
107
+ environment:
108
+ FOLIWAKE_PUBLIC_ORIGIN: ${FOLIWAKE_PUBLIC_ORIGIN:-http://localhost:8080}
109
+ FOLIWAKE_DOMAIN: ${FOLIWAKE_DOMAIN:-}
110
+ FOLIWAKE_TRUST_PROXY: ${FOLIWAKE_TRUST_PROXY:-}
111
+ FOLIWAKE_OWNER_EMAIL: ${FOLIWAKE_OWNER_EMAIL:-}
112
+ # Read at the first start only (provisioning.storage of /data/foliwake.config.json).
113
+ FOLIWAKE_STORAGE_ENDPOINT: ${FOLIWAKE_STORAGE_ENDPOINT:-}
114
+ FOLIWAKE_STORAGE_REGION: ${FOLIWAKE_STORAGE_REGION:-}
115
+ FOLIWAKE_STORAGE_BUCKET: ${FOLIWAKE_STORAGE_BUCKET:-}
116
+ FOLIWAKE_STORAGE_CREATE_BUCKETS: ${FOLIWAKE_STORAGE_CREATE_BUCKETS:-}
117
+ FOLIWAKE_STORAGE_ACCESS_KEY_ID: ${FOLIWAKE_STORAGE_ACCESS_KEY_ID:-}
118
+ FOLIWAKE_STORAGE_SECRET_ACCESS_KEY: ${FOLIWAKE_STORAGE_SECRET_ACCESS_KEY:-}
119
+ # Traces over OTLP/HTTP (empty: none); http://jaeger:4318 with the Jaeger of this instance.
120
+ OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:-}
121
+ OTEL_EXPORTER_OTLP_HEADERS: ${OTEL_EXPORTER_OTLP_HEADERS:-}
122
+ FOLIWAKE_ENVIRONMENT: ${FOLIWAKE_ENVIRONMENT:-}
123
+ # The trace page of an operation (dashboard links, `operation get`); with Jaeger, its UI here.
124
+ FOLIWAKE_TRACE_URL_TEMPLATE: ${FOLIWAKE_TRACE_URL_TEMPLATE:-}
125
+ # Every line of the instance's .env reaches the server too (the operator's own variables, e.g.
126
+ # FOLIWAKE_TRACE_ORIGIN_RATIO or <SITE>__PREVIEW_TOKEN); `environment` above wins for its keys.
127
+ env_file: [.env]
128
+ volumes:
129
+ - data:/data
130
+ read_only: true
131
+ tmpfs:
132
+ - /tmp
133
+ security_opt: [no-new-privileges:true]
134
+ restart: unless-stopped
135
+ logging:
136
+ driver: json-file
137
+ options: {max-size: 10m, max-file: '3'}
138
+
139
+ # Only with Jaeger traces. Its UI has no sign-in: published on 127.0.0.1 only; OTLP (4318) is
140
+ # reachable from this project's network only, never published.
141
+ jaeger:
142
+ image: jaegertracing/jaeger:2.22.0@sha256:836b967b5abcf1f7758066aa6b348619267a2f1459f72d472840570f9bd88a17
143
+ command: ['--config=env:JAEGER_YAML_${JAEGER_CONFIG:-memory}']
144
+ environment:
145
+ JAEGER_MAX_TRACES: ${JAEGER_MAX_TRACES:-50000}
146
+ JAEGER_TTL: ${JAEGER_TTL:-168h}
147
+ JAEGER_YAML_memory: *jaeger-memory
148
+ JAEGER_YAML_badger: *jaeger-badger
149
+ ports:
150
+ - '127.0.0.1:${JAEGER_UI_PORT:-16686}:16686'
151
+ expose:
152
+ - '4318'
153
+ volumes:
154
+ # The image's own volume, /tmp (writable by its user); Badger keeps its files there.
155
+ - jaeger-data:/tmp
156
+ read_only: true
157
+ security_opt: [no-new-privileges:true]
158
+ restart: unless-stopped
159
+ logging:
160
+ driver: json-file
161
+ options: {max-size: 10m, max-file: '3'}
162
+
163
+ volumes:
164
+ data:
165
+ jaeger-data:
@@ -7,6 +7,7 @@ export default class Dev extends Command {
7
7
  config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
8
  site: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
9
  content: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ image: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
11
  port: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
12
  watch: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
13
  'watch-polling': import("@oclif/core/interfaces").BooleanFlag<boolean>;
@@ -19,6 +20,8 @@ export default class Dev extends Command {
19
20
  run(): Promise<void>;
20
21
  /** The engine serves `dev`, local or remote. */
21
22
  private serveWithEngine;
23
+ /** Without the engine on this computer: the engine's `dev` in a throwaway container of the Foliwake image. */
24
+ private serveInDocker;
22
25
  /** Set by stopOnSignal(): settles when a signal has stopped the server. */
23
26
  private stopped;
24
27
  /** On Ctrl+C or SIGTERM: closes the listeners, waits for the work that runs, exits. */