Plan a Docker Deploy
easy5 mindeploy-docker.ts
Before deploying you want to know what your project needs — server, services, secrets — and whether the machine is ready.
What it shows
- Analyze a project with
ProjectAnalyzer - Plan, run preflight checks and dry-run a deploy with
Deployer
The code
deploy-docker.ts
import { Deployer, ProjectAnalyzer } from '@cogitator-ai/deploy';
const projectDir = process.cwd();
const analysis = new ProjectAnalyzer().analyze(projectDir);
console.log('Server:', analysis.server ?? '(not detected)');
console.log('Services:', analysis.services);
console.log('Secrets:', analysis.secrets.join(', ') || '(none)');
const deployer = new Deployer();
const plan = await deployer.plan({
projectDir,
target: 'docker',
noPush: true,
configOverrides: {
port: 3000,
image: 'my-agent',
services: { redis: true, postgres: false },
health: { path: '/cogitator/health', interval: '30s', timeout: '5s' },
resources: { memory: '512mb', cpu: 1 },
},
});
for (const check of plan.preflight.checks) {
console.log(`[${check.passed ? 'PASS' : 'FAIL'}] ${check.name}: ${check.message}${check.fix ? ` (fix: ${check.fix})` : ''}`);
}
const result = await deployer.deploy({
projectDir,
target: 'docker',
dryRun: true,
noPush: true,
configOverrides: { port: 3000, image: 'my-agent', services: { redis: true } },
});
console.log(result.success ? 'Dry run OK' : `Dry run failed: ${result.error}`);
console.log('Targets:', deployer.availableTargets().join(', '));Run it
install · bash
pnpm add @cogitator-ai/deployrun · bash
npx tsx deploy-docker.tsOr run the full example from a clone of the repository (keys in .env):
repository · bash
npx tsx examples/infrastructure/04-deploy-docker.ts