| name | clickhouse-multi-env-setup |
| description | Configure ClickHouse across dev, staging, and production with environment-specific
settings, secrets management, and infrastructure-as-code patterns.
Use when setting up per-environment ClickHouse instances, managing connection
configs, or deploying to multiple environments.
Trigger: "clickhouse environments", "clickhouse dev staging prod",
"clickhouse multi-env", "clickhouse environment config", "clickhouse staging setup".
|
| allowed-tools | Read, Write, Edit, Bash(aws:*), Bash(gcloud:*), Bash(vault:*) |
| version | 1.0.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","database","analytics","clickhouse","olap"] |
| compatible-with | claude-code |
ClickHouse Multi-Environment Setup
Overview
Configure separate ClickHouse instances for development, staging, and production
with proper secrets management, environment detection, and infrastructure-as-code.
Prerequisites
- ClickHouse Cloud account or self-hosted instances per environment
- Secret management solution (Vault, AWS Secrets Manager, GCP Secret Manager)
- CI/CD pipeline with environment variables
Instructions
Step 1: Environment Strategy
| Environment | Instance | Purpose | Data |
|---|
| Development | Docker local | Fast iteration | Synthetic seed data |
| Staging | ClickHouse Cloud (Dev tier) | Pre-prod validation | Sampled prod copy |
| Production | ClickHouse Cloud (Prod tier) | Live traffic | Real data |
Step 2: Configuration Module
interface ClickHouseEnvConfig {
url: string;
username: string;
password: string;
database: string;
maxConnections: number;
requestTimeout: number;
compression: boolean;
}
const configs: Record<string, ClickHouseEnvConfig> = {
development: {
url: 'http://localhost:8123',
username: 'default',
password: process.env. ?? ,
: ,
: ,
: ,
: ,
},
: {
: process.. ?? ,
: process.. ?? ,
: process..!,
: ,
: ,
: ,
: ,
},
: {
: process..!,
: process..!,
: process..!,
: ,
: ,
: ,
: ,
},
};
(): {
env = process.. ?? ;
config = configs[env];
(!config) ();
(env !== ) {
(!config.) ();
(!config..()) {
();
}
}
config;
}