The commercial repository carries the product's internal history: audits, screenshots, briefs, decisions, pricing, publication drafts, personal data and research runs. None of it belongs in the community edition. - delete judging/, "UAT 3/", benchmarks/ (including LoCoMo data under CC BY-NC), preflight-results/, gepa-phase-5/, notes/, decisions/, .understand-anything/, .agents/, .lovable/, the legacy sidecar/ package and waggle-cowork/ (an analysis of Claude Code sources) - delete docs/ except docs/oss, the user guides (without the team-mode guide), the reference, methodology, architecture, getting-started and contributing pages, which P2.4 rewrites - delete render.yaml, .parity-allowlist, the retired mind-parity and sync-mind workflows and 29 one-off scripts nothing references - delete tests that only checked removed files (sidecar package, Render blueprint, UAT capture, benchmark harness isolation, internal audit and signing docs); drop sidecar/ and benchmarks/ from the hive-mind subtree split guard; prune ignore, attribute, lint and test globs - replace the commercial README with an interim one for this edition Source comments still point at some deleted docs; P2.2 part 2 cleans them together with names and paths.
82 lines
3.6 KiB
TypeScript
82 lines
3.6 KiB
TypeScript
/**
|
|
* 9D-5/9D-6: Deployment configuration tests.
|
|
*
|
|
* Validates Docker Compose, Dockerfile, render.yaml, and .dockerignore
|
|
* are well-formed and contain expected configuration.
|
|
*/
|
|
import { describe, it, expect } from 'vitest';
|
|
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
|
|
const ROOT = path.resolve(import.meta.dirname, '..', '..', '..');
|
|
|
|
describe('Docker Deployment', () => {
|
|
it('Dockerfile exists and has required stages', () => {
|
|
const content = fs.readFileSync(path.join(ROOT, 'Dockerfile'), 'utf-8');
|
|
expect(content).toContain('FROM node:20-alpine AS builder');
|
|
expect(content).toContain('FROM node:20-alpine');
|
|
expect(content).toContain('EXPOSE 3333');
|
|
expect(content).toContain('HEALTHCHECK');
|
|
expect(content).toContain('VOLUME ["/data"]');
|
|
});
|
|
|
|
it('Dockerfile builds frontend in builder stage', () => {
|
|
const content = fs.readFileSync(path.join(ROOT, 'Dockerfile'), 'utf-8');
|
|
expect(content).toContain('npm run build');
|
|
// Root `dist/` is canonical since apps/web frontend migration (Apr-12, commit a883050).
|
|
expect(content).toContain('COPY --from=builder /app/dist dist');
|
|
});
|
|
|
|
it('Dockerfile sets WAGGLE_FRONTEND_DIR for static serving', () => {
|
|
const content = fs.readFileSync(path.join(ROOT, 'Dockerfile'), 'utf-8');
|
|
expect(content).toContain('WAGGLE_FRONTEND_DIR=/app/dist');
|
|
});
|
|
|
|
it('production docker-compose.yml exists with required services', () => {
|
|
const content = fs.readFileSync(path.join(ROOT, 'docker-compose.production.yml'), 'utf-8');
|
|
expect(content).toContain('waggle:');
|
|
expect(content).toContain('postgres:');
|
|
expect(content).toContain('redis:');
|
|
expect(content).toContain('DATABASE_URL');
|
|
expect(content).toContain('REDIS_URL');
|
|
expect(content).toContain('ANTHROPIC_API_KEY');
|
|
});
|
|
|
|
it('production compose has health checks on all services', () => {
|
|
const content = fs.readFileSync(path.join(ROOT, 'docker-compose.production.yml'), 'utf-8');
|
|
// Count healthcheck occurrences (waggle, postgres, redis = 3)
|
|
const healthchecks = (content.match(/healthcheck:/g) || []).length;
|
|
expect(healthchecks).toBeGreaterThanOrEqual(3);
|
|
});
|
|
|
|
it('production compose uses depends_on with health conditions', () => {
|
|
const content = fs.readFileSync(path.join(ROOT, 'docker-compose.production.yml'), 'utf-8');
|
|
expect(content).toContain('condition: service_healthy');
|
|
});
|
|
|
|
it('production compose fails closed when database and object-store secrets are missing', () => {
|
|
const content = fs.readFileSync(path.join(ROOT, 'docker-compose.production.yml'), 'utf-8');
|
|
expect(content).toContain('${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD}');
|
|
expect(content).toContain('${MINIO_ROOT_USER:?set MINIO_ROOT_USER}');
|
|
expect(content).toContain('${MINIO_ROOT_PASSWORD:?set MINIO_ROOT_PASSWORD}');
|
|
expect(content).not.toContain('${POSTGRES_PASSWORD:-');
|
|
expect(content).not.toContain('${MINIO_ROOT_PASSWORD:-');
|
|
});
|
|
|
|
it('production compose requires the Clerk webhook signing secret', () => {
|
|
const content = fs.readFileSync(path.join(ROOT, 'docker-compose.production.yml'), 'utf-8');
|
|
expect(content).toContain(
|
|
'CLERK_WEBHOOK_SIGNING_SECRET=${CLERK_WEBHOOK_SIGNING_SECRET:?set CLERK_WEBHOOK_SIGNING_SECRET}',
|
|
);
|
|
expect(content).not.toContain('CLERK_WEBHOOK_SIGNING_SECRET=${CLERK_WEBHOOK_SIGNING_SECRET:-');
|
|
});
|
|
|
|
it('.dockerignore excludes sensitive and unnecessary files', () => {
|
|
const content = fs.readFileSync(path.join(ROOT, '.dockerignore'), 'utf-8');
|
|
expect(content).toContain('node_modules');
|
|
expect(content).toContain('.git');
|
|
expect(content).toContain('.env*');
|
|
expect(content).toContain('*.mind');
|
|
});
|
|
});
|