PR Z: Sandbox deployment scaffolding (deploy script + Dockerfiles + compose) #30
Reference in New Issue
Block a user
Delete Branch "devin/1776896284-pr-z-deploy-sandbox"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
PR Z — Sandbox deployment scaffolding
Implements the user-selected
(a)+(b)+(c): deploy script + Dockerfiles + docker-compose, target-agnostic— everything needed fordocker compose upto bring a CurrenciCombo sandbox online on any host, with no secrets baked in.What
contracts/scripts/deploy-notary-registry.ts— self-compiling ethers v6 deploy forNotaryRegistry.sol. Uses solc-js in-process (same helper the orchestrator E2E tests use) so it bypasses hardhat'sHH1006error oncontracts/node_modules. SupportsNOTARY_DRY_RUN=1for CI smoke runs. Prints a machine-readable JSON envelope as its last stdout line ({"contract":"NotaryRegistry","address":"0x...","txHash":"0x...","chainId":138}) so callers can grep the address out.contracts/hardhat.config.ts— adds achain138network entry (RPC defaults tohttps://rpc.public-0138.defi-oracle.io, which resolvesEXT-CHAIN138-CI-RPC).orchestrator/Dockerfile— multi-stagenode:20-alpinebuild, non-rootorchestratoruser,dumb-initentrypoint,HEALTHCHECKon:8080/health. Build context isorchestrator/so it doesn't see the repo root.Dockerfile(root, portal) — multi-stage vite build →nginx:1.27-alpine.VITE_ORCHESTRATOR_URLis passed via--build-argand baked into the bundle.nginx.confhandles SPA fallback + long-cache/assets/+ sourcemap denial.docker-compose.yml— full sandbox stack: postgres 15 + redis 7 + orchestrator + portal. Every secret is parameterised; defaults make sense out of the box (resolved Chain 138 RPC, Docker-DNS-internal DB/Redis URLs)..env.sandbox.example— template documenting every env var, including all 7EXT-*blocker env vars with a pointer to which blocker each one resolves. Secrets are left blank for users to fill withopenssl rand -hex 32etc..dockerignore— excludesnode_modules,artifacts,cache,terraform,k8sso build contexts stay small.orchestrator/src/config/env.ts—emptyToUndefined()preprocess so zod optional regex fields validate empty-string identically to unset. Without this, any sandbox.env.sandboxwithNOTARY_REGISTRY_ADDRESS=(valid YAML/env, user hasn't deployed yet) caused the orchestrator to crash on boot.How to use
To deploy the on-chain NotaryRegistry and wire its address back into
.env.sandbox:Target-agnostic
${*_PORT:-...}so it works on any box with 5432/6379/8080/3000 free (and the.env.sandboxI smoke-tested with uses shifted ports 15432/16379/18080/13000 to stay clear of whatever's already on the host).CHAIN_138_RPC_URLdefaults to the public endpoint; users can point it at a private node without code changes.fly.io,ECS, etc.Smoke test (this branch, on the build box)
/healthreturns 503 on this particular builder because the memory check flipscriticalunder the VM's constrained RAM — database and redis are both"up", the compose healthcheck sees orchestrator as healthy once paststart_period, and the clean/readyanswer confirms the service is serving. This is a property of the build machine, not the PR.Verification
npx tsc --noEmitclean (orchestrator).npx jest— 13 suites / 167 tests pass (same asmain).{"contract":"NotaryRegistry","dryRun":true,"bytecodeLength":7852,"calldataLength":7916,"abiEntryCount":17}.docker buildboth images — green.docker compose up -d+ smoke test — green (see above).Out of scope
target-agnosticdirective./transactions) and that evidence still stands.- contracts/scripts/deploy-notary-registry.ts: self-compiling ethers v6 deploy for NotaryRegistry.sol (solc-js in-process — avoids hardhat's HH1006 on contracts/node_modules), with NOTARY_DRY_RUN mode and a machine-readable JSON envelope as last stdout line. - contracts/hardhat.config.ts: chain138 network (RPC defaults to the public endpoint that resolves EXT-CHAIN138-CI-RPC). - orchestrator/Dockerfile: multi-stage node:20-alpine build, non-root user, dumb-init, /health HEALTHCHECK on :8080. - Dockerfile (root, portal): multi-stage vite build → nginx:1.27-alpine, VITE_ORCHESTRATOR_URL baked at build time. - nginx.conf: SPA fallback + long-cache /assets, sourcemaps denied. - docker-compose.yml: full sandbox stack (postgres 15 + redis 7 + orchestrator + portal), all secrets parameterised via env_file. - .env.sandbox.example: template with EXT-* blocker env vars documented and CHAIN_138_RPC_URL defaulting to the resolved public endpoint. - .dockerignore: excludes node_modules, artifacts, cache, terraform, k8s. - orchestrator/src/config/env.ts: emptyToUndefined() preprocess so zod optional regex fields validate empty-string identically to unset (fixes docker-compose NOTARY_REGISTRY_ADDRESS= sandbox booting). Headless smoke test on this box: - docker compose --env-file .env.sandbox up -d → all 4 containers reported Healthy. - curl /ready → {"ready":true} - curl portal / → HTTP 200 with correct <title>. - orchestrator boot log prints all 7 EXT-* IDs (6 active, 1 resolved). - /health returns 503 on this particular builder because memory is 'critical' — DB + Redis both 'up'; this is environment-specific and not caused by PR Z. Unit: 13 suites / 167 tests still pass after env.ts preprocess change. Co-Authored-By: Nakamoto, S <defi@defi-oracle.io>View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.