@sema-agent/server 1.185.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +102 -0
- package/README.md +207 -0
- package/deploy/sema-up/README.md +145 -0
- package/deploy/sema-up/chart/Chart.yaml +11 -0
- package/deploy/sema-up/chart/templates/gitea.yaml +63 -0
- package/deploy/sema-up/chart/templates/minio.yaml +62 -0
- package/deploy/sema-up/chart/templates/namespace-sandbox.yaml +9 -0
- package/deploy/sema-up/chart/templates/pg-cluster.yaml +57 -0
- package/deploy/sema-up/chart/templates/registry.yaml +88 -0
- package/deploy/sema-up/chart/templates/sandbox-rbac.yaml +45 -0
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +76 -0
- package/deploy/sema-up/chart/templates/server.yaml +88 -0
- package/deploy/sema-up/chart/values-full-single.yaml +9 -0
- package/deploy/sema-up/chart/values.yaml +100 -0
- package/deploy/sema-up/cluster-up.sh +432 -0
- package/deploy/sema-up/kube-up.sh +377 -0
- package/deploy/sema-up/lib/parse-machines.py +117 -0
- package/deploy/sema-up/machines.example.yaml +53 -0
- package/deploy/sema-up/preflight.sh +168 -0
- package/deploy/sema-up/sema-up.sh +758 -0
- package/deploy/sema-up/smoke.sh +100 -0
- package/deploy/sema-up/stack/compose.dataroot.yaml +16 -0
- package/deploy/sema-up/stack/compose.yaml +155 -0
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +189 -0
- package/dist/approval.d.ts +27 -0
- package/dist/approval.d.ts.map +1 -0
- package/dist/approval.js +127 -0
- package/dist/approval.js.map +1 -0
- package/dist/audit.d.ts +29 -0
- package/dist/audit.d.ts.map +1 -0
- package/dist/audit.js +95 -0
- package/dist/audit.js.map +1 -0
- package/dist/auth-bridge.d.ts +29 -0
- package/dist/auth-bridge.d.ts.map +1 -0
- package/dist/auth-bridge.js +145 -0
- package/dist/auth-bridge.js.map +1 -0
- package/dist/bake-runner/main.d.ts +20 -0
- package/dist/bake-runner/main.d.ts.map +1 -0
- package/dist/bake-runner/main.js +216 -0
- package/dist/bake-runner/main.js.map +1 -0
- package/dist/bake-runner/protocol.d.ts +49 -0
- package/dist/bake-runner/protocol.d.ts.map +1 -0
- package/dist/bake-runner/protocol.js +86 -0
- package/dist/bake-runner/protocol.js.map +1 -0
- package/dist/bake-runner/runner.d.ts +86 -0
- package/dist/bake-runner/runner.d.ts.map +1 -0
- package/dist/bake-runner/runner.js +228 -0
- package/dist/bake-runner/runner.js.map +1 -0
- package/dist/bench/l8/artifact.d.ts +62 -0
- package/dist/bench/l8/artifact.d.ts.map +1 -0
- package/dist/bench/l8/artifact.js +129 -0
- package/dist/bench/l8/artifact.js.map +1 -0
- package/dist/bench/l8/escape.d.ts +18 -0
- package/dist/bench/l8/escape.d.ts.map +1 -0
- package/dist/bench/l8/escape.js +9 -0
- package/dist/bench/l8/escape.js.map +1 -0
- package/dist/bench/l8/index.d.ts +5 -0
- package/dist/bench/l8/index.d.ts.map +1 -0
- package/dist/bench/l8/index.js +5 -0
- package/dist/bench/l8/index.js.map +1 -0
- package/dist/bench/l8/probes.d.ts +75 -0
- package/dist/bench/l8/probes.d.ts.map +1 -0
- package/dist/bench/l8/probes.js +178 -0
- package/dist/bench/l8/probes.js.map +1 -0
- package/dist/bench/l8/run-probes.d.ts +21 -0
- package/dist/bench/l8/run-probes.d.ts.map +1 -0
- package/dist/bench/l8/run-probes.js +130 -0
- package/dist/bench/l8/run-probes.js.map +1 -0
- package/dist/bench/s1/arms.d.ts +84 -0
- package/dist/bench/s1/arms.d.ts.map +1 -0
- package/dist/bench/s1/arms.js +329 -0
- package/dist/bench/s1/arms.js.map +1 -0
- package/dist/bench/s1/live-deps.d.ts +25 -0
- package/dist/bench/s1/live-deps.d.ts.map +1 -0
- package/dist/bench/s1/live-deps.js +449 -0
- package/dist/bench/s1/live-deps.js.map +1 -0
- package/dist/bench/s1/oracle.d.ts +34 -0
- package/dist/bench/s1/oracle.d.ts.map +1 -0
- package/dist/bench/s1/oracle.js +29 -0
- package/dist/bench/s1/oracle.js.map +1 -0
- package/dist/bench/s1/repair-oracle-adapter.d.ts +9 -0
- package/dist/bench/s1/repair-oracle-adapter.d.ts.map +1 -0
- package/dist/bench/s1/repair-oracle-adapter.js +27 -0
- package/dist/bench/s1/repair-oracle-adapter.js.map +1 -0
- package/dist/bench/s1/reviewer.d.ts +31 -0
- package/dist/bench/s1/reviewer.d.ts.map +1 -0
- package/dist/bench/s1/reviewer.js +26 -0
- package/dist/bench/s1/reviewer.js.map +1 -0
- package/dist/bench/s1/row.d.ts +29 -0
- package/dist/bench/s1/row.d.ts.map +1 -0
- package/dist/bench/s1/row.js +55 -0
- package/dist/bench/s1/row.js.map +1 -0
- package/dist/bench/s1/run-firm.d.ts +49 -0
- package/dist/bench/s1/run-firm.d.ts.map +1 -0
- package/dist/bench/s1/run-firm.js +291 -0
- package/dist/bench/s1/run-firm.js.map +1 -0
- package/dist/bench/s1/runner-ctx.d.ts +44 -0
- package/dist/bench/s1/runner-ctx.d.ts.map +1 -0
- package/dist/bench/s1/runner-ctx.js +59 -0
- package/dist/bench/s1/runner-ctx.js.map +1 -0
- package/dist/bench/s1/tasks.d.ts +48 -0
- package/dist/bench/s1/tasks.d.ts.map +1 -0
- package/dist/bench/s1/tasks.js +194 -0
- package/dist/bench/s1/tasks.js.map +1 -0
- package/dist/boot-reclaim.d.ts +10 -0
- package/dist/boot-reclaim.d.ts.map +1 -0
- package/dist/boot-reclaim.js +13 -0
- package/dist/boot-reclaim.js.map +1 -0
- package/dist/brain.d.ts +8 -0
- package/dist/brain.d.ts.map +1 -0
- package/dist/brain.js +83 -0
- package/dist/brain.js.map +1 -0
- package/dist/budget.d.ts +25 -0
- package/dist/budget.d.ts.map +1 -0
- package/dist/budget.js +107 -0
- package/dist/budget.js.map +1 -0
- package/dist/capabilities/builtin-tools.d.ts +3 -0
- package/dist/capabilities/builtin-tools.d.ts.map +1 -0
- package/dist/capabilities/builtin-tools.js +11 -0
- package/dist/capabilities/builtin-tools.js.map +1 -0
- package/dist/capabilities/code-review-council.d.ts +21 -0
- package/dist/capabilities/code-review-council.d.ts.map +1 -0
- package/dist/capabilities/code-review-council.js +113 -0
- package/dist/capabilities/code-review-council.js.map +1 -0
- package/dist/capabilities/collab-wire.d.ts +34 -0
- package/dist/capabilities/collab-wire.d.ts.map +1 -0
- package/dist/capabilities/collab-wire.js +2 -0
- package/dist/capabilities/collab-wire.js.map +1 -0
- package/dist/capabilities/collab-workflows.d.ts +40 -0
- package/dist/capabilities/collab-workflows.d.ts.map +1 -0
- package/dist/capabilities/collab-workflows.js +90 -0
- package/dist/capabilities/collab-workflows.js.map +1 -0
- package/dist/capabilities/oa-tools.d.ts +9 -0
- package/dist/capabilities/oa-tools.d.ts.map +1 -0
- package/dist/capabilities/oa-tools.js +44 -0
- package/dist/capabilities/oa-tools.js.map +1 -0
- package/dist/capabilities/prompt.d.ts +3 -0
- package/dist/capabilities/prompt.d.ts.map +1 -0
- package/dist/capabilities/prompt.js +6 -0
- package/dist/capabilities/prompt.js.map +1 -0
- package/dist/capabilities/prompts/code-review.d.ts +11 -0
- package/dist/capabilities/prompts/code-review.d.ts.map +1 -0
- package/dist/capabilities/prompts/code-review.js +39 -0
- package/dist/capabilities/prompts/code-review.js.map +1 -0
- package/dist/capabilities/prompts/identity.d.ts +2 -0
- package/dist/capabilities/prompts/identity.d.ts.map +1 -0
- package/dist/capabilities/prompts/identity.js +6 -0
- package/dist/capabilities/prompts/identity.js.map +1 -0
- package/dist/capabilities/prompts/team.d.ts +6 -0
- package/dist/capabilities/prompts/team.d.ts.map +1 -0
- package/dist/capabilities/prompts/team.js +6 -0
- package/dist/capabilities/prompts/team.js.map +1 -0
- package/dist/capabilities/repo-tools.d.ts +19 -0
- package/dist/capabilities/repo-tools.d.ts.map +1 -0
- package/dist/capabilities/repo-tools.js +98 -0
- package/dist/capabilities/repo-tools.js.map +1 -0
- package/dist/capabilities/scenarios.d.ts +72 -0
- package/dist/capabilities/scenarios.d.ts.map +1 -0
- package/dist/capabilities/scenarios.js +241 -0
- package/dist/capabilities/scenarios.js.map +1 -0
- package/dist/capabilities/select-environment-tool.d.ts +22 -0
- package/dist/capabilities/select-environment-tool.d.ts.map +1 -0
- package/dist/capabilities/select-environment-tool.js +86 -0
- package/dist/capabilities/select-environment-tool.js.map +1 -0
- package/dist/capabilities/skills.d.ts +12 -0
- package/dist/capabilities/skills.d.ts.map +1 -0
- package/dist/capabilities/skills.js +50 -0
- package/dist/capabilities/skills.js.map +1 -0
- package/dist/capabilities/team.d.ts +31 -0
- package/dist/capabilities/team.d.ts.map +1 -0
- package/dist/capabilities/team.js +66 -0
- package/dist/capabilities/team.js.map +1 -0
- package/dist/config-provider.d.ts +47 -0
- package/dist/config-provider.d.ts.map +1 -0
- package/dist/config-provider.js +156 -0
- package/dist/config-provider.js.map +1 -0
- package/dist/config.d.ts +272 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +605 -0
- package/dist/config.js.map +1 -0
- package/dist/degenerate-instrument.d.ts +17 -0
- package/dist/degenerate-instrument.d.ts.map +1 -0
- package/dist/degenerate-instrument.js +113 -0
- package/dist/degenerate-instrument.js.map +1 -0
- package/dist/elicitation.d.ts +47 -0
- package/dist/elicitation.d.ts.map +1 -0
- package/dist/elicitation.js +151 -0
- package/dist/elicitation.js.map +1 -0
- package/dist/env-facts.d.ts +18 -0
- package/dist/env-facts.d.ts.map +1 -0
- package/dist/env-facts.js +26 -0
- package/dist/env-facts.js.map +1 -0
- package/dist/finance/cost-taxonomy.d.ts +34 -0
- package/dist/finance/cost-taxonomy.d.ts.map +1 -0
- package/dist/finance/cost-taxonomy.js +26 -0
- package/dist/finance/cost-taxonomy.js.map +1 -0
- package/dist/fleet/fleet-bus.d.ts +137 -0
- package/dist/fleet/fleet-bus.d.ts.map +1 -0
- package/dist/fleet/fleet-bus.js +249 -0
- package/dist/fleet/fleet-bus.js.map +1 -0
- package/dist/fleet-client.d.ts +50 -0
- package/dist/fleet-client.d.ts.map +1 -0
- package/dist/fleet-client.js +150 -0
- package/dist/fleet-client.js.map +1 -0
- package/dist/fleet-lease.d.ts +76 -0
- package/dist/fleet-lease.d.ts.map +1 -0
- package/dist/fleet-lease.js +124 -0
- package/dist/fleet-lease.js.map +1 -0
- package/dist/hooks/hook-runner.d.ts +41 -0
- package/dist/hooks/hook-runner.d.ts.map +1 -0
- package/dist/hooks/hook-runner.js +975 -0
- package/dist/hooks/hook-runner.js.map +1 -0
- package/dist/http/idempotency.d.ts +12 -0
- package/dist/http/idempotency.d.ts.map +1 -0
- package/dist/http/idempotency.js +49 -0
- package/dist/http/idempotency.js.map +1 -0
- package/dist/http/server.d.ts +185 -0
- package/dist/http/server.d.ts.map +1 -0
- package/dist/http/server.js +4845 -0
- package/dist/http/server.js.map +1 -0
- package/dist/http/wire-gate.d.ts +3 -0
- package/dist/http/wire-gate.d.ts.map +1 -0
- package/dist/http/wire-gate.js +6 -0
- package/dist/http/wire-gate.js.map +1 -0
- package/dist/images/bake-validate.d.ts +41 -0
- package/dist/images/bake-validate.d.ts.map +1 -0
- package/dist/images/bake-validate.js +183 -0
- package/dist/images/bake-validate.js.map +1 -0
- package/dist/images/manifest.d.ts +36 -0
- package/dist/images/manifest.d.ts.map +1 -0
- package/dist/images/manifest.js +69 -0
- package/dist/images/manifest.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/key-resolver.d.ts +5 -0
- package/dist/key-resolver.d.ts.map +1 -0
- package/dist/key-resolver.js +15 -0
- package/dist/key-resolver.js.map +1 -0
- package/dist/leader/diffout.d.ts +24 -0
- package/dist/leader/diffout.d.ts.map +1 -0
- package/dist/leader/diffout.js +54 -0
- package/dist/leader/diffout.js.map +1 -0
- package/dist/leader/diffup.d.ts +14 -0
- package/dist/leader/diffup.d.ts.map +1 -0
- package/dist/leader/diffup.js +81 -0
- package/dist/leader/diffup.js.map +1 -0
- package/dist/leader/endpoint.d.ts +30 -0
- package/dist/leader/endpoint.d.ts.map +1 -0
- package/dist/leader/endpoint.js +76 -0
- package/dist/leader/endpoint.js.map +1 -0
- package/dist/leader/fanout.d.ts +46 -0
- package/dist/leader/fanout.d.ts.map +1 -0
- package/dist/leader/fanout.js +109 -0
- package/dist/leader/fanout.js.map +1 -0
- package/dist/leader/grader-env-factory.d.ts +36 -0
- package/dist/leader/grader-env-factory.d.ts.map +1 -0
- package/dist/leader/grader-env-factory.js +73 -0
- package/dist/leader/grader-env-factory.js.map +1 -0
- package/dist/leader/leader.d.ts +102 -0
- package/dist/leader/leader.d.ts.map +1 -0
- package/dist/leader/leader.js +354 -0
- package/dist/leader/leader.js.map +1 -0
- package/dist/leader/merge.d.ts +109 -0
- package/dist/leader/merge.d.ts.map +1 -0
- package/dist/leader/merge.js +184 -0
- package/dist/leader/merge.js.map +1 -0
- package/dist/leader/planner.d.ts +26 -0
- package/dist/leader/planner.d.ts.map +1 -0
- package/dist/leader/planner.js +137 -0
- package/dist/leader/planner.js.map +1 -0
- package/dist/leader/repair-oracle.d.ts +34 -0
- package/dist/leader/repair-oracle.d.ts.map +1 -0
- package/dist/leader/repair-oracle.js +83 -0
- package/dist/leader/repair-oracle.js.map +1 -0
- package/dist/leader/repair-wire.d.ts +49 -0
- package/dist/leader/repair-wire.d.ts.map +1 -0
- package/dist/leader/repair-wire.js +90 -0
- package/dist/leader/repair-wire.js.map +1 -0
- package/dist/leader/wire.d.ts +66 -0
- package/dist/leader/wire.d.ts.map +1 -0
- package/dist/leader/wire.js +452 -0
- package/dist/leader/wire.js.map +1 -0
- package/dist/lsp/e2b-bridge.d.ts +8 -0
- package/dist/lsp/e2b-bridge.d.ts.map +1 -0
- package/dist/lsp/e2b-bridge.js +71 -0
- package/dist/lsp/e2b-bridge.js.map +1 -0
- package/dist/lsp/e2b-manager.d.ts +16 -0
- package/dist/lsp/e2b-manager.d.ts.map +1 -0
- package/dist/lsp/e2b-manager.js +49 -0
- package/dist/lsp/e2b-manager.js.map +1 -0
- package/dist/lsp/lsp-frames.d.ts +2 -0
- package/dist/lsp/lsp-frames.d.ts.map +1 -0
- package/dist/lsp/lsp-frames.js +25 -0
- package/dist/lsp/lsp-frames.js.map +1 -0
- package/dist/lsp/manager.d.ts +41 -0
- package/dist/lsp/manager.d.ts.map +1 -0
- package/dist/lsp/manager.js +84 -0
- package/dist/lsp/manager.js.map +1 -0
- package/dist/lsp/types.d.ts +2 -0
- package/dist/lsp/types.d.ts.map +1 -0
- package/dist/lsp/types.js +2 -0
- package/dist/lsp/types.js.map +1 -0
- package/dist/lsp/ws-transport.d.ts +28 -0
- package/dist/lsp/ws-transport.d.ts.map +1 -0
- package/dist/lsp/ws-transport.js +209 -0
- package/dist/lsp/ws-transport.js.map +1 -0
- package/dist/lsp-evict.d.ts +2 -0
- package/dist/lsp-evict.d.ts.map +1 -0
- package/dist/lsp-evict.js +14 -0
- package/dist/lsp-evict.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +1526 -0
- package/dist/main.js.map +1 -0
- package/dist/memory-export.d.ts +3 -0
- package/dist/memory-export.d.ts.map +1 -0
- package/dist/memory-export.js +8 -0
- package/dist/memory-export.js.map +1 -0
- package/dist/memory-sync-client.d.ts +29 -0
- package/dist/memory-sync-client.d.ts.map +1 -0
- package/dist/memory-sync-client.js +133 -0
- package/dist/memory-sync-client.js.map +1 -0
- package/dist/memory-sync.d.ts +41 -0
- package/dist/memory-sync.d.ts.map +1 -0
- package/dist/memory-sync.js +183 -0
- package/dist/memory-sync.js.map +1 -0
- package/dist/model-select.d.ts +8 -0
- package/dist/model-select.d.ts.map +1 -0
- package/dist/model-select.js +12 -0
- package/dist/model-select.js.map +1 -0
- package/dist/observability/cost-quota.d.ts +21 -0
- package/dist/observability/cost-quota.d.ts.map +1 -0
- package/dist/observability/cost-quota.js +42 -0
- package/dist/observability/cost-quota.js.map +1 -0
- package/dist/observability/logger.d.ts +9 -0
- package/dist/observability/logger.d.ts.map +1 -0
- package/dist/observability/logger.js +35 -0
- package/dist/observability/logger.js.map +1 -0
- package/dist/observability/metrics.d.ts +76 -0
- package/dist/observability/metrics.d.ts.map +1 -0
- package/dist/observability/metrics.js +263 -0
- package/dist/observability/metrics.js.map +1 -0
- package/dist/observability/otel-exporter.d.ts +37 -0
- package/dist/observability/otel-exporter.d.ts.map +1 -0
- package/dist/observability/otel-exporter.js +95 -0
- package/dist/observability/otel-exporter.js.map +1 -0
- package/dist/observability/principal-context.d.ts +5 -0
- package/dist/observability/principal-context.d.ts.map +1 -0
- package/dist/observability/principal-context.js +9 -0
- package/dist/observability/principal-context.js.map +1 -0
- package/dist/observability/rate-limit.d.ts +18 -0
- package/dist/observability/rate-limit.d.ts.map +1 -0
- package/dist/observability/rate-limit.js +30 -0
- package/dist/observability/rate-limit.js.map +1 -0
- package/dist/observability/tool-trace.d.ts +6 -0
- package/dist/observability/tool-trace.d.ts.map +1 -0
- package/dist/observability/tool-trace.js +73 -0
- package/dist/observability/tool-trace.js.map +1 -0
- package/dist/orchestration/hardened-vm-runner.d.ts +26 -0
- package/dist/orchestration/hardened-vm-runner.d.ts.map +1 -0
- package/dist/orchestration/hardened-vm-runner.js +217 -0
- package/dist/orchestration/hardened-vm-runner.js.map +1 -0
- package/dist/orchestration/hardened-vm-worker-runner.d.ts +4 -0
- package/dist/orchestration/hardened-vm-worker-runner.d.ts.map +1 -0
- package/dist/orchestration/hardened-vm-worker-runner.js +79 -0
- package/dist/orchestration/hardened-vm-worker-runner.js.map +1 -0
- package/dist/orchestration/hardened-vm-worker.d.ts +2 -0
- package/dist/orchestration/hardened-vm-worker.d.ts.map +1 -0
- package/dist/orchestration/hardened-vm-worker.js +80 -0
- package/dist/orchestration/hardened-vm-worker.js.map +1 -0
- package/dist/orchestration/subagent-steer.d.ts +12 -0
- package/dist/orchestration/subagent-steer.d.ts.map +1 -0
- package/dist/orchestration/subagent-steer.js +45 -0
- package/dist/orchestration/subagent-steer.js.map +1 -0
- package/dist/orchestration/workflow-agent-steer.d.ts +14 -0
- package/dist/orchestration/workflow-agent-steer.d.ts.map +1 -0
- package/dist/orchestration/workflow-agent-steer.js +41 -0
- package/dist/orchestration/workflow-agent-steer.js.map +1 -0
- package/dist/orchestration/workflow-completion-inbox.d.ts +101 -0
- package/dist/orchestration/workflow-completion-inbox.d.ts.map +1 -0
- package/dist/orchestration/workflow-completion-inbox.js +327 -0
- package/dist/orchestration/workflow-completion-inbox.js.map +1 -0
- package/dist/orchestration/workflow-notify-journal.d.ts +120 -0
- package/dist/orchestration/workflow-notify-journal.d.ts.map +1 -0
- package/dist/orchestration/workflow-notify-journal.js +297 -0
- package/dist/orchestration/workflow-notify-journal.js.map +1 -0
- package/dist/per-task-image.d.ts +27 -0
- package/dist/per-task-image.d.ts.map +1 -0
- package/dist/per-task-image.js +37 -0
- package/dist/per-task-image.js.map +1 -0
- package/dist/plan-cache-probe.d.ts +21 -0
- package/dist/plan-cache-probe.d.ts.map +1 -0
- package/dist/plan-cache-probe.js +79 -0
- package/dist/plan-cache-probe.js.map +1 -0
- package/dist/plugins/approval-exemption-store.d.ts +56 -0
- package/dist/plugins/approval-exemption-store.d.ts.map +1 -0
- package/dist/plugins/approval-exemption-store.js +216 -0
- package/dist/plugins/approval-exemption-store.js.map +1 -0
- package/dist/plugins/background-shell-support.d.ts +64 -0
- package/dist/plugins/background-shell-support.d.ts.map +1 -0
- package/dist/plugins/background-shell-support.js +235 -0
- package/dist/plugins/background-shell-support.js.map +1 -0
- package/dist/plugins/blob-backend.d.ts +44 -0
- package/dist/plugins/blob-backend.d.ts.map +1 -0
- package/dist/plugins/blob-backend.js +188 -0
- package/dist/plugins/blob-backend.js.map +1 -0
- package/dist/plugins/caching-session-store.d.ts +51 -0
- package/dist/plugins/caching-session-store.d.ts.map +1 -0
- package/dist/plugins/caching-session-store.js +142 -0
- package/dist/plugins/caching-session-store.js.map +1 -0
- package/dist/plugins/file-outcome-sink.d.ts +20 -0
- package/dist/plugins/file-outcome-sink.d.ts.map +1 -0
- package/dist/plugins/file-outcome-sink.js +14 -0
- package/dist/plugins/file-outcome-sink.js.map +1 -0
- package/dist/plugins/file-resume-anchor-store.d.ts +19 -0
- package/dist/plugins/file-resume-anchor-store.d.ts.map +1 -0
- package/dist/plugins/file-resume-anchor-store.js +103 -0
- package/dist/plugins/file-resume-anchor-store.js.map +1 -0
- package/dist/plugins/file-run-store.d.ts +95 -0
- package/dist/plugins/file-run-store.d.ts.map +1 -0
- package/dist/plugins/file-run-store.js +446 -0
- package/dist/plugins/file-run-store.js.map +1 -0
- package/dist/plugins/file-workflow-journal-store.d.ts +2 -0
- package/dist/plugins/file-workflow-journal-store.d.ts.map +1 -0
- package/dist/plugins/file-workflow-journal-store.js +2 -0
- package/dist/plugins/file-workflow-journal-store.js.map +1 -0
- package/dist/plugins/host-platform.d.ts +19 -0
- package/dist/plugins/host-platform.d.ts.map +1 -0
- package/dist/plugins/host-platform.js +71 -0
- package/dist/plugins/host-platform.js.map +1 -0
- package/dist/plugins/local-checkpoint-store.d.ts +41 -0
- package/dist/plugins/local-checkpoint-store.d.ts.map +1 -0
- package/dist/plugins/local-checkpoint-store.js +217 -0
- package/dist/plugins/local-checkpoint-store.js.map +1 -0
- package/dist/plugins/local-session-store.d.ts +69 -0
- package/dist/plugins/local-session-store.d.ts.map +1 -0
- package/dist/plugins/local-session-store.js +431 -0
- package/dist/plugins/local-session-store.js.map +1 -0
- package/dist/plugins/memory-engine-pg.d.ts +47 -0
- package/dist/plugins/memory-engine-pg.d.ts.map +1 -0
- package/dist/plugins/memory-engine-pg.js +306 -0
- package/dist/plugins/memory-engine-pg.js.map +1 -0
- package/dist/plugins/memory-engine-tidb.d.ts +40 -0
- package/dist/plugins/memory-engine-tidb.d.ts.map +1 -0
- package/dist/plugins/memory-engine-tidb.js +296 -0
- package/dist/plugins/memory-engine-tidb.js.map +1 -0
- package/dist/plugins/memory-engine-vector-util.d.ts +2 -0
- package/dist/plugins/memory-engine-vector-util.d.ts.map +1 -0
- package/dist/plugins/memory-engine-vector-util.js +2 -0
- package/dist/plugins/memory-engine-vector-util.js.map +1 -0
- package/dist/plugins/memory-resume-anchor-store.d.ts +12 -0
- package/dist/plugins/memory-resume-anchor-store.d.ts.map +1 -0
- package/dist/plugins/memory-resume-anchor-store.js +31 -0
- package/dist/plugins/memory-resume-anchor-store.js.map +1 -0
- package/dist/plugins/memory-run-store.d.ts +75 -0
- package/dist/plugins/memory-run-store.d.ts.map +1 -0
- package/dist/plugins/memory-run-store.js +267 -0
- package/dist/plugins/memory-run-store.js.map +1 -0
- package/dist/plugins/memory-sync-store-pg.d.ts +78 -0
- package/dist/plugins/memory-sync-store-pg.d.ts.map +1 -0
- package/dist/plugins/memory-sync-store-pg.js +152 -0
- package/dist/plugins/memory-sync-store-pg.js.map +1 -0
- package/dist/plugins/memory-sync-store-tidb.d.ts +32 -0
- package/dist/plugins/memory-sync-store-tidb.d.ts.map +1 -0
- package/dist/plugins/memory-sync-store-tidb.js +146 -0
- package/dist/plugins/memory-sync-store-tidb.js.map +1 -0
- package/dist/plugins/pg-approval-store.d.ts +28 -0
- package/dist/plugins/pg-approval-store.d.ts.map +1 -0
- package/dist/plugins/pg-approval-store.js +107 -0
- package/dist/plugins/pg-approval-store.js.map +1 -0
- package/dist/plugins/pg-breaker-state.d.ts +20 -0
- package/dist/plugins/pg-breaker-state.d.ts.map +1 -0
- package/dist/plugins/pg-breaker-state.js +89 -0
- package/dist/plugins/pg-breaker-state.js.map +1 -0
- package/dist/plugins/pg-checkpoint-store.d.ts +34 -0
- package/dist/plugins/pg-checkpoint-store.d.ts.map +1 -0
- package/dist/plugins/pg-checkpoint-store.js +193 -0
- package/dist/plugins/pg-checkpoint-store.js.map +1 -0
- package/dist/plugins/pg-cost-quota.d.ts +18 -0
- package/dist/plugins/pg-cost-quota.d.ts.map +1 -0
- package/dist/plugins/pg-cost-quota.js +189 -0
- package/dist/plugins/pg-cost-quota.js.map +1 -0
- package/dist/plugins/pg-file-snapshot-store.d.ts +26 -0
- package/dist/plugins/pg-file-snapshot-store.d.ts.map +1 -0
- package/dist/plugins/pg-file-snapshot-store.js +181 -0
- package/dist/plugins/pg-file-snapshot-store.js.map +1 -0
- package/dist/plugins/pg-image-bake.d.ts +42 -0
- package/dist/plugins/pg-image-bake.d.ts.map +1 -0
- package/dist/plugins/pg-image-bake.js +471 -0
- package/dist/plugins/pg-image-bake.js.map +1 -0
- package/dist/plugins/pg-image-index.d.ts +23 -0
- package/dist/plugins/pg-image-index.d.ts.map +1 -0
- package/dist/plugins/pg-image-index.js +252 -0
- package/dist/plugins/pg-image-index.js.map +1 -0
- package/dist/plugins/pg-outcome-ledger.d.ts +23 -0
- package/dist/plugins/pg-outcome-ledger.d.ts.map +1 -0
- package/dist/plugins/pg-outcome-ledger.js +102 -0
- package/dist/plugins/pg-outcome-ledger.js.map +1 -0
- package/dist/plugins/pg-pool.d.ts +7 -0
- package/dist/plugins/pg-pool.d.ts.map +1 -0
- package/dist/plugins/pg-pool.js +233 -0
- package/dist/plugins/pg-pool.js.map +1 -0
- package/dist/plugins/pg-rate-limiter.d.ts +49 -0
- package/dist/plugins/pg-rate-limiter.d.ts.map +1 -0
- package/dist/plugins/pg-rate-limiter.js +193 -0
- package/dist/plugins/pg-rate-limiter.js.map +1 -0
- package/dist/plugins/pg-resume-anchor-store.d.ts +14 -0
- package/dist/plugins/pg-resume-anchor-store.d.ts.map +1 -0
- package/dist/plugins/pg-resume-anchor-store.js +23 -0
- package/dist/plugins/pg-resume-anchor-store.js.map +1 -0
- package/dist/plugins/pg-run-store.d.ts +76 -0
- package/dist/plugins/pg-run-store.d.ts.map +1 -0
- package/dist/plugins/pg-run-store.js +301 -0
- package/dist/plugins/pg-run-store.js.map +1 -0
- package/dist/plugins/pg-session-policy-store.d.ts +12 -0
- package/dist/plugins/pg-session-policy-store.d.ts.map +1 -0
- package/dist/plugins/pg-session-policy-store.js +88 -0
- package/dist/plugins/pg-session-policy-store.js.map +1 -0
- package/dist/plugins/pg-session-storage.d.ts +59 -0
- package/dist/plugins/pg-session-storage.d.ts.map +1 -0
- package/dist/plugins/pg-session-storage.js +484 -0
- package/dist/plugins/pg-session-storage.js.map +1 -0
- package/dist/plugins/pg-session-store.d.ts +2 -0
- package/dist/plugins/pg-session-store.d.ts.map +1 -0
- package/dist/plugins/pg-session-store.js +2 -0
- package/dist/plugins/pg-session-store.js.map +1 -0
- package/dist/plugins/pg-tool-result-store.d.ts +16 -0
- package/dist/plugins/pg-tool-result-store.d.ts.map +1 -0
- package/dist/plugins/pg-tool-result-store.js +52 -0
- package/dist/plugins/pg-tool-result-store.js.map +1 -0
- package/dist/plugins/pg-workflow-journal-store.d.ts +11 -0
- package/dist/plugins/pg-workflow-journal-store.d.ts.map +1 -0
- package/dist/plugins/pg-workflow-journal-store.js +28 -0
- package/dist/plugins/pg-workflow-journal-store.js.map +1 -0
- package/dist/plugins/pg-workflow-run-store.d.ts +55 -0
- package/dist/plugins/pg-workflow-run-store.d.ts.map +1 -0
- package/dist/plugins/pg-workflow-run-store.js +216 -0
- package/dist/plugins/pg-workflow-run-store.js.map +1 -0
- package/dist/plugins/remote-env-adb.d.ts +119 -0
- package/dist/plugins/remote-env-adb.d.ts.map +1 -0
- package/dist/plugins/remote-env-adb.js +502 -0
- package/dist/plugins/remote-env-adb.js.map +1 -0
- package/dist/plugins/remote-env-e2b.d.ts +162 -0
- package/dist/plugins/remote-env-e2b.d.ts.map +1 -0
- package/dist/plugins/remote-env-e2b.js +931 -0
- package/dist/plugins/remote-env-e2b.js.map +1 -0
- package/dist/plugins/remote-env-host.d.ts +141 -0
- package/dist/plugins/remote-env-host.d.ts.map +1 -0
- package/dist/plugins/remote-env-host.js +868 -0
- package/dist/plugins/remote-env-host.js.map +1 -0
- package/dist/plugins/remote-env-k8s.d.ts +209 -0
- package/dist/plugins/remote-env-k8s.d.ts.map +1 -0
- package/dist/plugins/remote-env-k8s.js +1206 -0
- package/dist/plugins/remote-env-k8s.js.map +1 -0
- package/dist/plugins/remote-env-local-docker.d.ts +124 -0
- package/dist/plugins/remote-env-local-docker.d.ts.map +1 -0
- package/dist/plugins/remote-env-local-docker.js +597 -0
- package/dist/plugins/remote-env-local-docker.js.map +1 -0
- package/dist/plugins/remote-env-ssh.d.ts +122 -0
- package/dist/plugins/remote-env-ssh.d.ts.map +1 -0
- package/dist/plugins/remote-env-ssh.js +511 -0
- package/dist/plugins/remote-env-ssh.js.map +1 -0
- package/dist/plugins/remote-shell.d.ts +7 -0
- package/dist/plugins/remote-shell.d.ts.map +1 -0
- package/dist/plugins/remote-shell.js +25 -0
- package/dist/plugins/remote-shell.js.map +1 -0
- package/dist/plugins/s3-presign.d.ts +13 -0
- package/dist/plugins/s3-presign.d.ts.map +1 -0
- package/dist/plugins/s3-presign.js +55 -0
- package/dist/plugins/s3-presign.js.map +1 -0
- package/dist/plugins/scheduler-support.d.ts +39 -0
- package/dist/plugins/scheduler-support.d.ts.map +1 -0
- package/dist/plugins/scheduler-support.js +141 -0
- package/dist/plugins/scheduler-support.js.map +1 -0
- package/dist/plugins/session-store.d.ts +7 -0
- package/dist/plugins/session-store.d.ts.map +1 -0
- package/dist/plugins/session-store.js +14 -0
- package/dist/plugins/session-store.js.map +1 -0
- package/dist/plugins/store-backend.d.ts +88 -0
- package/dist/plugins/store-backend.d.ts.map +1 -0
- package/dist/plugins/store-backend.js +197 -0
- package/dist/plugins/store-backend.js.map +1 -0
- package/dist/plugins/tidb-approval-store.d.ts +39 -0
- package/dist/plugins/tidb-approval-store.d.ts.map +1 -0
- package/dist/plugins/tidb-approval-store.js +81 -0
- package/dist/plugins/tidb-approval-store.js.map +1 -0
- package/dist/plugins/tidb-breaker-state.d.ts +18 -0
- package/dist/plugins/tidb-breaker-state.d.ts.map +1 -0
- package/dist/plugins/tidb-breaker-state.js +75 -0
- package/dist/plugins/tidb-breaker-state.js.map +1 -0
- package/dist/plugins/tidb-checkpoint-store.d.ts +50 -0
- package/dist/plugins/tidb-checkpoint-store.d.ts.map +1 -0
- package/dist/plugins/tidb-checkpoint-store.js +196 -0
- package/dist/plugins/tidb-checkpoint-store.js.map +1 -0
- package/dist/plugins/tidb-cost-quota.d.ts +16 -0
- package/dist/plugins/tidb-cost-quota.d.ts.map +1 -0
- package/dist/plugins/tidb-cost-quota.js +34 -0
- package/dist/plugins/tidb-cost-quota.js.map +1 -0
- package/dist/plugins/tidb-file-snapshot-store.d.ts +26 -0
- package/dist/plugins/tidb-file-snapshot-store.d.ts.map +1 -0
- package/dist/plugins/tidb-file-snapshot-store.js +183 -0
- package/dist/plugins/tidb-file-snapshot-store.js.map +1 -0
- package/dist/plugins/tidb-image-bake.d.ts +102 -0
- package/dist/plugins/tidb-image-bake.d.ts.map +1 -0
- package/dist/plugins/tidb-image-bake.js +400 -0
- package/dist/plugins/tidb-image-bake.js.map +1 -0
- package/dist/plugins/tidb-image-index.d.ts +71 -0
- package/dist/plugins/tidb-image-index.d.ts.map +1 -0
- package/dist/plugins/tidb-image-index.js +192 -0
- package/dist/plugins/tidb-image-index.js.map +1 -0
- package/dist/plugins/tidb-outcome-ledger.d.ts +58 -0
- package/dist/plugins/tidb-outcome-ledger.d.ts.map +1 -0
- package/dist/plugins/tidb-outcome-ledger.js +98 -0
- package/dist/plugins/tidb-outcome-ledger.js.map +1 -0
- package/dist/plugins/tidb-pool.d.ts +11 -0
- package/dist/plugins/tidb-pool.d.ts.map +1 -0
- package/dist/plugins/tidb-pool.js +485 -0
- package/dist/plugins/tidb-pool.js.map +1 -0
- package/dist/plugins/tidb-rate-limiter.d.ts +15 -0
- package/dist/plugins/tidb-rate-limiter.d.ts.map +1 -0
- package/dist/plugins/tidb-rate-limiter.js +34 -0
- package/dist/plugins/tidb-rate-limiter.js.map +1 -0
- package/dist/plugins/tidb-resume-anchor-store.d.ts +14 -0
- package/dist/plugins/tidb-resume-anchor-store.d.ts.map +1 -0
- package/dist/plugins/tidb-resume-anchor-store.js +23 -0
- package/dist/plugins/tidb-resume-anchor-store.js.map +1 -0
- package/dist/plugins/tidb-run-store.d.ts +107 -0
- package/dist/plugins/tidb-run-store.d.ts.map +1 -0
- package/dist/plugins/tidb-run-store.js +321 -0
- package/dist/plugins/tidb-run-store.js.map +1 -0
- package/dist/plugins/tidb-session-policy-store.d.ts +12 -0
- package/dist/plugins/tidb-session-policy-store.d.ts.map +1 -0
- package/dist/plugins/tidb-session-policy-store.js +88 -0
- package/dist/plugins/tidb-session-policy-store.js.map +1 -0
- package/dist/plugins/tidb-session-storage.d.ts +15 -0
- package/dist/plugins/tidb-session-storage.d.ts.map +1 -0
- package/dist/plugins/tidb-session-storage.js +101 -0
- package/dist/plugins/tidb-session-storage.js.map +1 -0
- package/dist/plugins/tidb-session-store.d.ts +46 -0
- package/dist/plugins/tidb-session-store.d.ts.map +1 -0
- package/dist/plugins/tidb-session-store.js +360 -0
- package/dist/plugins/tidb-session-store.js.map +1 -0
- package/dist/plugins/tidb-tool-result-store.d.ts +15 -0
- package/dist/plugins/tidb-tool-result-store.d.ts.map +1 -0
- package/dist/plugins/tidb-tool-result-store.js +41 -0
- package/dist/plugins/tidb-tool-result-store.js.map +1 -0
- package/dist/plugins/tidb-workflow-journal-store.d.ts +11 -0
- package/dist/plugins/tidb-workflow-journal-store.d.ts.map +1 -0
- package/dist/plugins/tidb-workflow-journal-store.js +28 -0
- package/dist/plugins/tidb-workflow-journal-store.js.map +1 -0
- package/dist/plugins/tidb-workflow-run-store.d.ts +61 -0
- package/dist/plugins/tidb-workflow-run-store.d.ts.map +1 -0
- package/dist/plugins/tidb-workflow-run-store.js +227 -0
- package/dist/plugins/tidb-workflow-run-store.js.map +1 -0
- package/dist/plugins/web-search.d.ts +27 -0
- package/dist/plugins/web-search.d.ts.map +1 -0
- package/dist/plugins/web-search.js +143 -0
- package/dist/plugins/web-search.js.map +1 -0
- package/dist/plugins/workflow-journal-limits.d.ts +2 -0
- package/dist/plugins/workflow-journal-limits.d.ts.map +1 -0
- package/dist/plugins/workflow-journal-limits.js +2 -0
- package/dist/plugins/workflow-journal-limits.js.map +1 -0
- package/dist/plugins/worktree-isolation.d.ts +16 -0
- package/dist/plugins/worktree-isolation.d.ts.map +1 -0
- package/dist/plugins/worktree-isolation.js +55 -0
- package/dist/plugins/worktree-isolation.js.map +1 -0
- package/dist/plugins/write-behind-counter.d.ts +43 -0
- package/dist/plugins/write-behind-counter.d.ts.map +1 -0
- package/dist/plugins/write-behind-counter.js +144 -0
- package/dist/plugins/write-behind-counter.js.map +1 -0
- package/dist/project-memory.d.ts +14 -0
- package/dist/project-memory.d.ts.map +1 -0
- package/dist/project-memory.js +96 -0
- package/dist/project-memory.js.map +1 -0
- package/dist/question.d.ts +42 -0
- package/dist/question.d.ts.map +1 -0
- package/dist/question.js +140 -0
- package/dist/question.js.map +1 -0
- package/dist/resource-suspend.d.ts +11 -0
- package/dist/resource-suspend.d.ts.map +1 -0
- package/dist/resource-suspend.js +6 -0
- package/dist/resource-suspend.js.map +1 -0
- package/dist/router/route-orchestration.d.ts +31 -0
- package/dist/router/route-orchestration.d.ts.map +1 -0
- package/dist/router/route-orchestration.js +49 -0
- package/dist/router/route-orchestration.js.map +1 -0
- package/dist/run-local.d.ts +26 -0
- package/dist/run-local.d.ts.map +1 -0
- package/dist/run-local.js +337 -0
- package/dist/run-local.js.map +1 -0
- package/dist/runs.d.ts +39 -0
- package/dist/runs.d.ts.map +1 -0
- package/dist/runs.js +392 -0
- package/dist/runs.js.map +1 -0
- package/dist/runtime-caps-resolver.d.ts +32 -0
- package/dist/runtime-caps-resolver.d.ts.map +1 -0
- package/dist/runtime-caps-resolver.js +134 -0
- package/dist/runtime-caps-resolver.js.map +1 -0
- package/dist/runtime-governance.d.ts +18 -0
- package/dist/runtime-governance.d.ts.map +1 -0
- package/dist/runtime-governance.js +103 -0
- package/dist/runtime-governance.js.map +1 -0
- package/dist/sandbox-pkg-source.d.ts +11 -0
- package/dist/sandbox-pkg-source.d.ts.map +1 -0
- package/dist/sandbox-pkg-source.js +56 -0
- package/dist/sandbox-pkg-source.js.map +1 -0
- package/dist/sealed-key.d.ts +29 -0
- package/dist/sealed-key.d.ts.map +1 -0
- package/dist/sealed-key.js +122 -0
- package/dist/sealed-key.js.map +1 -0
- package/dist/security.d.ts +153 -0
- package/dist/security.d.ts.map +1 -0
- package/dist/security.js +292 -0
- package/dist/security.js.map +1 -0
- package/dist/sema-registry.d.ts +187 -0
- package/dist/sema-registry.d.ts.map +1 -0
- package/dist/sema-registry.js +456 -0
- package/dist/sema-registry.js.map +1 -0
- package/dist/session-sync.d.ts +96 -0
- package/dist/session-sync.d.ts.map +1 -0
- package/dist/session-sync.js +181 -0
- package/dist/session-sync.js.map +1 -0
- package/dist/session-titler.d.ts +30 -0
- package/dist/session-titler.d.ts.map +1 -0
- package/dist/session-titler.js +77 -0
- package/dist/session-titler.js.map +1 -0
- package/dist/spec-fields.d.ts +5 -0
- package/dist/spec-fields.d.ts.map +1 -0
- package/dist/spec-fields.js +43 -0
- package/dist/spec-fields.js.map +1 -0
- package/dist/task-cwd.d.ts +15 -0
- package/dist/task-cwd.d.ts.map +1 -0
- package/dist/task-cwd.js +33 -0
- package/dist/task-cwd.js.map +1 -0
- package/dist/task-mcp.d.ts +20 -0
- package/dist/task-mcp.d.ts.map +1 -0
- package/dist/task-mcp.js +93 -0
- package/dist/task-mcp.js.map +1 -0
- package/dist/task-settings.d.ts +36 -0
- package/dist/task-settings.d.ts.map +1 -0
- package/dist/task-settings.js +141 -0
- package/dist/task-settings.js.map +1 -0
- package/dist/task-workflow.d.ts +25 -0
- package/dist/task-workflow.d.ts.map +1 -0
- package/dist/task-workflow.js +43 -0
- package/dist/task-workflow.js.map +1 -0
- package/dist/trace/artifacts.d.ts +17 -0
- package/dist/trace/artifacts.d.ts.map +1 -0
- package/dist/trace/artifacts.js +65 -0
- package/dist/trace/artifacts.js.map +1 -0
- package/dist/trace/project.d.ts +170 -0
- package/dist/trace/project.d.ts.map +1 -0
- package/dist/trace/project.js +239 -0
- package/dist/trace/project.js.map +1 -0
- package/dist/trace/redact.d.ts +5 -0
- package/dist/trace/redact.d.ts.map +1 -0
- package/dist/trace/redact.js +83 -0
- package/dist/trace/redact.js.map +1 -0
- package/dist/usage-analytics.d.ts +36 -0
- package/dist/usage-analytics.d.ts.map +1 -0
- package/dist/usage-analytics.js +89 -0
- package/dist/usage-analytics.js.map +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1,758 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# sema-up — Layer 0 薄 bootstrap(DEPLOY-OVERSEAS-PILOT §3/§3b/§3d,REV-3;2026-07-12 一键补完批次)。
|
|
3
|
+
# 三入口同一引擎:
|
|
4
|
+
# sema cloud deploy → 本脚本 --interactive=json(每决策点一行 JSON,stdin 读答案)
|
|
5
|
+
# curl | sh(TTY) → 本脚本无参(TTY prompt)
|
|
6
|
+
# 无人值守 → 本脚本 -f site.env --yes
|
|
7
|
+
# 纪律:幂等 check-then-apply;凭据只生成一次(重入不轮换);密码不入日志;不长状态管理
|
|
8
|
+
# (状态归 Layer 1 compose/helm 清单)。
|
|
9
|
+
# 形态:
|
|
10
|
+
# full-single 单机 docker 全栈(引擎+数据面)[+registry][+git]
|
|
11
|
+
# data-center 数据面(PG+MinIO)[+registry][+git],agent 在别处连
|
|
12
|
+
# local-plus 本机只跑 agent(docker),数据面在远端(data-center 档给的 endpoint)
|
|
13
|
+
# full-cluster k8s 路径:machines.yaml 多机 ssh 装配(cluster-up.sh)/ 已有 kubeconfig /
|
|
14
|
+
# 本机装 k3s(后两态=kube-up.sh,helm chart 驱动)
|
|
15
|
+
set -euo pipefail
|
|
16
|
+
|
|
17
|
+
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
18
|
+
MODE_INTERACTIVE="tty" # tty | json | none(--yes)
|
|
19
|
+
PROFILE="" USERS="" REGION="auto" CONF="" PROJECT="sema" TEARDOWN=false SKIP_PREFLIGHT=false
|
|
20
|
+
DATA_ROOT="" SERVER_PORT=8090 PG_PORT=5432 MINIO_PORT=9000 MINIO_CONSOLE_PORT=9001
|
|
21
|
+
GATEWAY="" MODEL="" MODEL_KEY="" SANDBOX_LANE="" REGISTRY_ENABLED="" REGISTRY_PORT="${REGISTRY_PORT:-3000}"
|
|
22
|
+
GIT_MODE="" GIT_URL="" GIT_TOKEN="" GIT_HTTP_PORT="${GIT_HTTP_PORT:-3300}" GIT_SSH_PORT="${GIT_SSH_PORT:-2222}"
|
|
23
|
+
KUBE_MODE="" KUBECONFIG_PATH="" DRY_RUN=false
|
|
24
|
+
AGENT_PG_HOST="" AGENT_PG_PASSWORD="" AGENT_MINIO_ENDPOINT="" AGENT_MINIO_PASSWORD=""
|
|
25
|
+
PG_URL="${PG_URL:-}" S3_ENDPOINT="${S3_ENDPOINT:-}" S3_ACCESS_KEY="${S3_ACCESS_KEY:-}" S3_SECRET_KEY="${S3_SECRET_KEY:-}"
|
|
26
|
+
|
|
27
|
+
usage() {
|
|
28
|
+
cat <<'EOF'
|
|
29
|
+
用法: sema-up.sh [选项]
|
|
30
|
+
--profile=P full-single|data-center|local-plus|full-cluster
|
|
31
|
+
--users=U single|multi
|
|
32
|
+
--region=R auto|cn|global
|
|
33
|
+
--interactive=json 机器可读交互协议(sema cloud deploy 渲染用)
|
|
34
|
+
--yes 全默认无人值守(与 -f 组合)
|
|
35
|
+
-f FILE site 配置(env 形式;machines.yaml=固定形状 mini-parser)
|
|
36
|
+
--project=NAME compose project 名(默认 sema;并行试验用)
|
|
37
|
+
--dry-run 只打印将执行计划(不写 .env、不起任何容器)
|
|
38
|
+
--port=N 服务端口(默认 8090);--pg-port/--minio-port/--minio-console-port 同理
|
|
39
|
+
--gateway=URL --model=ID --model-key=K 模型面(带 agent 的档必需)
|
|
40
|
+
--sandbox=LANE kata|e2b-cloud|runc(full-single)
|
|
41
|
+
--registry=BOOL 配置中心网站(默认 true;local-plus 默认 false)
|
|
42
|
+
--registry-image=REF sema-registry 镜像(registry=true 必需,可 -f 配置 SEMA_REGISTRY_IMAGE)
|
|
43
|
+
--git=MODE none(默认)|provision(一键自建 Gitea)|connect(接已有 git)
|
|
44
|
+
--git-url=URL --git-token=T git=connect 的已有服务(Gitea/GitHub/任意三方 git;自动识别,证书不校验)
|
|
45
|
+
--pg-url=URL 外接第三方 PG(postgres://user:pass@host:port/db;连不上会先检,不部署本地 PG)
|
|
46
|
+
--s3-endpoint=URL --s3-access-key=K --s3-secret-key=S 外接第三方 S3(兼容协议即可;不部署本地 MinIO)
|
|
47
|
+
--git-http-port=N --git-ssh-port=N 自建 Gitea 端口(默认 3300/2222)
|
|
48
|
+
--gitea-image=REF 自建 Gitea 镜像(默认 gitea/gitea:1.24)
|
|
49
|
+
--pg-host=H --pg-password=P --minio-endpoint=URL --minio-password=P local-plus 远端数据面
|
|
50
|
+
--kube=MODE full-cluster 单机两态:existing(已有 kubeconfig)|k3s(本机装 k3s)
|
|
51
|
+
--kubeconfig=PATH --kube=existing 的 kubeconfig(缺省 $KUBECONFIG 或 ~/.kube/config)
|
|
52
|
+
--teardown 卸载本 project(数据卷保留;--teardown-volumes 连卷删)
|
|
53
|
+
--skip-preflight 跳过预检(不建议)
|
|
54
|
+
EOF
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
TEARDOWN_VOLUMES=false
|
|
58
|
+
for a in "$@"; do case "$a" in
|
|
59
|
+
--profile=*) PROFILE="${a#*=}" ;;
|
|
60
|
+
--users=*) USERS="${a#*=}" ;;
|
|
61
|
+
--region=*) REGION="${a#*=}" ;;
|
|
62
|
+
--interactive=json) MODE_INTERACTIVE="json" ;;
|
|
63
|
+
--yes) MODE_INTERACTIVE="none" ;;
|
|
64
|
+
-f) ;; # 下一个参数处理
|
|
65
|
+
--project=*) PROJECT="${a#*=}" ;;
|
|
66
|
+
--dry-run) DRY_RUN=true ;;
|
|
67
|
+
--port=*) SERVER_PORT="${a#*=}" ;;
|
|
68
|
+
--pg-port=*) PG_PORT="${a#*=}" ;;
|
|
69
|
+
--minio-port=*) MINIO_PORT="${a#*=}" ;;
|
|
70
|
+
--minio-console-port=*) MINIO_CONSOLE_PORT="${a#*=}" ;;
|
|
71
|
+
--gateway=*) GATEWAY="${a#*=}" ;;
|
|
72
|
+
--model=*) MODEL="${a#*=}" ;;
|
|
73
|
+
--model-key=*) MODEL_KEY="${a#*=}" ;;
|
|
74
|
+
--sandbox=*) SANDBOX_LANE="${a#*=}" ;;
|
|
75
|
+
--registry=*) REGISTRY_ENABLED="${a#*=}" ;;
|
|
76
|
+
--registry-image=*) SEMA_REGISTRY_IMAGE="${a#*=}" ;;
|
|
77
|
+
--git=*) GIT_MODE="${a#*=}" ;;
|
|
78
|
+
--git-url=*) GIT_URL="${a#*=}" ;;
|
|
79
|
+
--git-token=*) GIT_TOKEN="${a#*=}" ;;
|
|
80
|
+
--git-http-port=*) GIT_HTTP_PORT="${a#*=}" ;;
|
|
81
|
+
--git-ssh-port=*) GIT_SSH_PORT="${a#*=}" ;;
|
|
82
|
+
--gitea-image=*) GITEA_IMAGE="${a#*=}" ;;
|
|
83
|
+
--pg-host=*) AGENT_PG_HOST="${a#*=}" ;;
|
|
84
|
+
--pg-password=*) AGENT_PG_PASSWORD="${a#*=}" ;;
|
|
85
|
+
--minio-endpoint=*) AGENT_MINIO_ENDPOINT="${a#*=}" ;;
|
|
86
|
+
--minio-password=*) AGENT_MINIO_PASSWORD="${a#*=}" ;;
|
|
87
|
+
--pg-url=*) PG_URL="${a#*=}" ;;
|
|
88
|
+
--s3-endpoint=*) S3_ENDPOINT="${a#*=}" ;;
|
|
89
|
+
--s3-access-key=*) S3_ACCESS_KEY="${a#*=}" ;;
|
|
90
|
+
--s3-secret-key=*) S3_SECRET_KEY="${a#*=}" ;;
|
|
91
|
+
--kube=*) KUBE_MODE="${a#*=}" ;;
|
|
92
|
+
--kubeconfig=*) KUBECONFIG_PATH="${a#*=}" ;;
|
|
93
|
+
--data-root=*) DATA_ROOT="${a#*=}" ;;
|
|
94
|
+
--teardown) TEARDOWN=true ;;
|
|
95
|
+
--teardown-volumes) TEARDOWN=true; TEARDOWN_VOLUMES=true ;;
|
|
96
|
+
--skip-preflight) SKIP_PREFLIGHT=true ;;
|
|
97
|
+
-h|--help) usage; exit 0 ;;
|
|
98
|
+
esac; done
|
|
99
|
+
# -f FILE:*.yaml/*.yml 走 mini-parser(固定形状,fail-loud);其余按 env 形式 source
|
|
100
|
+
prev=""; for a in "$@"; do [ "$prev" = "-f" ] && CONF="$a"; prev="$a"; done
|
|
101
|
+
if [ -n "$CONF" ]; then
|
|
102
|
+
[ -r "$CONF" ] || { echo "config 不可读: $CONF" >&2; exit 1; }
|
|
103
|
+
case "$CONF" in
|
|
104
|
+
*.yaml|*.yml)
|
|
105
|
+
PARSED="$(python3 "$HERE/lib/parse-machines.py" "$CONF")" || exit 1
|
|
106
|
+
_P="$PROFILE" _U="$USERS" _R="$REGION" # 命令行显式参数赢过 yaml
|
|
107
|
+
set -a; eval "$PARSED"; set +a
|
|
108
|
+
[ -n "$_P" ] && PROFILE="$_P"; [ -n "$_U" ] && USERS="$_U"; [ "$_R" != "auto" ] && REGION="$_R"
|
|
109
|
+
if [ "${MACHINE_COUNT:-0}" -ge 3 ] && [ -z "$PROFILE" ]; then PROFILE="full-cluster"; fi
|
|
110
|
+
;;
|
|
111
|
+
*) set -a; . "$CONF"; set +a ;;
|
|
112
|
+
esac
|
|
113
|
+
fi
|
|
114
|
+
|
|
115
|
+
WORK="$HOME/.sema-up/$PROJECT"; mkdir -p "$WORK"; chmod 700 "$HOME/.sema-up" "$WORK"
|
|
116
|
+
# 协议流(--interactive=json 的 question/summary 行)固定走 fd3=原始 stdout——
|
|
117
|
+
# $(ask …) 的命令替换只捕获答案,协议行不被吞(真机验出的坑)
|
|
118
|
+
exec 3>&1
|
|
119
|
+
log() { printf '[sema-up] %s\n' "$*" >&2; }
|
|
120
|
+
|
|
121
|
+
# compose 入口解析:优先 docker compose(插件),缺了退 docker-compose(独立版)——
|
|
122
|
+
# homebrew 裸 docker CLI 不带插件是真场景;都没有=报错带下一步
|
|
123
|
+
dc() {
|
|
124
|
+
if docker compose version >/dev/null 2>&1; then docker compose "$@"
|
|
125
|
+
elif command -v docker-compose >/dev/null 2>&1; then docker-compose "$@"
|
|
126
|
+
else log "⛔ 没有可用的 compose(docker compose 插件/docker-compose 都缺)。下一步:装 Docker Desktop/OrbStack,或 brew install docker-compose"; exit 1; fi
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
# ── 跨平台探针(Linux 目标机为主;macOS 开发机跑 docker 档也是真场景——npx 分发)────────────
|
|
130
|
+
ram_mb() { if [ -r /proc/meminfo ]; then awk '/MemTotal/{printf "%d", $2/1024}' /proc/meminfo
|
|
131
|
+
else sysctl -n hw.memsize 2>/dev/null | awk '{printf "%d", $1/1048576}'; fi; }
|
|
132
|
+
ncpus() { nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2; }
|
|
133
|
+
host_ip() { hostname -I 2>/dev/null | awk '{print $1}' | grep . \
|
|
134
|
+
|| ipconfig getifaddr en0 2>/dev/null || echo 127.0.0.1; }
|
|
135
|
+
|
|
136
|
+
# ── 交互引擎:ask <id> <question> <default> <why> <opt1>:<label1>[:infeasible=原因|建议] … ──────
|
|
137
|
+
# 答案回显到 stdout 由调用方捕获;json 模式=stdout 一行协议,stdin 读答案;none=取默认。
|
|
138
|
+
ask() {
|
|
139
|
+
local id="$1" q="$2" def="$3" why="$4"; shift 4
|
|
140
|
+
local ans=""
|
|
141
|
+
case "$MODE_INTERACTIVE" in
|
|
142
|
+
none) ans="$def" ;;
|
|
143
|
+
json)
|
|
144
|
+
local opts="" v l inf reason fix
|
|
145
|
+
for o in "$@"; do
|
|
146
|
+
v="${o%%:*}"; l="${o#*:}"; inf="null"
|
|
147
|
+
if [[ "$l" == *":infeasible="* ]]; then
|
|
148
|
+
local infpart="${l#*:infeasible=}"; l="${l%%:infeasible=*}"
|
|
149
|
+
reason="${infpart%%|*}"; fix="${infpart#*|}"
|
|
150
|
+
inf="{\"reason\":\"$reason\",\"suggestion\":\"$fix\"}"
|
|
151
|
+
fi
|
|
152
|
+
opts="$opts{\"value\":\"$v\",\"label\":\"$l\",\"infeasible\":$inf},"
|
|
153
|
+
done
|
|
154
|
+
printf '{"type":"question","id":"%s","question":"%s","default":"%s","why":"%s","options":[%s]}\n' \
|
|
155
|
+
"$id" "$q" "$def" "$why" "${opts%,}" >&3
|
|
156
|
+
IFS= read -r ans || ans="$def"; [ -z "$ans" ] && ans="$def"
|
|
157
|
+
;;
|
|
158
|
+
tty)
|
|
159
|
+
{
|
|
160
|
+
printf '\n%s\n' "$q"
|
|
161
|
+
local i=1 v l
|
|
162
|
+
for o in "$@"; do v="${o%%:*}"; l="${o#*:}"; l="${l%%:infeasible=*}"
|
|
163
|
+
if [[ "$o" == *":infeasible="* ]]; then local infpart="${o#*:infeasible=}"
|
|
164
|
+
printf ' %d) %s — %s ⛔ %s(建议:%s)\n' "$i" "$v" "$l" "${infpart%%|*}" "${infpart#*|}"
|
|
165
|
+
else printf ' %d) %s — %s\n' "$i" "$v" "$l"; fi
|
|
166
|
+
i=$((i+1)); done
|
|
167
|
+
printf '默认 [%s](为什么问:%s): ' "$def" "$why"
|
|
168
|
+
} >&2
|
|
169
|
+
IFS= read -r ans </dev/tty || ans=""; [ -z "$ans" ] && ans="$def"
|
|
170
|
+
# 数字选择转值
|
|
171
|
+
if [[ "$ans" =~ ^[0-9]+$ ]] && [ "$#" -gt 0 ]; then local i=1; for o in "$@"; do [ "$i" = "$ans" ] && ans="${o%%:*}"; i=$((i+1)); done; fi
|
|
172
|
+
;;
|
|
173
|
+
esac
|
|
174
|
+
# infeasible 选项拒绝(fail-loud 非静默降级)
|
|
175
|
+
for o in "$@"; do
|
|
176
|
+
if [ "${o%%:*}" = "$ans" ] && [[ "$o" == *":infeasible="* ]]; then
|
|
177
|
+
local infpart="${o#*:infeasible=}"
|
|
178
|
+
log "⛔ 选项 $ans 在本机不可行:${infpart%%|*};建议:${infpart#*|}"; exit 1
|
|
179
|
+
fi
|
|
180
|
+
done
|
|
181
|
+
printf '%s' "$ans"
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
emit() { [ "$MODE_INTERACTIVE" = "json" ] && printf '%s\n' "$1" >&3 || log "$2"; }
|
|
185
|
+
|
|
186
|
+
# ── teardown ─────────────────────────────────────────────────────────────────────────────────
|
|
187
|
+
if $TEARDOWN; then
|
|
188
|
+
cd "$HERE/stack"
|
|
189
|
+
if [ -f "$WORK/.env" ]; then
|
|
190
|
+
OV=""; grep -q '^DATA_ROOT_DIR=..*' "$WORK/.env" && OV="-f compose.dataroot.yaml"
|
|
191
|
+
# 全 profile down 会对未启用服务也做 config 校验——.env 缺 SEMA_*_IMAGE(该面没开过)时
|
|
192
|
+
# 整个 down 失败(真踩:假「已卸载」)。补占位符只为过校验;shell env 优先级高于 --env-file
|
|
193
|
+
grep -q '^SEMA_SERVER_IMAGE=..*' "$WORK/.env" || export SEMA_SERVER_IMAGE="teardown-placeholder"
|
|
194
|
+
grep -q '^SEMA_REGISTRY_IMAGE=..*' "$WORK/.env" || export SEMA_REGISTRY_IMAGE="teardown-placeholder"
|
|
195
|
+
if ! dc --project-name "$PROJECT" --env-file "$WORK/.env" -f compose.yaml $OV \
|
|
196
|
+
--profile data --profile pg --profile s3 --profile agent --profile registry --profile git \
|
|
197
|
+
down $($TEARDOWN_VOLUMES && echo -v); then
|
|
198
|
+
log "⛔ 卸载未完全成功。下一步:docker ps -a --filter label=com.docker.compose.project=$PROJECT 手查残留"
|
|
199
|
+
exit 1
|
|
200
|
+
fi
|
|
201
|
+
log "已卸载 project=$PROJECT $($TEARDOWN_VOLUMES && echo '(含数据卷)' || echo '(数据卷保留:pgdata/miniodata/registrydata/gitdata)')"
|
|
202
|
+
if $TEARDOWN_VOLUMES && [ -n "$OV" ]; then
|
|
203
|
+
DR="$(grep '^DATA_ROOT_DIR=' "$WORK/.env" | head -1 | cut -d= -f2-)"
|
|
204
|
+
# ${DR} 必须带花括号:后面紧跟中文破折号,bash 3.2(macOS 系统壳)会把多字节并进变量名(真踩)
|
|
205
|
+
log "⚠ 数据根在大盘 bind 目录 ${DR}——卷对象已删,盘上文件还在;确认不要了再手动 rm -rf"
|
|
206
|
+
fi
|
|
207
|
+
else log "没有找到 $WORK/.env,无可卸载"; fi
|
|
208
|
+
exit 0
|
|
209
|
+
fi
|
|
210
|
+
|
|
211
|
+
KVM_OK=$([ -e /dev/kvm ] && echo true || echo false)
|
|
212
|
+
|
|
213
|
+
# ── 决策点(三轴+registry+git,§3b;问句都带「为什么问」)─────────────────────────────────────
|
|
214
|
+
[ -z "$PROFILE" ] && PROFILE=$(ask profile "要装成哪种形态?" "full-single" "决定这台机器上起哪些服务" \
|
|
215
|
+
"full-single:单机全栈——引擎+数据库+对象存储都在这台机(最快起步)" \
|
|
216
|
+
"data-center:只装数据面(PG+MinIO+备份)——agent 在你自己机器上,数据放这里" \
|
|
217
|
+
"full-cluster:k8s 准生产——3 机 ssh 装配 / 已有集群 kubeconfig / 本机装 k3s" \
|
|
218
|
+
"local-plus:本机只跑 agent,连一个已经部署好的 data-center 数据面")
|
|
219
|
+
[ -z "$USERS" ] && USERS=$(ask users "几个人用?" "single" "单人可跳过全部权限配置,多人要开身份隔离" \
|
|
220
|
+
"single:就我一个(超级管理员 turnkey,零权限配置)" \
|
|
221
|
+
"multi:一个团队(身份隔离 ON,能力默认全开,之后可用 policy 收紧)")
|
|
222
|
+
|
|
223
|
+
# registry:各档默认带上(clay 2026-07-12 拍;显式 --registry=false 可关)。
|
|
224
|
+
# local-plus 例外默认 false——它的数据面在远端,配置中心应随数据面部署,本机再起一个=两个配置中心。
|
|
225
|
+
if [ -z "$REGISTRY_ENABLED" ]; then
|
|
226
|
+
if [ "$PROFILE" = "local-plus" ]; then REGISTRY_ENABLED=false; else REGISTRY_ENABLED=true; fi
|
|
227
|
+
fi
|
|
228
|
+
|
|
229
|
+
# git 面三态(none 默认;provision=一键自建 Gitea;connect=接已有)
|
|
230
|
+
[ -z "$GIT_MODE" ] && GIT_MODE=$(ask git "要带 git 仓库服务吗?" "none" "agent 干活要有代码仓;没有的话可以现装一个" \
|
|
231
|
+
"none:不带(已有别的地方管代码,或暂时用不上)" \
|
|
232
|
+
"provision:一键自建 Gitea(本机起一个 git 服务,含管理员账号)" \
|
|
233
|
+
"connect:接已有的 git 服务(自建 Gitea 或 GitHub,填地址+token)")
|
|
234
|
+
case "$GIT_MODE" in none|provision|connect) : ;; *) log "⛔ --git 只认 none|provision|connect(收到:$GIT_MODE)"; exit 1 ;; esac
|
|
235
|
+
if [ "$GIT_MODE" = "connect" ]; then
|
|
236
|
+
[ -z "$GIT_URL" ] && { [ "$MODE_INTERACTIVE" = "none" ] && { log "⛔ --git=connect 需要 --git-url(如 https://gitea.example.com 或 https://github.com/<org>)"; exit 1; } || GIT_URL=$(ask git_url "git 服务地址?(如 https://gitea.example.com)" "" "要验证连通并登记进配置中心"); }
|
|
237
|
+
[ -z "$GIT_TOKEN" ] && { [ "$MODE_INTERACTIVE" = "none" ] && { log "⛔ --git=connect 需要 --git-token(该服务的 access token)"; exit 1; } || GIT_TOKEN=$(ask git_token "该服务的 access token?" "" "验证连通用;Gitea 还会用它自动建 OAuth 登录应用"); }
|
|
238
|
+
fi
|
|
239
|
+
|
|
240
|
+
if [ "$PROFILE" = "full-single" ] && [ -z "$SANDBOX_LANE" ]; then
|
|
241
|
+
if [ "$KVM_OK" = "true" ]; then
|
|
242
|
+
SANDBOX_LANE=$(ask sandbox "agent 跑代码用哪种沙箱?" "kata" "本机有 KVM,VM 级隔离可用" \
|
|
243
|
+
"kata:Kata VM(默认建议,VM 级隔离)" "e2b-cloud:E2B 云沙箱(填 key 即用)" "runc:容器隔离(弱于 VM,不建议生产)")
|
|
244
|
+
else
|
|
245
|
+
SANDBOX_LANE=$(ask sandbox "agent 跑代码用哪种沙箱?" "e2b-cloud" "本机无 KVM,kata 不可行" \
|
|
246
|
+
"kata:Kata VM:infeasible=本机无虚拟化支持(/dev/kvm 缺失)|云上开嵌套虚拟化/换 bare metal,或选 e2b" \
|
|
247
|
+
"e2b-cloud:E2B 云沙箱(填 key,海外快)" "runc:容器隔离(弱于 VM,不建议生产)")
|
|
248
|
+
fi
|
|
249
|
+
fi
|
|
250
|
+
if [ "$PROFILE" = "full-single" ] || [ "$PROFILE" = "local-plus" ]; then
|
|
251
|
+
[ -z "$GATEWAY" ] && { [ "$MODE_INTERACTIVE" = "none" ] && { log "⛔ $PROFILE 档要跑 agent,需要 --gateway/--model(模型面)。例:--gateway=https://api.deepseek.com/v1 --model=deepseek-v4-flash --model-key=sk-…"; exit 1; } || GATEWAY=$(ask gateway "模型网关 baseURL?(OpenAI 兼容,如 https://api.deepseek.com/v1)" "" "引擎的大脑入口,没有它 agent 无法思考"); }
|
|
252
|
+
[ -z "$MODEL" ] && MODEL=$(ask model "模型 id?" "deepseek-v4-flash" "按成本推荐 flash;要更强推理换 pro")
|
|
253
|
+
fi
|
|
254
|
+
if [ "$PROFILE" = "local-plus" ]; then
|
|
255
|
+
[ -z "$AGENT_PG_HOST" ] && { [ "$MODE_INTERACTIVE" = "none" ] && { log "⛔ local-plus 需要 --pg-host(data-center 档 summary 里的 PG 地址)"; exit 1; } || AGENT_PG_HOST=$(ask pg_host "远端 PG 地址?(data-center 部署完 summary 里有)" "" "agent 的会话/任务都持久化到这里"); }
|
|
256
|
+
[ -z "$AGENT_PG_PASSWORD" ] && { [ "$MODE_INTERACTIVE" = "none" ] && { log "⛔ local-plus 需要 --pg-password(data-center 机器 ~/.sema-up/<project>/.env 里的 PG_PASSWORD)"; exit 1; } || AGENT_PG_PASSWORD=$(ask pg_password "远端 PG 密码?(data-center 机器 .env 里的 PG_PASSWORD)" "" "连接数据面的凭据"); }
|
|
257
|
+
[ -z "$AGENT_MINIO_ENDPOINT" ] && { [ "$MODE_INTERACTIVE" = "none" ] && { log "⛔ local-plus 需要 --minio-endpoint(如 http://<data-center-ip>:9000)"; exit 1; } || AGENT_MINIO_ENDPOINT=$(ask minio_endpoint "远端对象存储地址?(如 http://<data-center-ip>:9000)" "" "工作区/大对象放这里"); }
|
|
258
|
+
[ -z "$AGENT_MINIO_PASSWORD" ] && { [ "$MODE_INTERACTIVE" = "none" ] && { log "⛔ local-plus 需要 --minio-password(data-center .env 里的 MINIO_PASSWORD)"; exit 1; } || AGENT_MINIO_PASSWORD=$(ask minio_password "远端对象存储密码?(data-center .env 里的 MINIO_PASSWORD)" "" "连接对象存储的凭据"); }
|
|
259
|
+
fi
|
|
260
|
+
|
|
261
|
+
# ── full-cluster 路由(k8s 路径;本地不做 docker 预检)───────────────────────────────────────
|
|
262
|
+
if [ "$PROFILE" = "full-cluster" ]; then
|
|
263
|
+
[ -z "$GATEWAY" ] && { [ "$MODE_INTERACTIVE" = "none" ] && { log "⛔ full-cluster 需要 --gateway/--model(模型面)"; exit 1; } || GATEWAY=$(ask gateway "模型网关 baseURL?(OpenAI 兼容)" "" "引擎的大脑入口"); }
|
|
264
|
+
[ -z "$MODEL" ] && MODEL=$(ask model "模型 id?" "deepseek-v4-flash" "按成本推荐 flash")
|
|
265
|
+
if [ "${MACHINE_COUNT:-0}" -ge 1 ]; then
|
|
266
|
+
KUBE_MODE="machines" # machines.yaml 在场=多机 ssh 装配(as-built 原路径)
|
|
267
|
+
fi
|
|
268
|
+
[ -z "$KUBE_MODE" ] && KUBE_MODE=$(ask kube "k8s 从哪来?" "existing" "决定是连现有集群还是现装一个" \
|
|
269
|
+
"existing:已有 k8s(kubeconfig 指向;kind/k3d/云商托管都行)" \
|
|
270
|
+
"k3s:本机现装 k3s 单机集群(Linux;再 helm 装栈)" \
|
|
271
|
+
"machines:多机 ssh 装配 k3s HA(要 -f machines.yaml)")
|
|
272
|
+
case "$KUBE_MODE" in
|
|
273
|
+
machines)
|
|
274
|
+
[ "${MACHINE_COUNT:-0}" -ge 1 ] || { log "⛔ --kube=machines 需要 -f machines.yaml(机器清单);模板见 deploy/sema-up/machines.example.yaml"; exit 1; }
|
|
275
|
+
$DRY_RUN && { log "dry-run:将经 cluster-up.sh 对 ${MACHINE_COUNT} 台机器做 k3s HA 装配(ssh)+ helm/render 装栈;不执行"; exit 0; }
|
|
276
|
+
WORK="$WORK" REGION="$REGION" PROJECT="$PROJECT" \
|
|
277
|
+
MODEL_GATEWAY_BASEURL="$GATEWAY" MODEL_ID="$MODEL" MODEL_API_KEY="${MODEL_KEY:-${MODEL_API_KEY:-}}" \
|
|
278
|
+
exec "$HERE/cluster-up.sh"
|
|
279
|
+
;;
|
|
280
|
+
existing|k3s)
|
|
281
|
+
# kube-up.sh:同一 .env 词表(SEMA_REGISTRY_IMAGE/REGISTRY_*/GIT_* 原样传);它自己做 k8s 侧预检
|
|
282
|
+
WORK="$WORK" REGION="$REGION" PROJECT="$PROJECT" KUBE_MODE="$KUBE_MODE" \
|
|
283
|
+
KUBECONFIG_PATH="${KUBECONFIG_PATH:-${KUBECONFIG:-}}" DRY_RUN="$DRY_RUN" \
|
|
284
|
+
USERS="$USERS" REGISTRY_ENABLED="$REGISTRY_ENABLED" GIT_MODE="$GIT_MODE" \
|
|
285
|
+
GIT_URL="$GIT_URL" GIT_TOKEN="$GIT_TOKEN" \
|
|
286
|
+
SEMA_SERVER_IMAGE="${SEMA_SERVER_IMAGE:-}" SEMA_REGISTRY_IMAGE="${SEMA_REGISTRY_IMAGE:-}" \
|
|
287
|
+
GITEA_IMAGE="${GITEA_IMAGE:-}" \
|
|
288
|
+
MODEL_GATEWAY_BASEURL="$GATEWAY" MODEL_ID="$MODEL" MODEL_API_KEY="${MODEL_KEY:-${MODEL_API_KEY:-}}" \
|
|
289
|
+
exec "$HERE/kube-up.sh"
|
|
290
|
+
;;
|
|
291
|
+
*) log "⛔ --kube 只认 existing|k3s|machines(收到:$KUBE_MODE)"; exit 1 ;;
|
|
292
|
+
esac
|
|
293
|
+
fi
|
|
294
|
+
|
|
295
|
+
# ── 预检(决策已定,端口面按真实激活服务算;§3d-2:BLOCK 项带原因+建议)────────────────────
|
|
296
|
+
PF_PORTS=""
|
|
297
|
+
if ! $SKIP_PREFLIGHT; then
|
|
298
|
+
# 端口面按真实要起的服务算(外接 PG/S3 的口不占本机)
|
|
299
|
+
case "$PROFILE" in
|
|
300
|
+
data-center) PF_PORTS="" ;;
|
|
301
|
+
local-plus) PF_PORTS="$SERVER_PORT" ;;
|
|
302
|
+
*) PF_PORTS="$SERVER_PORT" ;;
|
|
303
|
+
esac
|
|
304
|
+
if [ "$PROFILE" != "local-plus" ]; then
|
|
305
|
+
[ -z "$PG_URL" ] && PF_PORTS="$PF_PORTS,$PG_PORT"
|
|
306
|
+
[ -z "$S3_ENDPOINT" ] && PF_PORTS="$PF_PORTS,$MINIO_PORT,$MINIO_CONSOLE_PORT"
|
|
307
|
+
PF_PORTS="${PF_PORTS#,}"
|
|
308
|
+
fi
|
|
309
|
+
[ "$REGISTRY_ENABLED" = "true" ] && PF_PORTS="$PF_PORTS,$REGISTRY_PORT"
|
|
310
|
+
[ "$GIT_MODE" = "provision" ] && PF_PORTS="$PF_PORTS,$GIT_HTTP_PORT,$GIT_SSH_PORT"
|
|
311
|
+
# 重入幂等:本 project 自己已发布的端口不算占用(否则第二遍必被自己 BLOCK——真踩);
|
|
312
|
+
# 别的 project/进程占着照样 BLOCK
|
|
313
|
+
if command -v docker >/dev/null 2>&1; then
|
|
314
|
+
# 注意 {{.Ports}} 的范围语法(0.0.0.0:9000-9001->…)——按范围展开,别只匹配单口(真踩)
|
|
315
|
+
# 尾部 || true:project 还没起(零匹配)时 grep 退 1,pipefail+set -e 会静默杀脚本(真踩)
|
|
316
|
+
SELF_PORTS="$(docker ps --filter "label=com.docker.compose.project=$PROJECT" --format '{{.Ports}}' 2>/dev/null \
|
|
317
|
+
| { grep -oE ':[0-9]+(-[0-9]+)?->' || true; } | sed 's/[:>-]*$//;s/^://' \
|
|
318
|
+
| while IFS=- read -r a b; do seq "$a" "${b:-$a}"; done | sort -u | tr '\n' ' ')"
|
|
319
|
+
if [ -n "${SELF_PORTS// /}" ]; then
|
|
320
|
+
NEW_PORTS=""
|
|
321
|
+
for p in $(printf '%s' "$PF_PORTS" | tr ',' ' '); do
|
|
322
|
+
case " $SELF_PORTS " in *" $p "*) : ;; *) NEW_PORTS="$NEW_PORTS,$p" ;; esac
|
|
323
|
+
done
|
|
324
|
+
PF_PORTS="${NEW_PORTS#,}"
|
|
325
|
+
fi
|
|
326
|
+
fi
|
|
327
|
+
PF="$("$HERE/preflight.sh" --json --profile="${PROFILE:-full}" --ports="$PF_PORTS")" || {
|
|
328
|
+
emit "{\"type\":\"preflight\",\"deployable\":false,\"findings\":$(printf '%s' "$PF" | sed 's/.*"findings"://;s/,"deployable".*//')}" "预检未过:"
|
|
329
|
+
printf '%s\n' "$PF" | python3 -c 'import json,sys
|
|
330
|
+
d=json.load(sys.stdin)
|
|
331
|
+
for f in d["findings"]:
|
|
332
|
+
# 不用 f-string:表达式里的 \" 转义在 python3.12 前非法(真踩,吞掉了 BLOCK 原因)
|
|
333
|
+
if f["level"]=="BLOCK": print("⛔ %s: %s — %s\n ↳ 建议:%s" % (f["check"], f["result"], f["reason"], f["suggestion"]))' >&2
|
|
334
|
+
exit 1
|
|
335
|
+
}
|
|
336
|
+
emit "{\"type\":\"preflight\",\"deployable\":true}" "预检通过"
|
|
337
|
+
# 建议不强求:预检过了也把 WARN 的建议念出来(--yes 无人值守同样看得见,不然建议白算)
|
|
338
|
+
printf '%s\n' "$PF" | python3 -c 'import json,sys
|
|
339
|
+
d=json.load(sys.stdin)
|
|
340
|
+
for f in d["findings"]:
|
|
341
|
+
if f["level"]=="WARN" and f.get("suggestion"):
|
|
342
|
+
print("⚠ %s: %s — %s\n ↳ 建议:%s" % (f["check"], f["result"], f["reason"], f["suggestion"]))' >&2 || true
|
|
343
|
+
fi
|
|
344
|
+
|
|
345
|
+
# ── region(落三处:OS 源/registry mirror/SANDBOX_PKG_SOURCE) ────────────────────────────────
|
|
346
|
+
if [ "$REGION" = "auto" ]; then
|
|
347
|
+
t_cn=$(curl -m3 -so /dev/null -w '%{time_total}' https://mirrors.aliyun.com 2>/dev/null || echo 99)
|
|
348
|
+
t_gl=$(curl -m3 -so /dev/null -w '%{time_total}' https://registry.npmjs.org 2>/dev/null || echo 99)
|
|
349
|
+
REGION=$(awk -v a="$t_cn" -v b="$t_gl" 'BEGIN{print (a<b)?"cn":"global"}')
|
|
350
|
+
fi
|
|
351
|
+
HOSTIP=$(host_ip)
|
|
352
|
+
log "region=$REGION profile=$PROFILE users=$USERS sandbox=${SANDBOX_LANE:-n/a} registry=$REGISTRY_ENABLED git=$GIT_MODE"
|
|
353
|
+
|
|
354
|
+
# ── 数据盘选择(多盘机自动选大容量盘;--data-root 显式优先;macOS 不自动——bind 要经 VM 挂载,
|
|
355
|
+
# 显式给了才用)。首装落 .env 后不漂移:换盘=先 --teardown-volumes 迁数据再重装。──────────────
|
|
356
|
+
if [ -z "$DATA_ROOT" ] && [ "$(uname -s)" = "Linux" ] && [ "$PROFILE" != "local-plus" ]; then
|
|
357
|
+
ROOT_AVAIL=$(df -BG --output=avail / 2>/dev/null | tail -1 | tr -dc '0-9'); ROOT_AVAIL=${ROOT_AVAIL:-0}
|
|
358
|
+
BEST_LINE=$(df -BG --output=source,avail,target 2>/dev/null | awk '$1 ~ /^\/dev\// && $3 != "/" && $3 !~ /^\/(boot|efi)/ {gsub(/G/,"",$2); print $2"\t"$3}' | sort -rn | head -1)
|
|
359
|
+
BEST_GB="${BEST_LINE%%$'\t'*}"; BEST_MNT="${BEST_LINE#*$'\t'}"
|
|
360
|
+
# 逻辑闸:候选盘要「明显更大」(>2× 根盘可用)才自动切,免得在两块差不多的盘之间抖
|
|
361
|
+
if [ -n "$BEST_LINE" ] && [ "${BEST_GB:-0}" -gt $(( ROOT_AVAIL * 2 )) ]; then
|
|
362
|
+
DATA_ROOT="$BEST_MNT/sema-data"
|
|
363
|
+
log "多盘机:自动选大容量盘 $BEST_MNT(${BEST_GB}G avail,根盘 ${ROOT_AVAIL}G)→ 数据根 $DATA_ROOT(--data-root 可覆盖)"
|
|
364
|
+
fi
|
|
365
|
+
fi
|
|
366
|
+
|
|
367
|
+
# ── 必需镜像的显式校验(在 dry-run/写 .env 之前,报错带下一步动作)────────────────────────────
|
|
368
|
+
# 数据面细分:外接第三方 PG(--pg-url)/S3(--s3-endpoint)时对应服务不本地部署
|
|
369
|
+
DATA_FACE=""
|
|
370
|
+
if [ "$PROFILE" = "data-center" ] || [ "$PROFILE" = "full-single" ]; then
|
|
371
|
+
[ -z "$PG_URL" ] && DATA_FACE="pg"
|
|
372
|
+
[ -z "$S3_ENDPOINT" ] && DATA_FACE="$DATA_FACE,s3"
|
|
373
|
+
DATA_FACE="${DATA_FACE#,}"
|
|
374
|
+
fi
|
|
375
|
+
if [ -n "$S3_ENDPOINT" ] && { [ -z "$S3_ACCESS_KEY" ] || [ -z "$S3_SECRET_KEY" ]; }; then
|
|
376
|
+
log "⛔ --s3-endpoint 需要配套 --s3-access-key/--s3-secret-key(S3 兼容协议的一对密钥)"; exit 1
|
|
377
|
+
fi
|
|
378
|
+
COMPOSE_PROFILES="$DATA_FACE"
|
|
379
|
+
case "$PROFILE" in full-single|local-plus) COMPOSE_PROFILES="$COMPOSE_PROFILES,agent" ;; esac
|
|
380
|
+
[ "$REGISTRY_ENABLED" = "true" ] && COMPOSE_PROFILES="$COMPOSE_PROFILES,registry"
|
|
381
|
+
[ "$GIT_MODE" = "provision" ] && COMPOSE_PROFILES="$COMPOSE_PROFILES,git"
|
|
382
|
+
COMPOSE_PROFILES="${COMPOSE_PROFILES#,}"; COMPOSE_PROFILES="${COMPOSE_PROFILES%,}"
|
|
383
|
+
ENVF="$WORK/.env"
|
|
384
|
+
has_env() { [ -f "$ENVF" ] && grep -q "^$1=..*" "$ENVF"; }
|
|
385
|
+
case ",$COMPOSE_PROFILES," in *,agent,*)
|
|
386
|
+
if [ -z "${SEMA_SERVER_IMAGE:-}" ] && ! has_env SEMA_SERVER_IMAGE; then
|
|
387
|
+
log "⛔ $PROFILE 档需要 sema-server 镜像。下一步:-f 配置里加 SEMA_SERVER_IMAGE=<registry>/sema-server:<tag>(默认=ghcr.io/clayboby/sema-server:<tag> 公开仓匿名可拉;CN 兜底=内网 Gitea 仓;SWR 已弃用);镜像分发=D4"
|
|
388
|
+
exit 1
|
|
389
|
+
fi ;;
|
|
390
|
+
esac
|
|
391
|
+
if [ "$REGISTRY_ENABLED" = "true" ] && [ -z "${SEMA_REGISTRY_IMAGE:-}" ] && ! has_env SEMA_REGISTRY_IMAGE; then
|
|
392
|
+
log "⛔ registry=true(现在是各档默认)需要 sema-registry 镜像。下一步(三选一):"
|
|
393
|
+
log " ① --registry-image=ghcr.io/clayboby/sema-registry:<tag>(GHCR/Hub 公开仓,匿名可拉;SWR 已弃用)"
|
|
394
|
+
log " ② -f 配置里加 SEMA_REGISTRY_IMAGE=<你的仓>/sema-registry:<tag>"
|
|
395
|
+
log " ③ 不要配置中心:--registry=false"
|
|
396
|
+
exit 1
|
|
397
|
+
fi
|
|
398
|
+
|
|
399
|
+
# ── dry-run:打印将执行计划,零改动退出 ───────────────────────────────────────────────────────
|
|
400
|
+
if $DRY_RUN; then
|
|
401
|
+
{
|
|
402
|
+
echo "══════ sema-up dry-run(不写文件、不起容器)══════"
|
|
403
|
+
echo " profile=$PROFILE users=$USERS region=$REGION registry=$REGISTRY_ENABLED git=$GIT_MODE"
|
|
404
|
+
echo " compose profiles: $COMPOSE_PROFILES(project=$PROJECT)"
|
|
405
|
+
echo " 凭据文件: $ENVF $([ -f "$ENVF" ] && echo '(已存在:只补缺,已有凭据不轮换)' || echo '(将新建,0600)')"
|
|
406
|
+
echo " 将执行:"
|
|
407
|
+
echo " 1. 生成/补齐 .env(PG/MinIO/API token$([ "$REGISTRY_ENABLED" = "true" ] && printf ';registry 管理员/SESSION_SECRET/PULL_TOKEN')$([ "$GIT_MODE" = "provision" ] && printf ';Gitea 管理员'))"
|
|
408
|
+
[ "$GIT_MODE" = "provision" ] && echo " 2. 先起 Gitea → 引导管理员+access token$([ "$REGISTRY_ENABLED" = "true" ] && printf '+OAuth app(接 registry 登录)')"
|
|
409
|
+
[ -n "$PG_URL$S3_ENDPOINT" ] && echo " 2b. 外接端点连接检测(PG=真 select 1;S3=兼容协议 ls+建桶;证书不校验)"
|
|
410
|
+
echo " 3. docker compose up -d --wait(profiles=$COMPOSE_PROFILES)$([ -n "$DATA_ROOT" ] && printf ';数据卷 bind → %s' "$DATA_ROOT")"
|
|
411
|
+
case ",$COMPOSE_PROFILES," in *,s3,*) echo " 4. MinIO 建桶 workspaces/blobs/backups(幂等)" ;; esac
|
|
412
|
+
[ "$GIT_MODE" = "connect" ] && echo " +. 验证 $GIT_URL 连通(Gitea→GitHub→通用 git 探测链,证书不校验;Gitea=自动建 OAuth app,其余=打印待人工项)"
|
|
413
|
+
echo " 5. 装后即验(PG/S3$([ "$PROFILE" != "data-center" ] && printf '/引擎 health')$([ "$REGISTRY_ENABLED" = "true" ] && printf '/registry healthz')$([ "$GIT_MODE" = "provision" ] && printf '/gitea healthz'))+ 一屏 summary"
|
|
414
|
+
echo " 端口: $PF_PORTS(bind:数据面 $([ "$PROFILE" = "data-center" ] && echo 0.0.0.0 || echo 127.0.0.1);服务/registry/git 0.0.0.0)"
|
|
415
|
+
echo " 卸载: $0 --project=$PROJECT --teardown(留数据)/--teardown-volumes(连卷删)"
|
|
416
|
+
echo "═══════════════════════════════════════════════"
|
|
417
|
+
} >&2
|
|
418
|
+
exit 0
|
|
419
|
+
fi
|
|
420
|
+
|
|
421
|
+
# ── PG 调优(§3c pgtune 公式;SSD 假设)────────────────────────────────────────────────────────
|
|
422
|
+
# 基数=容器真正跑的那台机:docker 后端内存(macOS 上 VM 常远小于宿主——32G Mac 配 2G colima VM,
|
|
423
|
+
# 按宿主算出的 shared_buffers=8G 会让 PG 直接起不来);拿不到再退宿主探测
|
|
424
|
+
RAM_MB="$(docker info --format '{{.MemTotal}}' 2>/dev/null | awk '{printf "%d", $1/1048576}')"
|
|
425
|
+
[ -n "$RAM_MB" ] && [ "$RAM_MB" -gt 0 ] || RAM_MB="$(ram_mb)"
|
|
426
|
+
[ -n "$RAM_MB" ] && [ "$RAM_MB" -gt 0 ] || RAM_MB=4096
|
|
427
|
+
CPUS="$(docker info --format '{{.NCPU}}' 2>/dev/null)"
|
|
428
|
+
[ -n "$CPUS" ] && [ "$CPUS" -gt 0 ] || CPUS="$(ncpus)"
|
|
429
|
+
SB=$(( RAM_MB/4 )); [ $SB -gt 8192 ] && SB=8192 # shared_buffers=RAM/4 cap 8G
|
|
430
|
+
ECS=$(( RAM_MB*7/10 )) # effective_cache_size=RAM×0.7
|
|
431
|
+
MWM=$(( RAM_MB/16 )); [ $MWM -gt 2048 ] && MWM=2048 # maintenance_work_mem cap 2G
|
|
432
|
+
WM=$(( (RAM_MB/4)*1024/100/4 )); [ $WM -lt 4096 ] && WM=4096 # work_mem(KB), max_conn=100
|
|
433
|
+
PGW=$(( CPUS/2 )); [ $PGW -gt 8 ] && PGW=8
|
|
434
|
+
PG_TUNE_FLAGS="-c max_connections=100 -c shared_buffers=${SB}MB -c effective_cache_size=${ECS}MB -c maintenance_work_mem=${MWM}MB -c work_mem=${WM}kB -c random_page_cost=1.1 -c effective_io_concurrency=200 -c wal_buffers=16MB -c checkpoint_completion_target=0.9 -c max_worker_processes=${CPUS} -c max_parallel_workers=${PGW} -c max_parallel_workers_per_gather=$(( PGW/2 > 0 ? PGW/2 : 1 ))"
|
|
435
|
+
|
|
436
|
+
# ── .env 生成(幂等:已存在则只补缺,凭据绝不轮换;0600) ───────────────────────────────────
|
|
437
|
+
genpw() { openssl rand -hex 24; }
|
|
438
|
+
touch "$ENVF"; chmod 600 "$ENVF"
|
|
439
|
+
setk() { grep -q "^$1=" "$ENVF" || printf '%s=%s\n' "$1" "$2" >> "$ENVF"; }
|
|
440
|
+
# setk_new:同 setk,但新写入时返回 0(summary 用来判断「密码只显示一次」)
|
|
441
|
+
setk_new() { if grep -q "^$1=" "$ENVF"; then return 1; else printf '%s=%s\n' "$1" "$2" >> "$ENVF"; return 0; fi; }
|
|
442
|
+
# resetk:非凭据键每次重写(翻转要落 .env,不然 teardown/汇总口径漂)
|
|
443
|
+
resetk() { grep -v "^$1=" "$ENVF" > "$ENVF.tmp" || true; mv "$ENVF.tmp" "$ENVF"; chmod 600 "$ENVF"; printf '%s=%s\n' "$1" "$2" >> "$ENVF"; }
|
|
444
|
+
setk SEMA_PROJECT "$PROJECT"
|
|
445
|
+
setk PG_PASSWORD "$(genpw)"
|
|
446
|
+
setk MINIO_PASSWORD "$(genpw)"
|
|
447
|
+
setk SERVICE_AUTH_TOKEN "$(genpw)"
|
|
448
|
+
setk PG_PORT "$PG_PORT"
|
|
449
|
+
setk MINIO_PORT "$MINIO_PORT"
|
|
450
|
+
setk MINIO_CONSOLE_PORT "$MINIO_CONSOLE_PORT"
|
|
451
|
+
setk SERVER_PORT "$SERVER_PORT"
|
|
452
|
+
# data-center 数据面对外服务(agent 在别处连);full-single 数据面仅回环、只有 server 对外
|
|
453
|
+
if [ "$PROFILE" = "data-center" ]; then setk PG_BIND "0.0.0.0"; setk MINIO_BIND "0.0.0.0"; else setk PG_BIND "127.0.0.1"; setk MINIO_BIND "127.0.0.1"; fi
|
|
454
|
+
# PG_TUNE_FLAGS 每次重算(规格可能变;非凭据,轮换无害);引号:source 与 compose env-file 双方兼容
|
|
455
|
+
grep -v '^PG_TUNE_FLAGS=' "$ENVF" > "$ENVF.tmp" && mv "$ENVF.tmp" "$ENVF"; chmod 600 "$ENVF"
|
|
456
|
+
printf 'PG_TUNE_FLAGS="%s"\n' "$PG_TUNE_FLAGS" >> "$ENVF"
|
|
457
|
+
if [ "$PROFILE" = "full-single" ] || [ "$PROFILE" = "local-plus" ]; then
|
|
458
|
+
setk MODEL_GATEWAY_BASEURL "$GATEWAY"
|
|
459
|
+
setk MODEL_ID "$MODEL"
|
|
460
|
+
[ -n "$MODEL_KEY" ] && setk MODEL_API_KEY "$MODEL_KEY"
|
|
461
|
+
setk REQUIRE_PRINCIPAL "$([ "$USERS" = "multi" ] && echo true || echo false)"
|
|
462
|
+
setk SANDBOX_PKG_SOURCE "$([ "$REGION" = "global" ] && echo global || echo '')"
|
|
463
|
+
[ -n "${SEMA_SERVER_IMAGE:-}" ] && setk SEMA_SERVER_IMAGE "$SEMA_SERVER_IMAGE"
|
|
464
|
+
[ "${SANDBOX_LANE:-}" = "e2b-cloud" ] && setk REMOTE_EXEC e2b
|
|
465
|
+
fi
|
|
466
|
+
if [ "$PROFILE" = "local-plus" ]; then
|
|
467
|
+
setk AGENT_PG_HOST "$AGENT_PG_HOST"
|
|
468
|
+
setk AGENT_PG_PORT "${AGENT_PG_PORT:-5432}"
|
|
469
|
+
setk AGENT_PG_USER "${AGENT_PG_USER:-sema}"
|
|
470
|
+
setk AGENT_PG_DATABASE "${AGENT_PG_DATABASE:-sema}"
|
|
471
|
+
setk AGENT_MINIO_ENDPOINT "$AGENT_MINIO_ENDPOINT"
|
|
472
|
+
setk AGENT_MINIO_USER "${AGENT_MINIO_USER:-sema}"
|
|
473
|
+
# local-plus 的 PG_PASSWORD/MINIO_PASSWORD=远端数据面凭据(覆盖上面生成的本地值——
|
|
474
|
+
# 本档没有本地 pg/minio,生成值无用;显式传入才是真凭据)
|
|
475
|
+
resetk PG_PASSWORD "$AGENT_PG_PASSWORD"
|
|
476
|
+
resetk MINIO_PASSWORD "$AGENT_MINIO_PASSWORD"
|
|
477
|
+
fi
|
|
478
|
+
|
|
479
|
+
# 外接第三方数据面(--pg-url/--s3-endpoint;凭据属外部系统=用户可换,resetk 非 setk)
|
|
480
|
+
if [ -n "$PG_URL" ]; then
|
|
481
|
+
PGP="$(PG_URL="$PG_URL" python3 -c 'import os,urllib.parse as u
|
|
482
|
+
p=u.urlsplit(os.environ["PG_URL"])
|
|
483
|
+
if p.scheme not in ("postgres","postgresql") or not p.hostname: raise SystemExit("bad")
|
|
484
|
+
print(p.hostname, p.port or 5432, p.username or "postgres", p.password or "", (p.path or "/postgres").lstrip("/"))' 2>/dev/null)" \
|
|
485
|
+
|| { log "⛔ --pg-url 解析失败(期望 postgres://user:pass@host:port/db):已按 *** 隐去凭据"; exit 1; }
|
|
486
|
+
read -r EXT_PG_HOST EXT_PG_PORT EXT_PG_USER EXT_PG_PW EXT_PG_DB <<<"$PGP"
|
|
487
|
+
resetk AGENT_PG_HOST "$EXT_PG_HOST"; resetk AGENT_PG_PORT "$EXT_PG_PORT"
|
|
488
|
+
resetk AGENT_PG_USER "$EXT_PG_USER"; resetk AGENT_PG_DATABASE "$EXT_PG_DB"
|
|
489
|
+
resetk PG_PASSWORD "$EXT_PG_PW"
|
|
490
|
+
fi
|
|
491
|
+
if [ -n "$S3_ENDPOINT" ]; then
|
|
492
|
+
resetk AGENT_MINIO_ENDPOINT "$S3_ENDPOINT"
|
|
493
|
+
resetk AGENT_MINIO_USER "$S3_ACCESS_KEY"
|
|
494
|
+
resetk MINIO_PASSWORD "$S3_SECRET_KEY"
|
|
495
|
+
fi
|
|
496
|
+
|
|
497
|
+
# 档位落 .env(smoke/teardown 的口径来源;非凭据,重写)
|
|
498
|
+
resetk DEPLOY_PROFILE "$PROFILE"
|
|
499
|
+
|
|
500
|
+
# registry(sema-registry 配置中心)
|
|
501
|
+
resetk REGISTRY_ENABLED "$REGISTRY_ENABLED"
|
|
502
|
+
NEW_REG_PW=false
|
|
503
|
+
if [ "$REGISTRY_ENABLED" = "true" ]; then
|
|
504
|
+
[ -n "${SEMA_REGISTRY_IMAGE:-}" ] && setk SEMA_REGISTRY_IMAGE "$SEMA_REGISTRY_IMAGE"
|
|
505
|
+
setk_new REGISTRY_ADMIN_PASSWORD "$(genpw)" && NEW_REG_PW=true
|
|
506
|
+
setk REGISTRY_SESSION_SECRET "$(genpw)"
|
|
507
|
+
setk REGISTRY_PULL_TOKEN "$(genpw)"
|
|
508
|
+
setk REGISTRY_PORT "$REGISTRY_PORT"
|
|
509
|
+
setk REGISTRY_ADMIN_USER "${REGISTRY_ADMIN_USER:-zhaoheran}"
|
|
510
|
+
fi
|
|
511
|
+
|
|
512
|
+
# git 面
|
|
513
|
+
resetk GIT_MODE "$GIT_MODE"
|
|
514
|
+
NEW_GIT_PW=false
|
|
515
|
+
if [ "$GIT_MODE" = "provision" ]; then
|
|
516
|
+
[ -n "${GITEA_IMAGE:-}" ] && setk GITEA_IMAGE "$GITEA_IMAGE"
|
|
517
|
+
setk GIT_HTTP_PORT "$GIT_HTTP_PORT"
|
|
518
|
+
setk GIT_SSH_PORT "$GIT_SSH_PORT"
|
|
519
|
+
setk GIT_DOMAIN "$HOSTIP"
|
|
520
|
+
setk GIT_ADMIN_USER "${GIT_ADMIN_USER:-sema}"
|
|
521
|
+
setk_new GIT_ADMIN_PASSWORD "$(genpw)" && NEW_GIT_PW=true
|
|
522
|
+
elif [ "$GIT_MODE" = "connect" ]; then
|
|
523
|
+
# resetk:connect 目标是外部系统,用户随时可换——setk 会让第一次填错的 URL 永久粘住,
|
|
524
|
+
# 且检测段 source .env 时旧值会盖掉命令行新值(真踩)
|
|
525
|
+
resetk GIT_URL "$GIT_URL"
|
|
526
|
+
resetk GIT_TOKEN "$GIT_TOKEN"
|
|
527
|
+
fi
|
|
528
|
+
|
|
529
|
+
# DATA_ROOT 落定(首装写 .env 后为准——重跑换值会造出一套空卷,数据看似丢失)
|
|
530
|
+
if has_env DATA_ROOT_DIR; then
|
|
531
|
+
_stored="$(grep '^DATA_ROOT_DIR=' "$ENVF" | head -1 | cut -d= -f2-)"
|
|
532
|
+
if [ -n "$DATA_ROOT" ] && [ "$DATA_ROOT" != "$_stored" ]; then
|
|
533
|
+
log "⚠ --data-root=$DATA_ROOT 与首装选定的 $_stored 不同——沿用首装值(换盘流程:--teardown-volumes 后迁数据重装)"
|
|
534
|
+
fi
|
|
535
|
+
DATA_ROOT="$_stored"
|
|
536
|
+
elif [ -n "$DATA_ROOT" ]; then
|
|
537
|
+
setk DATA_ROOT_DIR "$DATA_ROOT"
|
|
538
|
+
fi
|
|
539
|
+
if [ -n "$DATA_ROOT" ]; then
|
|
540
|
+
for d in pgdata miniodata registrydata gitdata; do mkdir -p "$DATA_ROOT/$d"; done
|
|
541
|
+
fi
|
|
542
|
+
|
|
543
|
+
command -v docker >/dev/null || { log "⛔ 未装 docker。下一步:curl -fsSL https://get.docker.com | sh(cn region 用镜像站,如 https://mirrors.aliyun.com/docker-ce)"; exit 1; }
|
|
544
|
+
compose() { ( cd "$HERE/stack" && dc --project-name "$PROJECT" --env-file "$ENVF" -f compose.yaml ${DATA_ROOT:+-f compose.dataroot.yaml} "$@" ); }
|
|
545
|
+
|
|
546
|
+
# ── 外接端点连接检测(装配前 fail-loud;只验兼容可用,不校验证书——内网自签是常态)────────────
|
|
547
|
+
if [ -n "$PG_URL" ]; then
|
|
548
|
+
log "外接 PG 连接检测(host=$EXT_PG_HOST:$EXT_PG_PORT db=$EXT_PG_DB)"
|
|
549
|
+
PGOK=$(docker run --rm "${PG_IMAGE:-postgres:17}" psql "$PG_URL" -tAc 'select 1' 2>&1 | tail -1)
|
|
550
|
+
[ "$PGOK" = "1" ] || { log "⛔ 外接 PG 连不上:${PGOK:0:160}。下一步:核对 --pg-url(host 从容器可达?防火墙?);TLS 端点带 sslmode=require 试试"; exit 1; }
|
|
551
|
+
fi
|
|
552
|
+
if [ -n "$S3_ENDPOINT" ]; then
|
|
553
|
+
log "外接 S3 连接检测($S3_ENDPOINT)"
|
|
554
|
+
S3OK=$(docker run --rm --entrypoint sh -e MC_HOST_x="$(printf '%s' "$S3_ENDPOINT" | sed "s#://#://$S3_ACCESS_KEY:$S3_SECRET_KEY@#")" \
|
|
555
|
+
"${MC_IMAGE:-minio/mc:latest}" -c 'mc --insecure ls x/ >/dev/null 2>&1 && mc --insecure mb --ignore-existing x/workspaces x/blobs x/backups >/dev/null 2>&1 && echo S3_OK' 2>/dev/null | tail -1)
|
|
556
|
+
[ "$S3OK" = "S3_OK" ] || { log "⛔ 外接 S3 连不上或建桶失败。下一步:核对 endpoint/密钥;需要 S3 兼容协议(MinIO/OSS/COS/R2 等);证书问题已用 --insecure 忽略,若还不通多半是网络/密钥"; exit 1; }
|
|
557
|
+
log "外接 S3 就绪(workspaces/blobs/backups 已确保)"
|
|
558
|
+
fi
|
|
559
|
+
|
|
560
|
+
# ── git=provision:先起 Gitea 并引导(OAuth app 的 client id/secret 要在 registry 起来之前
|
|
561
|
+
# 进 .env——compose 对 registry 的 env 插值发生在 up 时)────────────────────────────────────
|
|
562
|
+
GIT_MANUAL_NOTES=()
|
|
563
|
+
if [ "$GIT_MODE" = "provision" ]; then
|
|
564
|
+
log "git 面:先起 Gitea(引导管理员/token/OAuth 要在 registry 之前)"
|
|
565
|
+
COMPOSE_PROFILES=git compose up -d --wait git || { log "⛔ Gitea 起不来。下一步:docker compose -p $PROJECT logs git;镜像拉不动时 --gitea-image=<可达镜像仓>/gitea:1.24"; exit 1; }
|
|
566
|
+
. "$ENVF"
|
|
567
|
+
GIT_CTR="${PROJECT}-git-1"
|
|
568
|
+
GIT_API="http://127.0.0.1:${GIT_HTTP_PORT}/api/v1"
|
|
569
|
+
# 引导管理员(幂等:已存在即跳过;user 1000=镜像内 git 用户)
|
|
570
|
+
if ! docker exec -u 1000 "$GIT_CTR" gitea admin user list 2>/dev/null | awk '{print $2}' | grep -qx "$GIT_ADMIN_USER"; then
|
|
571
|
+
docker exec -u 1000 "$GIT_CTR" gitea admin user create --admin \
|
|
572
|
+
--username "$GIT_ADMIN_USER" --password "$GIT_ADMIN_PASSWORD" \
|
|
573
|
+
--email "${GIT_ADMIN_USER}@sema.local" --must-change-password=false >/dev/null \
|
|
574
|
+
|| { log "⛔ Gitea 管理员创建失败。下一步:docker compose -p $PROJECT logs git"; exit 1; }
|
|
575
|
+
log "Gitea 管理员 $GIT_ADMIN_USER 已建"
|
|
576
|
+
fi
|
|
577
|
+
# 管理员 access token(只生成一次;丢了 .env 就换个名再生成,旧 token 在 Gitea 里可手动清)
|
|
578
|
+
if ! has_env GIT_ADMIN_TOKEN; then
|
|
579
|
+
TOK_NAME="sema-up-$(openssl rand -hex 3)"
|
|
580
|
+
TOK=$(curl -m10 -s -u "$GIT_ADMIN_USER:$GIT_ADMIN_PASSWORD" -X POST "$GIT_API/users/$GIT_ADMIN_USER/tokens" \
|
|
581
|
+
-H 'Content-Type: application/json' -d "{\"name\":\"$TOK_NAME\",\"scopes\":[\"all\"]}" \
|
|
582
|
+
| python3 -c 'import json,sys
|
|
583
|
+
try: print(json.load(sys.stdin).get("sha1",""))
|
|
584
|
+
except Exception: print("")')
|
|
585
|
+
[ -n "$TOK" ] || { log "⛔ Gitea access token 生成失败。下一步:curl -u <admin> $GIT_API/users/$GIT_ADMIN_USER/tokens 手查;或看 docker compose -p $PROJECT logs git"; exit 1; }
|
|
586
|
+
setk GIT_ADMIN_TOKEN "$TOK"
|
|
587
|
+
fi
|
|
588
|
+
. "$ENVF"
|
|
589
|
+
# registry 登录集成:自动建 OAuth app(真自动化,不是纸面;client secret 只在创建响应里给一次)
|
|
590
|
+
if [ "$REGISTRY_ENABLED" = "true" ] && ! has_env REGISTRY_GITEA_OAUTH_ID; then
|
|
591
|
+
REDIRECT="http://$HOSTIP:$REGISTRY_PORT/api/auth/oauth/callback"
|
|
592
|
+
OAUTH=$(curl -m10 -s -H "Authorization: token $GIT_ADMIN_TOKEN" -X POST "$GIT_API/user/applications/oauth2" \
|
|
593
|
+
-H 'Content-Type: application/json' \
|
|
594
|
+
-d "{\"name\":\"sema-registry\",\"redirect_uris\":[\"$REDIRECT\"],\"confidential_client\":true}")
|
|
595
|
+
OA_ID=$(printf '%s' "$OAUTH" | python3 -c 'import json,sys
|
|
596
|
+
try: print(json.load(sys.stdin).get("client_id",""))
|
|
597
|
+
except Exception: print("")')
|
|
598
|
+
OA_SECRET=$(printf '%s' "$OAUTH" | python3 -c 'import json,sys
|
|
599
|
+
try: print(json.load(sys.stdin).get("client_secret",""))
|
|
600
|
+
except Exception: print("")')
|
|
601
|
+
if [ -n "$OA_ID" ] && [ -n "$OA_SECRET" ]; then
|
|
602
|
+
setk REGISTRY_GITEA_OAUTH_ID "$OA_ID"
|
|
603
|
+
setk REGISTRY_GITEA_OAUTH_SECRET "$OA_SECRET"
|
|
604
|
+
setk REGISTRY_GITEA_BASE_URL "http://$HOSTIP:$GIT_HTTP_PORT"
|
|
605
|
+
log "Gitea→registry OAuth 登录已接(app=sema-registry)"
|
|
606
|
+
else
|
|
607
|
+
GIT_MANUAL_NOTES+=("Gitea OAuth app 自动创建失败——registry 仍可表单登录;手动接法:Gitea 设置→应用→新建 OAuth2(回调 $REDIRECT),把 client id/secret 写进 $ENVF 的 REGISTRY_GITEA_OAUTH_ID/SECRET+REGISTRY_GITEA_BASE_URL 后重跑本命令")
|
|
608
|
+
fi
|
|
609
|
+
fi
|
|
610
|
+
elif [ "$GIT_MODE" = "connect" ]; then
|
|
611
|
+
. "$ENVF"
|
|
612
|
+
# 连通验证(fail-loud:接不上就别继续,别部署完才发现 git 面是死的)。
|
|
613
|
+
# 任意三方 git 都支持:探测链 Gitea API → GitHub API → 通用 git(ls-remote/HTTP 可达);
|
|
614
|
+
# 证书一律不校验(-k / http.sslVerify=false)——内网自签是常态,验的是兼容可用性。
|
|
615
|
+
GIT_KIND=""
|
|
616
|
+
GT_VER=$(curl -k -m10 -s -H "Authorization: token $GIT_TOKEN" "$GIT_URL/api/v1/version" | python3 -c 'import json,sys
|
|
617
|
+
try: print(json.load(sys.stdin).get("version",""))
|
|
618
|
+
except Exception: print("")')
|
|
619
|
+
if [ -n "$GT_VER" ]; then
|
|
620
|
+
GIT_KIND="gitea"
|
|
621
|
+
log "git=connect:Gitea $GT_VER 验证通过"
|
|
622
|
+
if [ "$REGISTRY_ENABLED" = "true" ] && ! has_env REGISTRY_GITEA_OAUTH_ID; then
|
|
623
|
+
REDIRECT="http://$HOSTIP:$REGISTRY_PORT/api/auth/oauth/callback"
|
|
624
|
+
OAUTH=$(curl -k -m10 -s -H "Authorization: token $GIT_TOKEN" -X POST "$GIT_URL/api/v1/user/applications/oauth2" \
|
|
625
|
+
-H 'Content-Type: application/json' \
|
|
626
|
+
-d "{\"name\":\"sema-registry\",\"redirect_uris\":[\"$REDIRECT\"],\"confidential_client\":true}")
|
|
627
|
+
OA_ID=$(printf '%s' "$OAUTH" | python3 -c 'import json,sys
|
|
628
|
+
try: print(json.load(sys.stdin).get("client_id",""))
|
|
629
|
+
except Exception: print("")')
|
|
630
|
+
OA_SECRET=$(printf '%s' "$OAUTH" | python3 -c 'import json,sys
|
|
631
|
+
try: print(json.load(sys.stdin).get("client_secret",""))
|
|
632
|
+
except Exception: print("")')
|
|
633
|
+
if [ -n "$OA_ID" ] && [ -n "$OA_SECRET" ]; then
|
|
634
|
+
setk REGISTRY_GITEA_OAUTH_ID "$OA_ID"
|
|
635
|
+
setk REGISTRY_GITEA_OAUTH_SECRET "$OA_SECRET"
|
|
636
|
+
setk REGISTRY_GITEA_BASE_URL "$GIT_URL"
|
|
637
|
+
log "已有 Gitea→registry OAuth 登录已接(app=sema-registry)"
|
|
638
|
+
else
|
|
639
|
+
GIT_MANUAL_NOTES+=("OAuth app 自动创建失败(token 可能缺 write:user scope)——手动接法:该 Gitea 设置→应用→新建 OAuth2(回调 $REDIRECT),把 client id/secret 写进 $ENVF 的 REGISTRY_GITEA_OAUTH_ID/SECRET+REGISTRY_GITEA_BASE_URL 后重跑本命令")
|
|
640
|
+
fi
|
|
641
|
+
fi
|
|
642
|
+
elif printf '%s' "$GIT_URL" | grep -q 'github\.com'; then
|
|
643
|
+
GH_CODE=$(curl -k -m10 -s -o /dev/null -w '%{http_code}' -H "Authorization: Bearer $GIT_TOKEN" https://api.github.com/user)
|
|
644
|
+
[ "$GH_CODE" = "200" ] || { log "⛔ GitHub token 验证失败(HTTP $GH_CODE)。下一步:检查 token 是否有效/未过期(需要 repo 读写 scope)"; exit 1; }
|
|
645
|
+
GIT_KIND="github"
|
|
646
|
+
log "git=connect:GitHub token 验证通过"
|
|
647
|
+
GIT_MANUAL_NOTES+=("配置中心的 OAuth 登录只支持 Gitea——GitHub 仓可用但登录集成无法自动配;registry 用表单登录即可")
|
|
648
|
+
else
|
|
649
|
+
# 通用 git(GitLab/Bitbucket/裸 git-http 等):URL 是仓库→ls-remote 真验(token 两种常见姿势
|
|
650
|
+
# 都试);URL 是服务根→HTTP 可达检(2xx/3xx/401/403 都算服务在,鉴权细节归 worker 侧)
|
|
651
|
+
GIT_KIND="generic"
|
|
652
|
+
LSOK=""
|
|
653
|
+
for auth in "oauth2:$GIT_TOKEN" "$GIT_TOKEN"; do
|
|
654
|
+
AUTH_URL=$(printf '%s' "$GIT_URL" | sed "s#://#://$auth@#")
|
|
655
|
+
if GIT_TERMINAL_PROMPT=0 git -c http.sslVerify=false ls-remote "$AUTH_URL" >/dev/null 2>&1; then LSOK=1; break; fi
|
|
656
|
+
done
|
|
657
|
+
if [ -n "$LSOK" ]; then
|
|
658
|
+
log "git=connect:通用 git 仓库 ls-remote 验证通过"
|
|
659
|
+
else
|
|
660
|
+
GH_CODE=$(curl -k -m10 -s -o /dev/null -w '%{http_code}' "$GIT_URL")
|
|
661
|
+
case "$GH_CODE" in
|
|
662
|
+
2*|3*|401|403) log "git=connect:通用 git 服务可达(HTTP $GH_CODE;URL 非单仓,未做 ls-remote 深验)" ;;
|
|
663
|
+
*) log "⛔ $GIT_URL 连不上(HTTP ${GH_CODE:-000},Gitea/GitHub/通用 git 三种探测都失败)。下一步:核对地址与网络;若是仓库地址请带完整路径(…/owner/repo.git)"; exit 1 ;;
|
|
664
|
+
esac
|
|
665
|
+
fi
|
|
666
|
+
GIT_MANUAL_NOTES+=("通用 git 已连(可达性/ls-remote 级验证);registry OAuth 登录只支持 Gitea,不自动配——token 已存 .env GIT_TOKEN 供 worker 侧使用")
|
|
667
|
+
fi
|
|
668
|
+
resetk GIT_KIND "$GIT_KIND"
|
|
669
|
+
fi
|
|
670
|
+
|
|
671
|
+
# ── 装配(Layer 1 compose;profiles 映射形态) ────────────────────────────────────────────────
|
|
672
|
+
log "装配:docker compose profiles=$COMPOSE_PROFILES project=$PROJECT"
|
|
673
|
+
COMPOSE_PROFILES="$COMPOSE_PROFILES" compose up -d --wait --remove-orphans \
|
|
674
|
+
|| { log "⛔ compose up 失败。下一步:docker compose -p $PROJECT logs(常见:镜像拉取失败→检查镜像引用/docker login;端口占用→--port 换口)"; exit 1; }
|
|
675
|
+
# 建桶(幂等,一次性动作归 Layer 0;只对本地 MinIO——外接 S3 已在连接检测时确保)
|
|
676
|
+
. "$ENVF"
|
|
677
|
+
case ",$COMPOSE_PROFILES," in *,s3,*)
|
|
678
|
+
docker run --rm --network "${PROJECT}_default" -e MC_HOST_x="http://sema:${MINIO_PASSWORD}@minio:9000" "${MC_IMAGE:-minio/mc:latest}" mb --ignore-existing x/workspaces x/blobs x/backups >/dev/null || { log "⛔ MinIO 建桶失败。下一步:docker compose -p $PROJECT logs minio"; exit 1; } ;;
|
|
679
|
+
esac
|
|
680
|
+
|
|
681
|
+
# ── 验证(装后即验,§3d smoke 的子集;全量随时可跑 smoke.sh --project=$PROJECT)──────────────
|
|
682
|
+
. "$ENVF"
|
|
683
|
+
V_PG="n/a" V_BK="n/a"
|
|
684
|
+
case ",$COMPOSE_PROFILES," in *,pg,*)
|
|
685
|
+
V_PG=$(docker exec "${PROJECT}-pg-1" psql -U sema -d sema -tAc "SHOW shared_buffers" 2>/dev/null || echo FAIL) ;;
|
|
686
|
+
esac
|
|
687
|
+
case ",$COMPOSE_PROFILES," in *,s3,*)
|
|
688
|
+
V_BK=$(docker run --rm --network "${PROJECT}_default" -e MC_HOST_x="http://sema:${MINIO_PASSWORD}@minio:9000" "${MC_IMAGE:-minio/mc:latest}" ls x/ 2>/dev/null | wc -l | tr -d ' ') ;;
|
|
689
|
+
esac
|
|
690
|
+
V_HEALTH="n/a"
|
|
691
|
+
case ",$COMPOSE_PROFILES," in *,agent,*)
|
|
692
|
+
V_HEALTH=$(curl -m5 -s "http://127.0.0.1:${SERVER_PORT}/health" | head -c 60 || echo FAIL) ;;
|
|
693
|
+
esac
|
|
694
|
+
V_REG="n/a"
|
|
695
|
+
if [ "$REGISTRY_ENABLED" = "true" ]; then
|
|
696
|
+
V_REG=$(curl -m5 -s -o /dev/null -w '%{http_code}' "http://127.0.0.1:${REGISTRY_PORT}/api/healthz" || echo FAIL)
|
|
697
|
+
case "$V_REG" in 2*) : ;; *) log "⛔ registry 未就绪(healthz HTTP $V_REG)。下一步:docker compose -p $PROJECT logs registry"; exit 1 ;; esac
|
|
698
|
+
fi
|
|
699
|
+
V_GIT="n/a"
|
|
700
|
+
if [ "$GIT_MODE" = "provision" ]; then
|
|
701
|
+
V_GIT=$(curl -m5 -s -o /dev/null -w '%{http_code}' "http://127.0.0.1:${GIT_HTTP_PORT}/api/healthz" || echo FAIL)
|
|
702
|
+
case "$V_GIT" in 2*) : ;; *) log "⛔ Gitea 未就绪(healthz HTTP $V_GIT)。下一步:docker compose -p $PROJECT logs git"; exit 1 ;; esac
|
|
703
|
+
fi
|
|
704
|
+
|
|
705
|
+
# ── 汇总(凭据打印一次;文件 0600 常驻;一屏读完)────────────────────────────────────────────
|
|
706
|
+
if [ "$MODE_INTERACTIVE" = "json" ]; then
|
|
707
|
+
printf '{"type":"summary","profile":"%s","region":"%s","pg":"postgres://sema:***@%s:%s/sema","s3":"http://%s:%s","buckets":%s,"pgSharedBuffers":"%s","health":"%s","registry":"%s","git":"%s","credentialsFile":"%s"}\n' \
|
|
708
|
+
"$PROFILE" "$REGION" "$HOSTIP" "$PG_PORT" "$HOSTIP" "$MINIO_PORT" "${V_BK:-0}" "$V_PG" "$V_HEALTH" \
|
|
709
|
+
"$([ "$REGISTRY_ENABLED" = "true" ] && echo "http://$HOSTIP:$REGISTRY_PORT" || echo n/a)" \
|
|
710
|
+
"$(case "$GIT_MODE" in provision) echo "http://$HOSTIP:$GIT_HTTP_PORT";; connect) echo "$GIT_URL";; *) echo n/a;; esac)" \
|
|
711
|
+
"$ENVF" >&3
|
|
712
|
+
else
|
|
713
|
+
{
|
|
714
|
+
echo
|
|
715
|
+
echo "══════════════ sema-up 完成(profile=$PROFILE)══════════════"
|
|
716
|
+
case ",$COMPOSE_PROFILES," in *,pg,*)
|
|
717
|
+
echo " PG postgres://sema:<PG_PASSWORD>@$HOSTIP:$PG_PORT/sema(shared_buffers=$V_PG)" ;;
|
|
718
|
+
esac
|
|
719
|
+
[ -n "$PG_URL" ] && echo " PG(外接) $EXT_PG_HOST:$EXT_PG_PORT/$EXT_PG_DB(连接检测已过;凭据在 .env)"
|
|
720
|
+
case ",$COMPOSE_PROFILES," in *,s3,*)
|
|
721
|
+
echo " S3/MinIO http://$HOSTIP:$MINIO_PORT(console :$MINIO_CONSOLE_PORT,桶×$V_BK:workspaces/blobs/backups)" ;;
|
|
722
|
+
esac
|
|
723
|
+
[ -n "$S3_ENDPOINT" ] && echo " S3(外接) $S3_ENDPOINT(连接检测+三桶已确保;密钥在 .env)"
|
|
724
|
+
case ",$COMPOSE_PROFILES," in *,agent,*)
|
|
725
|
+
echo " 引擎 http://$HOSTIP:$SERVER_PORT(/health: $V_HEALTH;API 凭据=SERVICE_AUTH_TOKEN)" ;;
|
|
726
|
+
esac
|
|
727
|
+
if [ "$REGISTRY_ENABLED" = "true" ]; then
|
|
728
|
+
echo " 配置中心 http://$HOSTIP:$REGISTRY_PORT(healthz $V_REG)"
|
|
729
|
+
if $NEW_REG_PW; then
|
|
730
|
+
echo " 首登:${REGISTRY_ADMIN_USER:-zhaoheran} / ${REGISTRY_ADMIN_PASSWORD}(⚠ 密码只显示这一次,之后看 .env)"
|
|
731
|
+
else
|
|
732
|
+
echo " 首登:${REGISTRY_ADMIN_USER:-zhaoheran}(密码沿用上次生成,在 .env REGISTRY_ADMIN_PASSWORD)"
|
|
733
|
+
fi
|
|
734
|
+
[ -n "${REGISTRY_GITEA_BASE_URL:-}" ] && echo " OAuth 登录:已接 ${REGISTRY_GITEA_BASE_URL}(也可表单登录)"
|
|
735
|
+
echo " service 对接=REGISTRY_PULL_TOKEN(在 .env)"
|
|
736
|
+
fi
|
|
737
|
+
if [ "$GIT_MODE" = "provision" ]; then
|
|
738
|
+
echo " Git/Gitea http://$HOSTIP:$GIT_HTTP_PORT(healthz $V_GIT;ssh 端口 $GIT_SSH_PORT)"
|
|
739
|
+
if $NEW_GIT_PW; then
|
|
740
|
+
echo " 管理员:${GIT_ADMIN_USER} / ${GIT_ADMIN_PASSWORD}(⚠ 密码只显示这一次,之后看 .env)"
|
|
741
|
+
else
|
|
742
|
+
echo " 管理员:${GIT_ADMIN_USER}(密码沿用上次生成,在 .env GIT_ADMIN_PASSWORD)"
|
|
743
|
+
fi
|
|
744
|
+
echo " API token 在 .env GIT_ADMIN_TOKEN;clone:git clone http://$HOSTIP:$GIT_HTTP_PORT/<owner>/<repo>.git"
|
|
745
|
+
elif [ "$GIT_MODE" = "connect" ]; then
|
|
746
|
+
echo " Git 已连接 $GIT_URL(token 在 .env GIT_TOKEN)"
|
|
747
|
+
fi
|
|
748
|
+
for n in ${GIT_MANUAL_NOTES[@]+"${GIT_MANUAL_NOTES[@]}"}; do
|
|
749
|
+
echo " ⚠ 待人工 $n"
|
|
750
|
+
done
|
|
751
|
+
echo " 凭据 $ENVF(0600;全部密码/token 常驻此文件,不进日志)"
|
|
752
|
+
echo " 数据卷 $(printf ',%s,' "$COMPOSE_PROFILES" | grep -q ',pg,' && printf '%s_pgdata ' "$PROJECT")$(printf ',%s,' "$COMPOSE_PROFILES" | grep -q ',s3,' && printf '%s_miniodata ' "$PROJECT")$([ "$REGISTRY_ENABLED" = "true" ] && printf '%s_registrydata ' "$PROJECT")$([ "$GIT_MODE" = "provision" ] && printf '%s_gitdata' "$PROJECT")$([ -n "$DATA_ROOT" ] && printf '(bind 落 %s)' "$DATA_ROOT")"
|
|
753
|
+
echo " 重入 再跑同命令=幂等升级(凭据不轮换);验证=smoke.sh --project=$PROJECT"
|
|
754
|
+
echo " 卸载 $0 --project=$PROJECT --teardown(留数据)/--teardown-volumes(连卷删)"
|
|
755
|
+
[ "$PROFILE" = "data-center" ] && echo " 接入 别处 agent 连这个数据面 = sema-up.sh --profile=local-plus --pg-host=$HOSTIP --minio-endpoint=http://$HOSTIP:$MINIO_PORT + 两个密码(本机 .env 里)"
|
|
756
|
+
echo "═══════════════════════════════════════════════════════════"
|
|
757
|
+
} >&2
|
|
758
|
+
fi
|