@h-ai/deploy 1.0.0-beta.19 → 1.0.0-beta.20
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.en.md +59 -21
- package/README.ja.md +59 -19
- package/README.md +67 -25
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/README.en.md
CHANGED
|
@@ -2,17 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
[简体中文](README.md) | [English](README.en.md) | [日本語](README.ja.md)
|
|
4
4
|
|
|
5
|
-
## Introduction
|
|
6
|
-
|
|
7
5
|
Deploy existing images or Vercel prebuilt output, including complete offline bundles, selected service updates, SSH automation and platform upload scripts. The SDK consumes artifacts; CLI --build explicitly orchestrates build then deployment.
|
|
8
6
|
|
|
9
|
-
##
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
Run in an application created by the CLI with a configured deploy script. Inspect the read-only plan, verify the environment, destination and selected services, then build and deploy:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
pnpm run deploy --env prod --plan
|
|
13
|
+
pnpm run deploy --env prod --build
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The command returns a deployment URL or an offline delivery directory. On failure, check the safe message and local/remote execution states. Keep production credentials in `.env.prod.local` and prepare data backups and recovery before deployment. The sections below explain build, configuration and delivery boundaries.
|
|
17
|
+
|
|
18
|
+
## Features
|
|
10
19
|
|
|
11
20
|
- Build, package, upload over SSH, start services and check access from one CLI command.
|
|
12
21
|
- Include application and self-hosted middleware images, or update selected services.
|
|
13
22
|
- Deliver offline tar bundles with Windows/Linux/macOS operator scripts, step results and recovery on failure.
|
|
14
23
|
|
|
15
|
-
|
|
24
|
+
### Operations and results
|
|
25
|
+
|
|
26
|
+
Use the complete initialization flow in this section first. The host validates and authorizes example business values; check success before reading data from asynchronous domain results. Here void means completion without data, null means absent; synchronous factories/tools return the listed type directly.
|
|
27
|
+
|
|
28
|
+
#### deploy
|
|
29
|
+
|
|
30
|
+
Deployment: scan project/options yields a scan; provisionAll project/services yields provisioned resources; deployApp project/options yields URL/bundle/recovery receipts, checking success first.
|
|
31
|
+
|
|
32
|
+
| Entry | Input parameters | Successful result | Call example |
|
|
33
|
+
| --------------------- | --------------------- | ------------------- | ------------------------------------------------------------------------------------ |
|
|
34
|
+
| `deploy.scan` | appDir, options | `ScanResult` | `await deploy.scan('./apps/orders', { environment: 'prod' })` |
|
|
35
|
+
| `deploy.provisionAll` | projectName, services | `ProvisionResult[]` | `await deploy.provisionAll('orders', ['db', 'cache'])` |
|
|
36
|
+
| `deploy.deployApp` | appDir, options | `DeployResult` | `await deploy.deployApp('./apps/orders', { environment: 'prod', bundleOnly: true })` |
|
|
37
|
+
|
|
38
|
+
#### deploy.credentials
|
|
39
|
+
|
|
40
|
+
Local private credentials need no init: getPath returns path, load a HaiResult of loaded variable names; save/saveAll take key/value or mapping and yield void HaiResult without returning secrets for display.
|
|
41
|
+
|
|
42
|
+
| Entry | Input parameters | Successful result | Call example |
|
|
43
|
+
| ---------------------------- | ---------------- | ----------------- | --------------------------------------------------------------------- |
|
|
44
|
+
| `deploy.credentials.getPath` | No arguments | `string` | `deploy.credentials.getPath()` |
|
|
45
|
+
| `deploy.credentials.load` | No arguments | `string[]` | `deploy.credentials.load()` |
|
|
46
|
+
| `deploy.credentials.save` | key, value | `void` | `deploy.credentials.save('HAI_DEPLOY_PROVIDER_TOKEN', providerToken)` |
|
|
47
|
+
| `deploy.credentials.saveAll` | entries | `void` | `deploy.credentials.saveAll(privateCredentialEntries)` |
|
|
16
48
|
|
|
17
49
|
### Prepare build artifacts
|
|
18
50
|
|
|
@@ -35,9 +67,9 @@ Automation can select the exact build using `artifactDir` from `hai build --targ
|
|
|
35
67
|
|
|
36
68
|
#### Download sources and proxies
|
|
37
69
|
|
|
38
|
-
|
|
70
|
+
Image builds open an in-memory database to verify that the bundled native binary loads on the target platform.
|
|
39
71
|
|
|
40
|
-
`--image-source official|cn|custom` covers application base images and missing middleware images during packaging. `--npm-source` requires `--build` and controls Corepack/pnpm. The China preset uses 1ms for Docker Hub/GHCR and npmmirror for npm. First interactive choices are saved in `hai.json.build.sources`; flags override one invocation. Set `--proxy-mode inherit|system|custom|none`, `--proxy-url`, and `--proxy-bypass`; `--no-http-proxy` means none. Docker/remote Podman image pulls require engine-side proxy settings; build containers check connectivity separately. See [sources and proxies](../../docs/usage/configuration/delivery.md#下载源和代理) for custom sources
|
|
72
|
+
`--image-source official|cn|custom` covers application base images and missing middleware images during packaging. `--npm-source` requires `--build` and controls Corepack/pnpm. The China preset uses 1ms for Docker Hub/GHCR and npmmirror for npm. First interactive choices are saved in `hai.json.build.sources`; flags override one invocation. Set `--proxy-mode inherit|system|custom|none`, `--proxy-url`, and `--proxy-bypass`; `--no-http-proxy` means none. Docker/remote Podman image pulls require engine-side proxy settings; build containers check connectivity separately. See [sources and proxies](../../docs/usage/configuration/delivery.md#下载源和代理) for custom sources and supported platforms.
|
|
41
73
|
|
|
42
74
|
SDK `DeployAppOptions.imageSource` accepts `{ type: 'cn' }` or `{ type: 'custom', registries: { 'docker.io': 'mirror.example.com/docker.io', 'ghcr.io': 'mirror.example.com/ghcr.io' } }`; `proxy` accepts `{ mode: 'inherit' }` or `{ mode: 'custom', url: 'http://127.0.0.1:10808', bypass: 'localhost' }`. Defaults use official sources and inherited process proxies. `resolveImageReference()` / `resolveDownloadProxy()` need no init and do not change engine settings. Middleware archives preserve canonical references for offline server imports.
|
|
43
75
|
|
|
@@ -81,7 +113,7 @@ pnpm run deploy --env prod --build --bundle-only --image-source cn --npm-source
|
|
|
81
113
|
|
|
82
114
|
Each image has its own Dockerfile. Web runtime assets live in images/web/. Dockerfiles retain internal build/runtime stages; configuration does not select stages. Omit absent images and add desktop directories only for native projects.
|
|
83
115
|
|
|
84
|
-
Set `transport.maxPlaintextBytes` for both request and response JSON plaintext, measured in UTF-8 bytes: default 1 MiB, integer range 1 KiB–64 MiB. Clients learn the server limit during key exchange. `resolveTransportBodyLimits()` derives encrypted/proxy bytes as twice the plaintext limit plus 32 KiB. Handshake, public-key, header and replay constraints remain independent. Oversized streams are cancelled and readers released: requests return 413; oversized responses return an encrypted 500 capacity error, recognized as `TransportBodyTooLargeError` / `hai:crypto:070`. Full and serv-only incremental deployments derive the proxy limit from resolved `_serv.yml`. Capacity changes recreate the proxy using its installed Web image and restore the prior configuration on health failure. SvelteKit deployments also derive adapter-node `BODY_SIZE_LIMIT` from `_kit.yml`. [Transport capacity
|
|
116
|
+
Set `transport.maxPlaintextBytes` for both request and response JSON plaintext, measured in UTF-8 bytes: default 1 MiB, integer range 1 KiB–64 MiB. Clients learn the server limit during key exchange. `resolveTransportBodyLimits()` derives encrypted/proxy bytes as twice the plaintext limit plus 32 KiB. Handshake, public-key, header and replay constraints remain independent. Oversized streams are cancelled and readers released: requests return 413; oversized responses return an encrypted 500 capacity error, recognized as `TransportBodyTooLargeError` / `hai:crypto:070`. Full and serv-only incremental deployments derive the proxy limit from resolved `_serv.yml`. Capacity changes recreate the proxy using its installed Web image and restore the prior configuration on health failure. SvelteKit deployments also derive adapter-node `BODY_SIZE_LIMIT` from `_kit.yml`. [Transport capacity](../crypto/TRANSPORT-CAPACITY.md).
|
|
85
117
|
|
|
86
118
|
Bodyless authenticated envelopes use X-Hai-Transport. Generated proxies set large_client_header_buffers 4 32k and proxy_buffer_size 32k to admit these headers; custom proxies must preserve and admit them.
|
|
87
119
|
|
|
@@ -105,10 +137,6 @@ For a gateway that only exposes `/somepath/`, build with `PUBLIC_BASE_PATH=/some
|
|
|
105
137
|
|
|
106
138
|
Artifact formats 4 and 5 record primaryService (serv/web); hasWeb describes the complete browser topology. Format 5 also records a non-root webBasePath. Only serv + web generates a same-origin API proxy. Rebuild artifacts using formats 1–3. Back up the existing deployment and verify project identity, volumes and managed credentials before establishing a new full deployment baseline. Tools do not migrate data across projects. Full deployments still remove obsolete service containers under the same Compose project; editing deploy-target.json.directory alone does not migrate resources.
|
|
107
139
|
|
|
108
|
-
For existing projects, update build.images names in hai.json, Dockerfile filenames and references first. Rename API service directories/packages and dependent references to -serv, then reinstall dependencies and build a complete artifact. Renaming archives or editing manifest files does not replace a new build.
|
|
109
|
-
|
|
110
|
-
The CLI --project-name option and SDK DeployAppOptions.projectName override have been removed. Obsolete overrides fail explicitly; maintain resource identity in the root package.json.name.
|
|
111
|
-
|
|
112
140
|
Prepare `.env.<environment>` and the project root `hai.json`, with image/native configuration in `build` and application deployment in `deploy`. Fullstack scripts still point to packages/<project>-serv, and API workspaces to apps/<project>-serv, only to scan runtime dependencies and module YAML. Frontend and backend share the project configuration.
|
|
113
141
|
|
|
114
142
|
`deploy` supports `${VARIABLE:fallback}` and hierarchical `HAI_DEPLOY_*` overrides, including whole JSON objects. Known SSH leaf fields can also create an omitted SSH node. A parent object from a higher-priority source overrides lower-source leaves; leaves take precedence within the same source. SSH text stays verbatim, including numeric passwords, leading zeros and surrounding spaces.
|
|
@@ -121,10 +149,6 @@ Public settings live in `.env` and `.env.<mode>`; SSH settings and credentials g
|
|
|
121
149
|
|
|
122
150
|
All custom HTTP API headers are treated as private values regardless of header names. Saving an existing environment also moves indented, `export` and multiline quoted entries out of the same-mode public file, so their previous values are not left behind.
|
|
123
151
|
|
|
124
|
-
For existing projects, move the previous build object into `hai.json.build`, convert deployment YAML into `hai.json.deploy`, remove the old files and retain `HAI_DEPLOY_*` variables. Existing self-hosted S3 installations must use a full deployment for this upgrade: their old baseline contains an exited initialization service, which fails the dependency checks of new incremental packages. The full deployment also refreshes the `createBucket` middleware setting; subsequent incremental updates work normally.
|
|
125
|
-
|
|
126
|
-
The CLI --project-name option and SDK DeployAppOptions.projectName override have been removed. Obsolete overrides fail explicitly; maintain resource identity in the root package.json.name.
|
|
127
|
-
|
|
128
152
|
For direct deployment, the wizard asks for missing server, SSH user, authentication and port settings using readable labels. Complete valid settings are reused, including with `--yes`. SSH accepts `auth: key` (private key/agent) or `auth: password`. Without `auth`, only a nonempty `password` selects password authentication; otherwise key/agent remains in use. Explicit `key` ignores a leftover password. Password input is hidden and preserves surrounding spaces and leading zeros. Effective passwords must not contain CR/LF/NUL and must fit within 1023 UTF-8 bytes. Private keys are referenced by path; their contents are never read or copied.
|
|
129
153
|
|
|
130
154
|
SSH settings are saved in `.env.<environment>.local`. `--bundle-only` offers to add or update SSH settings as the last interaction after builds and middleware configuration, before packaging. It saves them in the same private file and uses them for the current and subsequent `deploy-target.json` files. Declining reuses existing settings; missing fields can still be filled in the target before upload. `--yes` reuses settings without prompting. Editing a bundle's target affects that bundle only and never writes back to the project. New bundles use the project's saved environment configuration.
|
|
@@ -181,7 +205,7 @@ On isolated Linux servers, copy the delivery directory and run `sh deploy-local.
|
|
|
181
205
|
|
|
182
206
|
The bundle `manifest.json` records `partial` and `selectedServices`, and the apply script embeds the same choice. A complete build without `--services` is a full deployment; explicit service selection or a partial build is incremental. Incremental packages require a matching successful `current` baseline and cannot perform a first installation.
|
|
183
207
|
|
|
184
|
-
The server holds a nonblocking kernel lock with util-linux `flock` on `.deploy.lock` in the deployment root, throughout deployment and recovery. Normal foreground deployment and synchronous failure recovery explicitly unlock after finalization and terminal-result publication, so background services do not block later deployments. Keep this file permanently: never delete, replace or steal it based on elapsed time, and use a filesystem that supports `flock`. On HUP/INT/TERM or a killed parent shell, active child commands retain the inherited lock until every holder exits or the server restarts.
|
|
208
|
+
The server holds a nonblocking kernel lock with util-linux `flock` on `.deploy.lock` in the deployment root, throughout deployment and recovery. Normal foreground deployment and synchronous failure recovery explicitly unlock after finalization and terminal-result publication, so background services do not block later deployments. Keep this file permanently: never delete, replace or steal it based on elapsed time, and use a filesystem that supports `flock`. On HUP/INT/TERM or a killed parent shell, active child commands retain the inherited lock until every holder exits or the server restarts. Forced termination or power loss skips recovery traps. Without a result file, execution is unknown: inspect containers, images and the successful `current` baseline before recovering with a new bundle. An unlocked file does not prove success or rolled-back effects.
|
|
185
209
|
|
|
186
210
|
#### Failure recovery and reverting a successful release
|
|
187
211
|
|
|
@@ -255,6 +279,8 @@ finally {
|
|
|
255
279
|
|
|
256
280
|
`selectedServices: ['web']` selects a partial update. `onProgress` receives actual packaging/server stages. `deploy.scan` and `deploy.credentials.*` are available before init. Check HaiResult.success before using data. Vercel uploads existing .vercel/output through the prebuilt API and requires internet; it does not provide offline or Compose partial deployment.
|
|
257
281
|
|
|
282
|
+
Vercel API requests and file uploads use the official endpoint, reject redirects and share a 30-second deadline per request, including complete JSON response reads. There is no new configuration option. A timeout does not prove that the platform rejected a deployment; check its actual status before deciding whether to publish again.
|
|
283
|
+
|
|
258
284
|
Command execution redacts correctly decoded UTF-8 logical streams, including known secrets split across stdout/stderr chunks. Successful captures, errors and output callbacks use the same boundary. Internal command callers must enumerate sensitive literals in `secrets`, including separately encoded or transformed forms. Each stream captures only its last 1 Mi characters by default; `maxCaptureChars` accepts 1 through 16 Mi characters. Check `stdoutTruncated` / `stderrTruncated` before parsing structured output. Async `onOutput` callbacks receive all safe stdout in order with pipe backpressure; deployment progress parses only the first 512 characters of each line. Total secret length is limited to 1 Mi UTF-16 units; invalid redaction fails closed. A timeout reports failure; remote process termination still requires confirmation.
|
|
259
285
|
|
|
260
286
|
Command deadlines include helper startup and output handling. Timeouts, input/output errors and callback failures terminate managed processes. POSIX uses a separate process group. Windows uses an embedded PowerShell/.NET Job Object: create suspended, assign successfully, then resume, with no breakaway. Helper, compilation or assignment failure never falls back to an unmanaged process. System PowerShell and Add-Type are required on Windows; execution is hidden without user profiles, preserving arguments, environment and UTF-8 pipes. POSIX commands must keep descendants in the inherited group; detached system daemons and remote services are outside local termination confirmation.
|
|
@@ -265,7 +291,7 @@ SSH interruptions initially report `remoteExecution: 'unknown'`. The docker-ssh
|
|
|
265
291
|
|
|
266
292
|
### Runtime environment files and repeated deployments
|
|
267
293
|
|
|
268
|
-
SvelteKit SSR uses a separate `gateway` for HTTP and HTTPS, without publishing the backend port. The gateway overwrites standard forwarding headers, and Compose fixes the adapter's protocol, Host and client address trust settings; the application runtime file cannot override them. adapter
|
|
294
|
+
SvelteKit SSR uses a separate `gateway` for HTTP and HTTPS, without publishing the backend port. The gateway overwrites standard forwarding headers, and Compose fixes the adapter's protocol, Host and client address trust settings; the application runtime file cannot override them. The adapter does not read runtime `ORIGIN`; applications leave build-time `paths.origin` unset by default. Changes to the SSR ingress topology require a full bundle.
|
|
269
295
|
|
|
270
296
|
For upstream TLS termination, list the load balancer's actual IPs/CIDRs in `trustedEdgeProxies`. The separate gateway accepts a single `http` or `https` protocol only from those actual peers; other sources and combined values use its own connection scheme. External `Forwarded` and forwarded host/port values are overwritten.
|
|
271
297
|
|
|
@@ -299,7 +325,7 @@ Project-root `hai.json.deploy` stores deployment structure, `.env.<environment>`
|
|
|
299
325
|
|
|
300
326
|
The server persists managed middleware passwords in `<remoteDir>/managed-secrets.env` (mode 0600); back it up with data volumes. Each package supplies random first-use candidates without a build-machine cache. The online SDK, deploy.sh, deploy.ps1 and deploy-local.sh resolve server values under the deployment lock and update both application connections and native middleware variables. The delivery tar stays immutable; only private server runtime files receive resolved values. Missing state with an existing corresponding volume stops deployment before services change: restore the server credential backup. Deployment never silently rotates passwords or deletes data. Legacy credentials can be explicitly verified and imported using the procedure below.
|
|
301
327
|
|
|
302
|
-
|
|
328
|
+
### Read-only deployment plan
|
|
303
329
|
|
|
304
330
|
`createDeploymentPlan(appDir, config, options)` initializes no provider, generates no credentials/output and connects to no target. It shares real scanning, environment resolution, resource naming and artifact checksums, reporting project `root`, service source/configuration `serviceDir`, versions, build ID, selected/retained services, source files/key names, baseline requirements and recovery paths without values or SSH credentials. Unread remote current is not-inspected; execution still strictly requires a successful baseline for partial updates. Compose recovery does not undo database changes/migrations. CLI: `hai deploy --env prod --plan`.
|
|
305
331
|
|
|
@@ -307,13 +333,13 @@ Use `--plan --inspect-remote` (SDK inspectRemote:true) to read current and the s
|
|
|
307
333
|
|
|
308
334
|
Resources use the complete execution topology. `containers` lists selected explicit container names; Compose-named LDAP/SMTP services appear in `composeManagedServices`. The SSR/API storage gateway appears in the actual selected or retained scope. `logicalVolumes` declares the complete Compose topology, including retained services and data volumes still mounted by the app; it does not mean those volumes will be created or replaced. Engine names are scoped by the Compose project. Unselected middleware has action keep, and cloud provisioning follows the actual selection without exposing credentials.
|
|
309
335
|
|
|
310
|
-
|
|
336
|
+
### Capacity and credential import
|
|
311
337
|
|
|
312
338
|
Explicit plaintext limits are preserved. Packaging rejects feedback requirements above an explicit limit with a configuration conflict. Omitted/auto values derive capacity; the Web proxy and Kit BODY_SIZE_LIMIT use the same encrypted budget. Plan target.runtime reports remote provider.remote.runtime separately from local packaging options.runtime; auto is not a detected runtime.
|
|
313
339
|
|
|
314
340
|
Use `importDeploymentSecrets({ directory, inputFile, runtime })` or run `hai deploy-secrets <directory> --import <private.json>` on the server for read-only verification. Only explicit `--apply` / dryRun:false imports state. The tool verifies projects, containers, volumes and live credentials; it never infers passwords from old bundles, rotates credentials or rebuilds services. V2 state supports special characters and is atomically written with mode 0600 under the deployment flock. Ordinary offline deployment still requires no server Node; this one-time import tool needs supported Node and installed CLI/deploy. See the [import and recovery procedure](docs/credential-import.en.md).
|
|
315
341
|
|
|
316
|
-
|
|
342
|
+
### Request policy files and trusted proxies
|
|
317
343
|
|
|
318
344
|
Serv `http.access` and SvelteKit `access` can reference separate yml/yaml files. Deployment reads effective application configuration, including environment overrides such as `HAI_SERV`, `HAI_SERV_HTTP_ACCESS` and `HAI_KIT_ACCESS`, validates the file and includes a normalized snapshot in the bundle. Runtime configuration points to `/run/hai/request-access.yml` with a read-only Compose mount. The project retains its original file reference. The snapshot participates in SHA-256 verification; missing or invalid files fail before upload. The upload archive and its policy snapshot are integrity-checked inputs; replacing the SDK-managed snapshot requires a new bundle and deployment. The deployed Node backend reads its mounted `.env.runtime` on restart as described above. Inline rule changes do not rewrite the policy snapshot or Nginx configuration.
|
|
319
345
|
|
|
@@ -323,7 +349,19 @@ For operator-managed rules that reload on restart, manage a read-only file outsi
|
|
|
323
349
|
|
|
324
350
|
Managed Compose sets `HAI_DEPLOY_PRIVATE_PROXY=1` only when a Web/gateway proxy fronts a backend without public ports. Serv/Kit default `trustedProxies: auto` uses container networks there and ignores forwarded headers on other hosts. Generated Nginx overwrites client-supplied forwarding headers with the actual peer. For an upstream load balancer, explicitly set Docker SSH Provider `trustedEdgeProxies` to its IPs/CIDRs; omitting it trusts no upstream, and `[]` explicitly selects the same behavior. Source addresses lost before Nginx cannot be reconstructed, including some rootless forwarding environments. See the [request access handbook](../../docs/usage/configuration/request-access.md) for examples and verification.
|
|
325
351
|
|
|
326
|
-
##
|
|
352
|
+
## Configuration
|
|
353
|
+
|
|
354
|
+
Lifecycle: init takes backend/business configuration; use the module only after success. Await close before releasing borrowed dependencies. Follow the quick-start example and public signatures for exact return values.
|
|
355
|
+
|
|
356
|
+
The host loads and validates configuration before passing it to this module. Keep secrets in private server environment files. Select the backend, capacity, deadlines and logging for the actual use case; reinitialize and check the result after changes.
|
|
357
|
+
|
|
358
|
+
[Per-option purpose, use cases and examples](../../docs/usage/configuration/delivery.md).
|
|
359
|
+
|
|
360
|
+
## Error Handling
|
|
361
|
+
|
|
362
|
+
Check result.success for domain operations. Handle failures with the module error definitions and safe messages; retain codes, correlation IDs and sanitized causes in server logs. Synchronous tools, factories, stream iteration and lifecycle calls follow their own signatures. A completed Promise alone is not business success. See each feature for recovery limits.
|
|
363
|
+
|
|
364
|
+
## Development
|
|
327
365
|
|
|
328
366
|
```sh
|
|
329
367
|
pnpm --filter @h-ai/deploy typecheck
|
package/README.ja.md
CHANGED
|
@@ -2,17 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
[简体中文](README.md) | [English](README.en.md) | [日本語](README.ja.md)
|
|
4
4
|
|
|
5
|
-
## 概要
|
|
6
|
-
|
|
7
5
|
既存イメージまたは Vercel prebuilt 成果物を配布します。完全オフライン、サービス選択、SSH 自動化、OS 別の手動配布スクリプトに対応します。SDK は成果物を消費し、CLI --build は構築から配布を明示的に実行します。
|
|
8
6
|
|
|
9
|
-
##
|
|
7
|
+
## クイックスタート
|
|
8
|
+
|
|
9
|
+
CLI で作成し deploy スクリプトを設定した工程のルートで実行します。読取専用計画で環境・対象・サービスを確認してからビルドと配布を行います。
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
pnpm run deploy --env prod --plan
|
|
13
|
+
pnpm run deploy --env prod --build
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
配布 URL またはオフライン成果物のディレクトリーを返します。失敗時は安全な説明とローカル/リモートの実行状態を確認してください。本番資格情報は `.env.prod.local` に保存し、事前にデータのバックアップと回復手順を準備します。以下で構築・設定・配布の範囲を説明します。
|
|
17
|
+
|
|
18
|
+
## 機能
|
|
10
19
|
|
|
11
20
|
- CLI でビルド、梱包、SSH 転送、起動、アクセス確認を実行。
|
|
12
21
|
- アプリと自前ミドルウェアのイメージを同梱し、選択したサービスだけの更新にも対応。
|
|
13
22
|
- オフライン用 tar と Windows/Linux/macOS 操作スクリプトを生成し、手順の結果と失敗時の復元を扱う。
|
|
14
23
|
|
|
15
|
-
|
|
24
|
+
### 操作と入出力
|
|
25
|
+
|
|
26
|
+
本節の完全な初期化手順を先に実行します。例の業務値はホストが検証・認可し、非同期領域結果は success を確認してから data を読みます。void はデータなし完了、null は不存在、同期ファクトリー/ツールは表の型を直接返します。
|
|
27
|
+
|
|
28
|
+
#### deploy
|
|
29
|
+
|
|
30
|
+
配布。scan は工程/指定から走査結果、provisionAll は工程名/サービスから開通配列、deployApp は工程/指定から URL・パッケージ・回復情報。先に成否確認。
|
|
31
|
+
|
|
32
|
+
| 入口 | 入力引数 | 成功結果 | 呼出し例 |
|
|
33
|
+
| --------------------- | --------------------- | ------------------- | ------------------------------------------------------------------------------------ |
|
|
34
|
+
| `deploy.scan` | appDir, options | `ScanResult` | `await deploy.scan('./apps/orders', { environment: 'prod' })` |
|
|
35
|
+
| `deploy.provisionAll` | projectName, services | `ProvisionResult[]` | `await deploy.provisionAll('orders', ['db', 'cache'])` |
|
|
36
|
+
| `deploy.deployApp` | appDir, options | `DeployResult` | `await deploy.deployApp('./apps/orders', { environment: 'prod', bundleOnly: true })` |
|
|
37
|
+
|
|
38
|
+
#### deploy.credentials
|
|
39
|
+
|
|
40
|
+
ローカル非公開資格情報は初期化不要。getPath はパス、load は読込変数名 HaiResult、save/saveAll はキー値/対応から void HaiResult。秘密を表示用に返さない。
|
|
41
|
+
|
|
42
|
+
| 入口 | 入力引数 | 成功結果 | 呼出し例 |
|
|
43
|
+
| ---------------------------- | ---------- | ---------- | --------------------------------------------------------------------- |
|
|
44
|
+
| `deploy.credentials.getPath` | 引数なし | `string` | `deploy.credentials.getPath()` |
|
|
45
|
+
| `deploy.credentials.load` | 引数なし | `string[]` | `deploy.credentials.load()` |
|
|
46
|
+
| `deploy.credentials.save` | key, value | `void` | `deploy.credentials.save('HAI_DEPLOY_PROVIDER_TOKEN', providerToken)` |
|
|
47
|
+
| `deploy.credentials.saveAll` | entries | `void` | `deploy.credentials.saveAll(privateCredentialEntries)` |
|
|
16
48
|
|
|
17
49
|
### 4. ソースをコンパイルし、配布物を作る
|
|
18
50
|
|
|
@@ -35,9 +67,9 @@ pnpm build --target desktop --platform windows --arch x64
|
|
|
35
67
|
|
|
36
68
|
#### 取得元とプロキシ
|
|
37
69
|
|
|
38
|
-
|
|
70
|
+
イメージ構築時にインメモリデータベースを開き、同梱されたネイティブバイナリーが対象環境で読み込めることを検証します。
|
|
39
71
|
|
|
40
|
-
`--image-source official|cn|custom` はアプリのベースと梱包時に不足したミドルウェアイメージに適用します。`--npm-source` は `--build` と併用し Corepack/pnpm を制御します。中国本土は毫秒镜像の Docker Hub/GHCR 通道と npmmirror を使用します。初回対話で `hai.json.build.sources` に保存し、引数は今回のみ上書きします。プロキシは `--proxy-mode inherit|system|custom|none`、`--proxy-url`、`--proxy-bypass` で指定し、`--no-http-proxy` は none と同じです。Docker/リモート Podman
|
|
72
|
+
`--image-source official|cn|custom` はアプリのベースと梱包時に不足したミドルウェアイメージに適用します。`--npm-source` は `--build` と併用し Corepack/pnpm を制御します。中国本土は毫秒镜像の Docker Hub/GHCR 通道と npmmirror を使用します。初回対話で `hai.json.build.sources` に保存し、引数は今回のみ上書きします。プロキシは `--proxy-mode inherit|system|custom|none`、`--proxy-url`、`--proxy-bypass` で指定し、`--no-http-proxy` は none と同じです。Docker/リモート Podman の取得はエンジン側の設定が必要で、ビルドコンテナの接続は別途確認します。カスタム設定と対応 OS は[取得元とプロキシ](../../docs/usage/configuration/delivery.md#下载源和代理)を参照してください。
|
|
41
73
|
|
|
42
74
|
SDK の `DeployAppOptions.imageSource` は `{ type: 'cn' }` または `{ type: 'custom', registries: { 'docker.io': 'mirror.example.com/docker.io', 'ghcr.io': 'mirror.example.com/ghcr.io' } }`、`proxy` は `{ mode: 'inherit' }` または `{ mode: 'custom', url: 'http://127.0.0.1:10808', bypass: 'localhost' }` です。既定は公式とプロセスの継承です。`resolveImageReference()`/`resolveDownloadProxy()` は init 不要でエンジン設定を変更しません。ミドルウェアの元参照をアーカイブに保ち、サーバーではオフラインで読み込みます。
|
|
43
75
|
|
|
@@ -81,7 +113,7 @@ pnpm run deploy --env prod --build --bundle-only --image-source cn --npm-source
|
|
|
81
113
|
|
|
82
114
|
各イメージに独立した Dockerfile を用意します。Web 用設定は images/web/ に置きます。Dockerfile 内の構築・実行段階は維持しますが、設定から段階を選びません。不要なイメージ項目は削除し、desktop ディレクトリは対象プロジェクトのみ設定します。
|
|
83
115
|
|
|
84
|
-
`transport.maxPlaintextBytes` でリクエストとレスポンスの JSON 平文容量を共通設定します。単位は UTF-8 バイト、既定値は 1 MiB、有効範囲は 1 KiB~64 MiB の整数です。クライアントは鍵交換で上限を取得し、`resolveTransportBodyLimits()` が暗号文とプロキシ容量(平文の 2 倍 + 32 KiB)を算出します。鍵交換、公開鍵、認証ヘッダー、防リプレイ制約は独立です。超過時は元ストリームを停止して reader を解放します。要求は 413、応答は暗号化された 500 容量エラーとなり、`TransportBodyTooLargeError` / `hai:crypto:070` で識別できます。 全量と app の増分デプロイは同じ `_serv.yml` からプロキシ上限を算出します。容量変更時は既存 Web イメージでプロキシを再作成し、ヘルスチェック失敗時は旧設定を復元します。SvelteKit の adapter-node `BODY_SIZE_LIMIT` も `_kit.yml` から算出します。 [Transport capacity
|
|
116
|
+
`transport.maxPlaintextBytes` でリクエストとレスポンスの JSON 平文容量を共通設定します。単位は UTF-8 バイト、既定値は 1 MiB、有効範囲は 1 KiB~64 MiB の整数です。クライアントは鍵交換で上限を取得し、`resolveTransportBodyLimits()` が暗号文とプロキシ容量(平文の 2 倍 + 32 KiB)を算出します。鍵交換、公開鍵、認証ヘッダー、防リプレイ制約は独立です。超過時は元ストリームを停止して reader を解放します。要求は 413、応答は暗号化された 500 容量エラーとなり、`TransportBodyTooLargeError` / `hai:crypto:070` で識別できます。 全量と app の増分デプロイは同じ `_serv.yml` からプロキシ上限を算出します。容量変更時は既存 Web イメージでプロキシを再作成し、ヘルスチェック失敗時は旧設定を復元します。SvelteKit の adapter-node `BODY_SIZE_LIMIT` も `_kit.yml` から算出します。 [Transport capacity](../crypto/TRANSPORT-CAPACITY.md).
|
|
85
117
|
|
|
86
118
|
本文なし認証封装には X-Hai-Transport を使います。生成設定は large_client_header_buffers 4 32k と proxy_buffer_size 32k を指定します。独自プロキシもこのヘッダーを保持し、通過させてください。
|
|
87
119
|
|
|
@@ -91,7 +123,7 @@ pnpm run deploy --env prod --build --bundle-only --image-source cn --npm-source
|
|
|
91
123
|
|
|
92
124
|
#### サイトの公開ディレクトリー
|
|
93
125
|
|
|
94
|
-
`/somepath/` のみを公開する場合、`PUBLIC_BASE_PATH=/somepath` でビルドし、Serv の `http.apiPrefix`、ヘルス/準備確認、ドキュメントとストレージ `publicEndpoint` を同じディレクトリに明示設定します。SDK は実効設定からプロキシとブラウザ API アドレスを生成します。外側では接頭辞を保持し、内部プローブとルートの ACME 検証は別に扱います。[設定と検証](../../docs/usage/configuration/delivery.md#所有对外业务路径必须带同一目录)
|
|
126
|
+
`/somepath/` のみを公開する場合、`PUBLIC_BASE_PATH=/somepath` でビルドし、Serv の `http.apiPrefix`、ヘルス/準備確認、ドキュメントとストレージ `publicEndpoint` を同じディレクトリに明示設定します。SDK は実効設定からプロキシとブラウザ API アドレスを生成します。外側では接頭辞を保持し、内部プローブとルートの ACME 検証は別に扱います。[設定と検証](../../docs/usage/configuration/delivery.md#所有对外业务路径必须带同一目录).
|
|
95
127
|
|
|
96
128
|
既定はサイトルートです。`https://example.com/yyy/`で公開する場合は、アプリ構築プロセスで`PUBLIC_BASE_PATH=/yyy`を明示します。CLIは形式5を生成し、webBasePathを保存します。これは構築情報であり、デプロイ環境で上書きする設定ではありません。各区間はASCII英数字・`_`・`.`・`-`のみ、末尾の斜線や単独の`.`/`..`区間は使用できません。形式5対応のCLI/Deployが必要で、旧ツールは拒否します。形式番号を手で変更しないでください。
|
|
97
129
|
|
|
@@ -105,10 +137,6 @@ SDKは対応するNginx、実行時設定URL、SSRヘルスチェック、公開
|
|
|
105
137
|
|
|
106
138
|
成果物形式4・5はprimaryService(serv/web)と、工程全体のブラウザー構成を示すhasWebを記録します。形式5には非ルートのwebBasePathも含まれます。同一オリジンAPIプロキシはserv + webの場合だけ生成します。形式1~3は再構築が必要です。既存デプロイをバックアップし、プロジェクト名・ボリューム・管理対象の認証情報を確認してから、新しい完全デプロイの基準を作成してください。プロジェクト間のデータ移行は自動化しません。完全デプロイでは同じComposeプロジェクトの旧サービスコンテナーを削除するため、deploy-target.json.directoryの変更だけでは移行できません。
|
|
107
139
|
|
|
108
|
-
既存工程では、hai.json の build.images 名、Dockerfile 名と参照を先に更新します。API サービスのディレクトリ、パッケージ名と依存参照を -serv に統一し、依存を再インストールして完全な成果物を再構築してください。アーカイブ名や manifest の手動変更では再構築を代替できません。
|
|
109
|
-
|
|
110
|
-
CLI の --project-name と SDK の DeployAppOptions.projectName 上書きは廃止しました。旧引数は明示的に失敗します。工程ルートの package.json.name で識別名を管理してください。
|
|
111
|
-
|
|
112
140
|
`.env.<環境>` とプロジェクトルートの `hai.json` を用意します。`build` にイメージ・ネイティブ構築、`deploy` にアプリ全体の配置設定を保存します。fullstack は packages/<プロジェクト>-serv、API workspace は apps/<プロジェクト>-serv を実行依存とモジュール YAML の走査入口として使います。フロントとバックエンドは同じ設定を共有します。
|
|
113
141
|
|
|
114
142
|
`deploy` は `${変数:既定値}` と `HAI_DEPLOY_*` による階層的な上書き(JSON オブジェクト全体も可)をサポートします。省略された SSH ノードも Schema で定義済みの末端フィールドから補えます。優先度の高いソースの親オブジェクトは下位ソースの末端値より優先され、同一ソースでは末端値が優先されます。SSH の文字列は数値パスワード、先頭のゼロ、前後の空白もそのまま保持します。
|
|
@@ -121,8 +149,6 @@ CLI の --project-name と SDK の DeployAppOptions.projectName 上書きは廃
|
|
|
121
149
|
|
|
122
150
|
HTTP API のカスタムヘッダーは名前にかかわらず全体を秘密値として扱います。既存環境の保存時は、インデント、`export`、複数行の引用値も同じモードの公開ファイルから非公開ファイルへ移し、以前の値を残しません。
|
|
123
151
|
|
|
124
|
-
既存プロジェクトは旧構築オブジェクトを `hai.json.build`、旧配置 YAML を JSON に変換して `hai.json.deploy` に移し、元のファイルを削除します。`HAI_DEPLOY_*` は継続利用できます。既存の自前 S3 は今回の初回更新で全量配置が必要です。旧基準には終了済みの初期化サービスが残っており、新しい増分パッケージの依存稼働チェックで拒否されます。全量配置で `createBucket` 設定も更新した後は増分更新を継続できます。
|
|
125
|
-
|
|
126
152
|
直接デプロイでは、サーバー、SSH ユーザー、認証方式、ポートなどの不足項目を説明付きで質問します。有効で完全な設定は `--yes` でも再利用し、再入力を求めません。SSH は `auth: key`(秘密鍵/agent)と `auth: password` に対応します。`auth` を省略した場合、空でない `password` があるときだけパスワード認証を使い、それ以外は key/agent を維持します。明示した `key` は残存パスワードを無視します。パスワード入力は非表示で、前後の空白と先頭のゼロを保持します。有効なパスワードは CR/LF/NUL を含まず、UTF-8 で 1023 バイト以内である必要があります。秘密鍵はパスのみ参照し、内容を読み取り・コピーしません。
|
|
127
153
|
|
|
128
154
|
SSH 設定は選択環境の `.env.<環境>.local` に保存します。`--bundle-only` は構築・ミドルウェア設定後、梱包前の最後の対話で SSH 設定の追加・変更を確認します。同じ非公開ファイルに保存し、今回と次回以降の `deploy-target.json` に反映します。スキップすると既存設定を再利用し、不足項目はアップロード前に target へ補えます。`--yes` は質問せず再利用します。target の変更はその配布物だけに適用され、プロジェクトには書き戻しません。新しい配布物は保存済みの環境設定から生成します。
|
|
@@ -179,7 +205,7 @@ pnpm run deploy --env prod --build --bundle-only
|
|
|
179
205
|
|
|
180
206
|
パッケージの `manifest.json` の `partial` と `selectedServices`、実行スクリプトに配置モードと対象を記録します。完全な構築で `--services` を省略すると全量、明示的なサービス選択または部分構築では増分です。増分にはサーバーの成功済み `current` と一致する基準が必要で、初回インストールは拒否します。
|
|
181
207
|
|
|
182
|
-
サーバーは util-linux の `flock` で配置ルートの `.deploy.lock` に非ブロッキングのカーネルロックを取得し、復元処理の終了まで保持します。通常の前景配置と同期の失敗復元は、後処理と終端結果の公開後に明示解放し、背景サービスの稼働は次の配置を妨げません。このファイルは残し、削除・置換・経過時間による横取りをしないでください。対応するファイルシステムが必要です。HUP/INT/TERM または親 shell の強制終了時は、記述子を継承した実行中の子コマンドが全 holder
|
|
208
|
+
サーバーは util-linux の `flock` で配置ルートの `.deploy.lock` に非ブロッキングのカーネルロックを取得し、復元処理の終了まで保持します。通常の前景配置と同期の失敗復元は、後処理と終端結果の公開後に明示解放し、背景サービスの稼働は次の配置を妨げません。このファイルは残し、削除・置換・経過時間による横取りをしないでください。対応するファイルシステムが必要です。HUP/INT/TERM または親 shell の強制終了時は、記述子を継承した実行中の子コマンドが全 holder の終了かサーバー再起動までロックを保持します。強制終了・停電では復元 trap が動きません。結果ファイルがなければ実行状態は不明です。コンテナー、イメージ、成功した `current` を確認して新しいパッケージで復旧してください。ロック解放は成功や副作用の取消を意味しません。
|
|
183
209
|
|
|
184
210
|
#### 失敗時の復元と公開後のロールバック
|
|
185
211
|
|
|
@@ -253,6 +279,8 @@ finally {
|
|
|
253
279
|
|
|
254
280
|
`selectedServices: ['web']` は部分更新を選択し、`onProgress` はパッケージ作成とサーバー実行の段階を通知します。`deploy.scan` と `deploy.credentials.*` は初期化前も使用できます。HaiResult.success を確認してからデータを読み取ります。Vercel は既存 .vercel/output を prebuilt API でアップロードするためネット接続が必要で、オフラインや Compose の部分公開には対応しません。
|
|
255
281
|
|
|
282
|
+
Vercel API とファイル転送は公式エンドポイントのみを使用し、リダイレクトを拒否します。各リクエストと JSON 応答の全体読込は共通の 30 秒期限に従い、設定項目は追加しません。タイムアウトだけでは配布未受理を断定できないため、再公開の前にプラットフォーム上の状態を確認してください。
|
|
283
|
+
|
|
256
284
|
コマンド出力は正しく UTF-8 デコードした論理ストリーム単位で秘匿し、stdout/stderr のチャンク境界をまたぐ既知の秘密も保護します。成功結果、エラー、出力コールバックは同じ境界を使います。内部コマンドの `secrets` に機密リテラルを指定し、変換・エンコードした値も別途指定してください。各ストリームは既定で末尾 1 Mi 文字を保持し、`maxCaptureChars` は 1~16 Mi 文字です。構造化出力の解析前に `stdoutTruncated` / `stderrTruncated` を確認します。非同期 `onOutput` を順に待ち pipe の背圧を保ち、安全な stdout 全体を渡します。進捗解析は各行の先頭 512 文字のみです。秘密の合計上限は UTF-16 で 1 Mi 単位、秘匿失敗は処理失敗とします。タイムアウトだけでリモートプロセスの終了を断定せず、終了を確認してください。
|
|
257
285
|
|
|
258
286
|
コマンド期限は helper 起動と出力処理を含みます。タイムアウト、入出力・コールバック失敗時は管理対象プロセスを終了します。POSIX は独立したプロセスグループ、Windows は内嵌 PowerShell/.NET Job Object を使い、停止状態で作成して割当成功後だけ再開します。breakaway は許可せず、helper・コンパイル・割当失敗時に裸のプロセスへ切り替えません。Windows はシステム PowerShell と Add-Type が必要です。非表示で profile を読み込まず、引数・環境・UTF-8 pipe を保持します。POSIX の子孫は同じグループを継承してください。独立したシステム daemon と遠隔サービスはローカル終了確認の対象外です。
|
|
@@ -263,7 +291,7 @@ SSH 中断は最初に `remoteExecution: 'unknown'` とし、docker-ssh SDK は
|
|
|
263
291
|
|
|
264
292
|
### 実行環境ファイルと設定の再利用
|
|
265
293
|
|
|
266
|
-
SvelteKit SSR は HTTP/HTTPS ともに独立した `gateway` を使用し、バックエンドのポートを公開しません。ゲートウェイが標準の転送ヘッダーを上書きし、Compose が adapter のプロトコル、Host、クライアントアドレスの信頼設定を固定します。業務の実行環境ファイルでは変更できません。adapter
|
|
294
|
+
SvelteKit SSR は HTTP/HTTPS ともに独立した `gateway` を使用し、バックエンドのポートを公開しません。ゲートウェイが標準の転送ヘッダーを上書きし、Compose が adapter のプロトコル、Host、クライアントアドレスの信頼設定を固定します。業務の実行環境ファイルでは変更できません。adapter は実行時 `ORIGIN` を読み取らず、アプリは既定で構築時 `paths.origin` を固定しません。SSR 入口構成を変更する場合は完全配布物を生成してください。
|
|
267
295
|
|
|
268
296
|
上位で TLS を終端する場合は、ロードバランサーの実際の IP/CIDR を `trustedEdgeProxies` に指定します。独立 gateway は許可した実際の接続元の単一 `http` / `https` だけを採用し、その他の接続元や複合値では自身の接続プロトコルを使います。外部の `Forwarded`、ホスト/ポート転送値は上書きします。
|
|
269
297
|
|
|
@@ -297,7 +325,7 @@ Podman では設定済みの healthcheck を明示的に実行して状態を再
|
|
|
297
325
|
|
|
298
326
|
自前ミドルウェアのパスワードはサーバーの `<remoteDir>/managed-secrets.env`(権限 0600)で永続管理し、データボリュームと一緒にバックアップします。各パッケージは初回用の候補のみ生成し、ビルド端末のキャッシュに依存しません。オンライン SDK、deploy.sh、deploy.ps1、deploy-local.sh は配置ロック内でサーバー値を再利用し、アプリ接続とミドルウェア固有変数の両方へ反映します。配布 tar は変更せず、サーバーの非公開実行ファイルだけに確定値を反映します。対応するボリュームが存在し状態がない場合、サービス変更前に停止してバックアップ復元を求めます。自動的なパスワード変更やデータ削除は行わず、旧認証情報は下記の明示的な検証・導入手順で移行できます。
|
|
299
327
|
|
|
300
|
-
|
|
328
|
+
### 読み取り専用デプロイ計画
|
|
301
329
|
|
|
302
330
|
`createDeploymentPlan(appDir, config, options)` は Provider 初期化、認証情報・出力作成、対象への接続を行いません。実際の走査、環境解決、命名と checksum 検証を共用し、工程 `root`、サービスのソース・設定 `serviceDir`、版、ビルド ID、更新・保持範囲、設定元とキー名、基準要件と復旧先を返します。値と SSH 認証情報を除外します。未読の current は not-inspected とし、部分更新は実行時に成功基準を厳密に要求します。Compose 復旧は DB データや移行を戻しません。CLI は `hai deploy --env prod --plan`。
|
|
303
331
|
|
|
@@ -305,13 +333,13 @@ Podman では設定済みの healthcheck を明示的に実行して状態を再
|
|
|
305
333
|
|
|
306
334
|
リソースは実行側の完全な構成を共用します。`containers` は今回選択した明示名のみ、Compose が命名する LDAP/SMTP は `composeManagedServices` に表示します。SSR/API のストレージ gateway も更新・保持対象に表示します。`logicalVolumes` は保持サービスとアプリが継続使用するデータを含む構成全体の論理キーで、新規作成や再作成の指示ではありません。実際の名前は Compose プロジェクトのスコープで決まります。未選択ミドルウェアの action は keep で、クラウド開通は実際の選択範囲に従い、認証値を表示しません。
|
|
307
335
|
|
|
308
|
-
|
|
336
|
+
### 容量と認証情報のインポート
|
|
309
337
|
|
|
310
338
|
明示された平文上限を保持し、フィードバックの必要量が超える場合は競合を示して梱包を拒否します。省略/auto だけ自動計算し、Web プロキシと Kit BODY_SIZE_LIMIT は同じ暗号文予算を使います。計画の target.runtime はリモートの provider.remote.runtime を示し、ローカル梱包 options.runtime とは別です。auto を検出済みと表示しません。
|
|
311
339
|
|
|
312
340
|
`importDeploymentSecrets({ directory, inputFile, runtime })` またはサーバー上の `hai deploy-secrets <directory> --import <private.json>` で読み取り専用検査を行います。明示 `--apply` / dryRun:false のみ保存します。プロジェクト・コンテナ・ボリューム・実際の認証情報を検証し、古いパッケージからの推測、パスワード変更、サービス再作成はしません。特殊文字対応 v2 状態をデプロイ共通 flock 内で原子的に0600で保存します。通常のオフライン配布にサーバー Node は不要で、一度限りの移行ツールには対応 Node と CLI/deploy が必要です。[導入・復旧手順](docs/credential-import.ja.md)を参照してください。
|
|
313
341
|
|
|
314
|
-
|
|
342
|
+
### リクエストポリシーファイルと信頼する代理
|
|
315
343
|
|
|
316
344
|
Serv の `http.access` と SvelteKit の `access` は独立した yml/yaml を参照できます。配備は `HAI_SERV`、`HAI_SERV_HTTP_ACCESS`、`HAI_KIT_ACCESS` などの環境上書きを含む実効設定を読み、検証済みの正規化スナップショットを配布物へ含めます。実行時は `/run/hai/request-access.yml` を Compose の読み取り専用マウントで参照し、工程の元の参照先は変更しません。SHA-256 検証に含まれ、ファイル不足・不正はアップロード前に失敗します。アップロードするアーカイブとそのポリシースナップショットは整合性検証の対象です。SDK 管理のスナップショットを置き換える場合は新しい配布物を作成します。配置済み Node バックエンドのマウント済み `.env.runtime` は上記手順で編集・再起動できます。インライン規則の変更ではスナップショットや Nginx 設定は書き換わりません。
|
|
317
345
|
|
|
@@ -321,6 +349,18 @@ Serv の `http.access` と SvelteKit の `access` は独立した yml/yaml を
|
|
|
321
349
|
|
|
322
350
|
Web/gateway 入口がありバックエンドのポートが非公開の場合だけ、管理 Compose は `HAI_DEPLOY_PRIVATE_PROXY=1` を設定します。この構成の `trustedProxies: auto` はコンテナネットワークを採用し、他のホストでは転送ヘッダーを無視します。生成 Nginx は実接続元で転送ヘッダーを上書きします。外側の負荷分散器は Docker SSH Provider の `trustedEdgeProxies` に実 IP/CIDR を明記してください。省略時は上流を信頼せず、`[]` も同じ動作です。Nginx 到達前に失われた源 IP は復元できず、一部の rootless 構成も実測が必要です。[リクエスト制御手引き](../../docs/usage/configuration/request-access.md)に例と確認手順を記載しています。
|
|
323
351
|
|
|
352
|
+
## 設定
|
|
353
|
+
|
|
354
|
+
ライフサイクル。init にバックエンド/業務設定を渡し成功後に使用します。借用依存先の解放前に close の完了を待ち、正確な戻り値は例と公開署名に従います。
|
|
355
|
+
|
|
356
|
+
設定はホストが読込・検証してから渡します。秘密はサーバーの非公開環境に保存し、利用場面に応じてバックエンド・容量・期限・ログを選びます。変更後は再初期化の結果を確認してください。
|
|
357
|
+
|
|
358
|
+
[項目別の用途・適用場面・例](../../docs/usage/configuration/delivery.md).
|
|
359
|
+
|
|
360
|
+
## エラー処理
|
|
361
|
+
|
|
362
|
+
領域操作は result.success を確認し、失敗時はモジュールのエラー定義と安全な説明を使います。コード・関連 ID・秘匿した原因をサーバーログに残します。同期ツール・ファクトリー・ストリーム反復・ライフサイクルは各署名に従い、Promise 完了だけで成功と判断しません。回復条件は各機能を参照してください。
|
|
363
|
+
|
|
324
364
|
## 開発とテスト
|
|
325
365
|
|
|
326
366
|
```sh
|