Skip to content
Termbook
Operators

Deploy & upgrade

Simulate, verify bindings and apply governed changes to the existing deployment.

On this page

Before broadcasting

Repository checks
pnpm typecheck
pnpm lint
pnpm test
forge test --root contracts/evm
cd contracts/solana && cargo test --offline

Run the relevant full suites and deployment simulation. Confirm network identities, signer balances, gas estimates, source custody authorities, admitted feeds and settlement token addresses. A House and market must use the same settlement token contract.

Upgradeable deployments

EVM proxy upgrades preserve the proxy address and storage. Implementation code changes require storage-layout checks and authorized governance execution. Deploying a new implementation is not the same as replacing a proxy and its address.

The Solana program uses its configured upgrade authority. Upgrading its executable can preserve the program ID; authority and account compatibility still need verification. Testnet single-key governance does not establish production multisig controls.

Deployment tooling

Inspect current bindings
node scripts/integrations/verify-testnet.mjs

scripts/deploy/testnet.mjs creates a fresh deployment and refuses to overwrite an existing manifest. scripts/deploy/upgrade-testnet.mjs handles the existing upgrade path. Setup runners support simulation before broadcast. Use the existing deployment manifest rather than inventing another address file.

Host the services

deploy/Dockerfile builds the API, worker and client. deploy/compose.yaml runs them with MongoDB and Redis. Paths and release settings come from a private Compose environment file; contract deployment remains a separate operation.

Prepare deployment settings
cp deploy/.env.example deploy/.env

Set TERMBOOK_RELEASE to a unique release tag and PUBLIC_API_BASE to your public API origin. This URL is embedded when the client is built; rebuild the client when it changes. Set the runtime, manifest, data and signer paths to existing files and directories. Relative paths resolve from deploy/.

Start the runtime environment from server/.env.example and add the current deployment addresses, RPCs and worker settings. Inside Docker, use the service names for persistence:

Private runtime environment · persistence
MONGO_URL=mongodb://mongo:27017/termbook?replicaSet=rs0&directConnection=true
REDIS_URL=redis://redis:6379
RPC_BUDGET_REDIS_URL=redis://redis:6379

For an existing database, preserve its database name. Set PUBLIC_API_BASE and PUBLIC_RPC_URL to externally reachable URLs. Keep signer files outside Git and point their configuration to the mounted paths: /run/secrets/testnet-operator.json and /run/secrets/solana-source-keeper.json. API and worker run as UID 1000; that user must be able to read the mounted files and write the data directory. Mounts refuse to create missing host paths.

Build and start · repository root
docker compose --env-file deploy/.env -f deploy/compose.yaml config --quiet
docker compose --env-file deploy/.env -f deploy/compose.yaml build api client
docker compose --env-file deploy/.env -f deploy/compose.yaml up -d --no-build

The API and client bind to loopback on the configured host ports. Put your HTTPS proxy in front of those ports. Cloudflare Tunnel is optional: set TERMBOOK_TUNNEL_TOKEN_FILE and add --profile tunnel before up. Uploaded backend and client images can instead be pulled with the same release tag and started with --no-build.

After execution

  1. Verify receipts, runtime identities, initialized proxy state and storage compatibility.
  2. Verify sources and updated dependencies against the exact implementation bytecode.
  3. Confirm feeds, House policies, liquidity, account factory and keeper permissions.
  4. Restart services with current public configuration and check /ready.
  5. Run deployment-bound borrowing, repayment, closure and borrower-independent recovery.
Documentation
8 results

Let’s talk

Tell us what you have in mind.

Supply liquidity