Advanced Usage
Multi-Environment Deployments
Written By: Harry Osborn
Last Updated on June 5, 2025
Introduction
Managing multiple clusters is critical for safe on-chain development. This page covers how to define environments, override configurations, automate versioning with codified deploy matrices, and roll back on failure—all within CODI’s platform.
1. Environment Concepts
Clusters: Devnet for experiments, Testnet for staging, Mainnet for production.
Isolation: Separate state, tokens, and endpoints per environment to prevent cross-contamination.
2. Configuring codi.toml
for Clusters
Sections: Use environment keys under
[deploy]
.Overrides: Specify network, retries, timeouts per cluster.
3. Automated Versioning & Rollbacks
Semantic Version Tags: CODI auto-increments version based on Git tags or manual
--version
flag.Snapshot Nodes: MCP stores last successful deploy under
mcp.deploy.<env>
for each cluster.Rollback Command:
Reverts to the last snapshot for that environment.
4. Environment-Specific Overrides & Secrets
Secret Store: Safely reference environment variables (
SOLANA_WALLET_KEY_DEV
,SOLANA_WALLET_KEY_MAIN
) in CI or UI.Overrides: Use
codi config set
to change per-environment parameters:
5. Example: Deploy Matrix
Job | Devnet | Testnet | Mainnet |
---|---|---|---|
Command |
|
|
|
Timeout | 300s | 600s | 900s |
Retries | 2 | 3 | 5 |
RollbackKey |
|
|
|
Conclusion
Multi-environment deployments in CODI provide safety, traceability, and flexibility. Define clusters in codi.toml
, automate versioning and rollbacks, and manage secrets per environment to streamline your on-chain release process.
Related to Advanced Usage