container-superposition 0.1.1 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +569 -8
- package/dist/scripts/init.js +436 -254
- package/dist/scripts/init.js.map +1 -1
- package/dist/tool/commands/doctor.d.ts +15 -0
- package/dist/tool/commands/doctor.d.ts.map +1 -0
- package/dist/tool/commands/doctor.js +862 -0
- package/dist/tool/commands/doctor.js.map +1 -0
- package/dist/tool/commands/explain.d.ts +13 -0
- package/dist/tool/commands/explain.d.ts.map +1 -0
- package/dist/tool/commands/explain.js +299 -0
- package/dist/tool/commands/explain.js.map +1 -0
- package/dist/tool/commands/list.d.ts +16 -0
- package/dist/tool/commands/list.d.ts.map +1 -0
- package/dist/tool/commands/list.js +121 -0
- package/dist/tool/commands/list.js.map +1 -0
- package/dist/tool/commands/plan.d.ts +67 -0
- package/dist/tool/commands/plan.d.ts.map +1 -0
- package/dist/tool/commands/plan.js +851 -0
- package/dist/tool/commands/plan.js.map +1 -0
- package/dist/tool/questionnaire/composer.d.ts +16 -2
- package/dist/tool/questionnaire/composer.d.ts.map +1 -1
- package/dist/tool/questionnaire/composer.js +411 -200
- package/dist/tool/questionnaire/composer.js.map +1 -1
- package/dist/tool/readme/markdown-parser.d.ts.map +1 -1
- package/dist/tool/readme/markdown-parser.js.map +1 -1
- package/dist/tool/readme/readme-generator.d.ts.map +1 -1
- package/dist/tool/readme/readme-generator.js +11 -6
- package/dist/tool/readme/readme-generator.js.map +1 -1
- package/dist/tool/schema/deployment-targets.d.ts +77 -0
- package/dist/tool/schema/deployment-targets.d.ts.map +1 -0
- package/dist/tool/schema/deployment-targets.js +91 -0
- package/dist/tool/schema/deployment-targets.js.map +1 -0
- package/dist/tool/schema/manifest-migrations.d.ts +51 -0
- package/dist/tool/schema/manifest-migrations.d.ts.map +1 -0
- package/dist/tool/schema/manifest-migrations.js +159 -0
- package/dist/tool/schema/manifest-migrations.js.map +1 -0
- package/dist/tool/schema/overlay-loader.d.ts +1 -1
- package/dist/tool/schema/overlay-loader.d.ts.map +1 -1
- package/dist/tool/schema/overlay-loader.js +42 -14
- package/dist/tool/schema/overlay-loader.js.map +1 -1
- package/dist/tool/schema/types.d.ts +62 -2
- package/dist/tool/schema/types.d.ts.map +1 -1
- package/dist/tool/utils/gitignore.d.ts +15 -0
- package/dist/tool/utils/gitignore.d.ts.map +1 -0
- package/dist/tool/utils/gitignore.js +41 -0
- package/dist/tool/utils/gitignore.js.map +1 -0
- package/dist/tool/utils/merge.d.ts +134 -0
- package/dist/tool/utils/merge.d.ts.map +1 -0
- package/dist/tool/utils/merge.js +277 -0
- package/dist/tool/utils/merge.js.map +1 -0
- package/dist/tool/utils/port-utils.d.ts +29 -0
- package/dist/tool/utils/port-utils.d.ts.map +1 -0
- package/dist/tool/utils/port-utils.js +128 -0
- package/dist/tool/utils/port-utils.js.map +1 -0
- package/dist/tool/utils/services-export.d.ts +14 -0
- package/dist/tool/utils/services-export.d.ts.map +1 -0
- package/dist/tool/utils/services-export.js +478 -0
- package/dist/tool/utils/services-export.js.map +1 -0
- package/dist/tool/utils/summary.d.ts +69 -0
- package/dist/tool/utils/summary.d.ts.map +1 -0
- package/dist/tool/utils/summary.js +260 -0
- package/dist/tool/utils/summary.js.map +1 -0
- package/dist/tool/utils/version.d.ts +9 -0
- package/dist/tool/utils/version.d.ts.map +1 -0
- package/dist/tool/utils/version.js +32 -0
- package/dist/tool/utils/version.js.map +1 -0
- package/docs/architecture.md +25 -21
- package/docs/deployment-targets.md +150 -0
- package/docs/discovery-commands.md +442 -0
- package/docs/merge-strategy.md +700 -0
- package/docs/minimal-and-editor.md +265 -0
- package/docs/overlay-imports.md +209 -0
- package/docs/overlay-manifest-refactoring.md +2 -2
- package/docs/overlay-metadata-archive.md +1 -1
- package/docs/overlays.md +139 -28
- package/docs/presets-architecture.md +3 -3
- package/docs/presets.md +1 -1
- package/docs/publishing.md +36 -35
- package/docs/team-workflow.md +540 -0
- package/overlays/.presets/data-engineering.yml +392 -0
- package/overlays/.presets/event-sourced-service.yml +262 -0
- package/overlays/.presets/frontend.yml +287 -0
- package/overlays/.presets/k8s-operator-dev.yml +462 -0
- package/overlays/{presets → .presets}/microservice.yml +32 -6
- package/overlays/.presets/web-api.yml +129 -0
- package/overlays/.registry/README.md +1 -1
- package/overlays/.registry/deployment-targets.yml +54 -0
- package/overlays/.shared/README.md +43 -0
- package/overlays/.shared/compose/common-healthchecks.yml +38 -0
- package/overlays/.shared/otel/instrumentation.env +20 -0
- package/overlays/.shared/otel/otel-base-config.yaml +30 -0
- package/overlays/.shared/vscode/recommended-extensions.json +14 -0
- package/overlays/README.md +1 -1
- package/overlays/cloudflared/README.md +190 -0
- package/overlays/cloudflared/devcontainer.patch.json +3 -0
- package/overlays/cloudflared/overlay.yml +15 -0
- package/overlays/cloudflared/setup.sh +49 -0
- package/overlays/cloudflared/verify.sh +21 -0
- package/overlays/codex/overlay.yml +1 -0
- package/overlays/direnv/README.md +6 -4
- package/overlays/direnv/setup.sh +0 -12
- package/overlays/duckdb/README.md +274 -0
- package/overlays/duckdb/devcontainer.patch.json +10 -0
- package/overlays/duckdb/overlay.yml +17 -0
- package/overlays/duckdb/setup.sh +45 -0
- package/overlays/duckdb/verify.sh +32 -0
- package/overlays/git-helpers/overlay.yml +1 -0
- package/overlays/grafana/README.md +5 -5
- package/overlays/grafana/dashboard-provider.yml +1 -1
- package/overlays/grafana/docker-compose.yml +2 -2
- package/overlays/grafana/overlay.yml +6 -1
- package/overlays/grpc-tools/README.md +242 -0
- package/overlays/grpc-tools/devcontainer.patch.json +14 -0
- package/overlays/grpc-tools/overlay.yml +14 -0
- package/overlays/grpc-tools/setup.sh +57 -0
- package/overlays/grpc-tools/verify.sh +47 -0
- package/overlays/jaeger/overlay.yml +16 -3
- package/overlays/jupyter/.env.example +6 -0
- package/overlays/jupyter/README.md +210 -0
- package/overlays/jupyter/devcontainer.patch.json +14 -0
- package/overlays/jupyter/docker-compose.yml +23 -0
- package/overlays/jupyter/overlay.yml +18 -0
- package/overlays/jupyter/verify.sh +35 -0
- package/overlays/keycloak/.env.example +5 -0
- package/overlays/keycloak/README.md +238 -0
- package/overlays/keycloak/devcontainer.patch.json +17 -0
- package/overlays/keycloak/docker-compose.yml +32 -0
- package/overlays/keycloak/overlay.yml +23 -0
- package/overlays/keycloak/verify.sh +54 -0
- package/overlays/kind/README.md +221 -0
- package/overlays/kind/devcontainer.patch.json +10 -0
- package/overlays/kind/overlay.yml +18 -0
- package/overlays/kind/setup.sh +43 -0
- package/overlays/kind/verify.sh +40 -0
- package/overlays/localstack/.env.example +6 -0
- package/overlays/localstack/README.md +188 -0
- package/overlays/localstack/devcontainer.patch.json +21 -0
- package/overlays/localstack/docker-compose.yml +25 -0
- package/overlays/localstack/overlay.yml +18 -0
- package/overlays/localstack/verify.sh +47 -0
- package/overlays/loki/overlay.yml +6 -1
- package/overlays/mailpit/.env.example +4 -0
- package/overlays/mailpit/README.md +191 -0
- package/overlays/mailpit/devcontainer.patch.json +20 -0
- package/overlays/mailpit/docker-compose.yml +17 -0
- package/overlays/mailpit/overlay.yml +26 -0
- package/overlays/mailpit/verify.sh +52 -0
- package/overlays/modern-cli-tools/overlay.yml +1 -0
- package/overlays/mongodb/overlay.yml +12 -2
- package/overlays/mysql/overlay.yml +12 -2
- package/overlays/nats/overlay.yml +12 -2
- package/overlays/ngrok/overlay.yml +2 -1
- package/overlays/openapi-tools/README.md +243 -0
- package/overlays/openapi-tools/devcontainer.patch.json +10 -0
- package/overlays/openapi-tools/overlay.yml +16 -0
- package/overlays/openapi-tools/setup.sh +45 -0
- package/overlays/openapi-tools/verify.sh +51 -0
- package/overlays/otel-collector/overlay.yml.example +26 -0
- package/overlays/postgres/overlay.yml +6 -1
- package/overlays/prometheus/overlay.yml +6 -1
- package/overlays/python/README.md +51 -35
- package/overlays/python/devcontainer.patch.json +7 -4
- package/overlays/python/setup.sh +50 -23
- package/overlays/python/verify.sh +29 -1
- package/overlays/rabbitmq/overlay.yml +12 -2
- package/overlays/redis/overlay.yml +6 -1
- package/overlays/tilt/README.md +259 -0
- package/overlays/tilt/devcontainer.patch.json +17 -0
- package/overlays/tilt/overlay.yml +19 -0
- package/overlays/tilt/setup.sh +25 -0
- package/overlays/tilt/verify.sh +24 -0
- package/package.json +8 -6
- package/tool/README.md +12 -16
- package/tool/schema/overlay-manifest.schema.json +64 -4
- package/tool/schema/superposition-manifest.schema.json +104 -0
- package/overlays/presets/web-api.yml +0 -109
- /package/overlays/{presets → .presets}/docs-site.yml +0 -0
- /package/overlays/{presets → .presets}/fullstack.yml +0 -0
package/README.md
CHANGED
|
@@ -1,7 +1,80 @@
|
|
|
1
1
|
# container-superposition
|
|
2
2
|
|
|
3
|
+
[](https://github.com/veggerby/container-superposition/actions/workflows/validate-overlays.yml)
|
|
4
|
+
[](https://github.com/veggerby/container-superposition/actions/workflows/build-devcontainers.yml)
|
|
5
|
+
[](https://www.npmjs.com/package/container-superposition)
|
|
6
|
+
|
|
3
7
|
Composable devcontainer scaffolds that collapse into working environments.
|
|
4
8
|
|
|
9
|
+
## ⚡ 30-Second Quickstart
|
|
10
|
+
|
|
11
|
+
Get a fully-configured development environment in one command:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Web API with database and observability (Node.js)
|
|
15
|
+
npx container-superposition init --preset web-api --language nodejs
|
|
16
|
+
# Creates: Node.js + PostgreSQL + Redis + Grafana + Prometheus + Loki
|
|
17
|
+
|
|
18
|
+
# Or compose + specific language
|
|
19
|
+
npx container-superposition init --stack compose --language nodejs --database postgres
|
|
20
|
+
# Creates: Node.js + PostgreSQL devcontainer
|
|
21
|
+
|
|
22
|
+
# Then open in VS Code
|
|
23
|
+
code .
|
|
24
|
+
# Click "Reopen in Container" when prompted
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**That's it!** Your devcontainer is ready. Jump to [Quick Start](#-quick-start) for more options or [Examples](#-examples) for real-world references.
|
|
28
|
+
|
|
29
|
+
### 👁️ Preview Before You Commit
|
|
30
|
+
|
|
31
|
+
Use the `plan` command to see exactly what will be created:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx container-superposition plan --stack compose --overlays nodejs,postgres,grafana,prometheus
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Example output:**
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
╭──────────────────╮
|
|
41
|
+
│ Generation Plan │
|
|
42
|
+
╰──────────────────╯
|
|
43
|
+
|
|
44
|
+
Stack: compose
|
|
45
|
+
|
|
46
|
+
Overlays Selected:
|
|
47
|
+
✓ nodejs (Node.js)
|
|
48
|
+
✓ postgres (PostgreSQL)
|
|
49
|
+
✓ grafana (Grafana)
|
|
50
|
+
✓ prometheus (Prometheus)
|
|
51
|
+
|
|
52
|
+
Port Mappings:
|
|
53
|
+
postgres: 5432
|
|
54
|
+
grafana: 3000
|
|
55
|
+
prometheus: 9090
|
|
56
|
+
|
|
57
|
+
Files to Create/Modify:
|
|
58
|
+
.devcontainer/
|
|
59
|
+
📄 .env.example
|
|
60
|
+
📄 README.md
|
|
61
|
+
📄 devcontainer.json
|
|
62
|
+
📄 docker-compose.yml
|
|
63
|
+
📄 global-packages-nodejs.txt
|
|
64
|
+
📄 ports.json
|
|
65
|
+
📄 superposition.json
|
|
66
|
+
.devcontainer/scripts/
|
|
67
|
+
📄 setup-nodejs.sh
|
|
68
|
+
📄 verify-grafana.sh
|
|
69
|
+
📄 verify-nodejs.sh
|
|
70
|
+
📄 verify-postgres.sh
|
|
71
|
+
📄 verify-prometheus.sh
|
|
72
|
+
|
|
73
|
+
✓ No conflicts detected. Ready to generate!
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
This gives you full visibility into the configuration before any files are created.
|
|
77
|
+
|
|
5
78
|
## 🎯 Purpose
|
|
6
79
|
|
|
7
80
|
Container Superposition provides a **modular, overlay-based system** for building devcontainer configurations. Start with a minimal base template, then compose it with language frameworks, databases, observability tools, and cloud utilities to create your ideal development environment.
|
|
@@ -253,9 +326,110 @@ npm run init
|
|
|
253
326
|
|
|
254
327
|
- **`init`** - Initialize a new devcontainer configuration (default command)
|
|
255
328
|
- **`regen`** - Regenerate devcontainer from existing manifest
|
|
256
|
-
- **`list`** - List all available overlays and presets
|
|
329
|
+
- **`list`** - List all available overlays and presets with filtering options
|
|
330
|
+
- **`explain`** - Show detailed information about a specific overlay
|
|
331
|
+
- **`plan`** - Preview what will be generated before creating devcontainer
|
|
257
332
|
- **`doctor`** - Check environment and validate configuration
|
|
258
333
|
|
|
334
|
+
#### Discovery Commands
|
|
335
|
+
|
|
336
|
+
**List available overlays:**
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
# List all overlays grouped by category
|
|
340
|
+
npx container-superposition list
|
|
341
|
+
|
|
342
|
+
# Filter by category
|
|
343
|
+
npx container-superposition list --category database
|
|
344
|
+
|
|
345
|
+
# Filter by tags
|
|
346
|
+
npx container-superposition list --tags observability
|
|
347
|
+
|
|
348
|
+
# Filter by stack support
|
|
349
|
+
npx container-superposition list --supports compose
|
|
350
|
+
|
|
351
|
+
# JSON output for scripting
|
|
352
|
+
npx container-superposition list --json
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
**Explain an overlay in detail:**
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
# Show detailed information about an overlay
|
|
359
|
+
npx container-superposition explain postgres
|
|
360
|
+
|
|
361
|
+
# JSON output
|
|
362
|
+
npx container-superposition explain nodejs --json
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
**Plan before generating:**
|
|
366
|
+
|
|
367
|
+
```bash
|
|
368
|
+
# Preview what will be created
|
|
369
|
+
npx container-superposition plan --stack compose --overlays postgres,grafana
|
|
370
|
+
|
|
371
|
+
# Include port offset
|
|
372
|
+
npx container-superposition plan --stack compose --overlays postgres,redis --port-offset 100
|
|
373
|
+
|
|
374
|
+
# JSON output
|
|
375
|
+
npx container-superposition plan --stack compose --overlays nodejs,postgres --json
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
The `plan` command shows:
|
|
379
|
+
|
|
380
|
+
- Selected overlays and auto-added dependencies
|
|
381
|
+
- Port mappings (with offset applied)
|
|
382
|
+
- Files that will be created/modified
|
|
383
|
+
- Conflict detection
|
|
384
|
+
|
|
385
|
+
#### Environment Validation
|
|
386
|
+
|
|
387
|
+
The `doctor` command provides comprehensive environment diagnostics:
|
|
388
|
+
|
|
389
|
+
```bash
|
|
390
|
+
# Check environment and configuration
|
|
391
|
+
npx container-superposition doctor
|
|
392
|
+
|
|
393
|
+
# Check specific devcontainer
|
|
394
|
+
npx container-superposition doctor --output /path/to/.devcontainer
|
|
395
|
+
|
|
396
|
+
# Get JSON output for CI/CD
|
|
397
|
+
npx container-superposition doctor --json
|
|
398
|
+
|
|
399
|
+
# Apply automatic fixes (where possible)
|
|
400
|
+
npx container-superposition doctor --fix
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
**Doctor checks:**
|
|
404
|
+
|
|
405
|
+
- ✅ Node.js version compatibility (>= 20)
|
|
406
|
+
- ✅ Docker daemon connectivity
|
|
407
|
+
- ✅ Docker Compose v2 availability (when using compose stack)
|
|
408
|
+
- ✅ Overlay integrity (valid manifests, required files)
|
|
409
|
+
- ✅ Manifest compatibility
|
|
410
|
+
- ⚠️ Port conflicts (best-effort detection)
|
|
411
|
+
|
|
412
|
+
**Example output:**
|
|
413
|
+
|
|
414
|
+
```
|
|
415
|
+
🔍 Running diagnostics...
|
|
416
|
+
|
|
417
|
+
Environment:
|
|
418
|
+
✓ Node.js version: v20.10.0 (>= 20.0.0 required)
|
|
419
|
+
✓ Docker daemon: Docker version 24.0.5
|
|
420
|
+
✓ Docker Compose: v2.23.0 (v2 required)
|
|
421
|
+
|
|
422
|
+
Overlays:
|
|
423
|
+
✓ All 46 overlays valid
|
|
424
|
+
|
|
425
|
+
Manifest:
|
|
426
|
+
✓ Manifest version: Format version 0.1.0
|
|
427
|
+
✓ DevContainer config: devcontainer.json valid
|
|
428
|
+
|
|
429
|
+
Summary:
|
|
430
|
+
✓ 51 passed
|
|
431
|
+
```
|
|
432
|
+
|
|
259
433
|
The questionnaire guides you through:
|
|
260
434
|
|
|
261
435
|
1. **Preset or Custom** - Start from a pre-configured stack or build custom?
|
|
@@ -357,22 +531,160 @@ npm run init -- --stack compose --language nodejs --postgres --port-offset 200 -
|
|
|
357
531
|
|
|
358
532
|
This automatically adjusts all exposed ports in docker-compose.yml and documents the offset in .env.example.
|
|
359
533
|
|
|
360
|
-
###
|
|
534
|
+
### Deployment Target Support
|
|
535
|
+
|
|
536
|
+
Container Superposition validates overlay compatibility with different deployment environments (local, Codespaces, Gitpod, DevPod) using the `--target` flag.
|
|
537
|
+
|
|
538
|
+
```bash
|
|
539
|
+
# Specify deployment target
|
|
540
|
+
npx container-superposition init --target codespaces
|
|
541
|
+
npx container-superposition init --target gitpod
|
|
542
|
+
npx container-superposition init --target local # default
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
The tool automatically validates overlay compatibility and warns you when selecting overlays that won't work in your target environment (e.g., `docker-sock` doesn't work in Codespaces).
|
|
546
|
+
|
|
547
|
+
**📖 See [Deployment Targets Documentation](docs/deployment-targets.md) for:**
|
|
548
|
+
|
|
549
|
+
- Complete target comparison table
|
|
550
|
+
- Interactive mode examples
|
|
551
|
+
- Environment-specific configuration
|
|
552
|
+
- Compatibility rules and best practices
|
|
553
|
+
|
|
554
|
+
### Overlay Compatibility Matrix
|
|
555
|
+
|
|
556
|
+
Common overlays and their compatibility with different deployment targets:
|
|
557
|
+
|
|
558
|
+
| Overlay | Local | Codespaces | Gitpod | Notes |
|
|
559
|
+
| -------------------- | ----- | ---------- | ------ | ---------------------------------------- |
|
|
560
|
+
| **docker-sock** | ✅ | ❌ | ❌ | Requires host Docker socket (local only) |
|
|
561
|
+
| **docker-in-docker** | ✅ | ✅ | ✅ | Slower but portable |
|
|
562
|
+
| **postgres** | ✅ | ✅ | ✅ | |
|
|
563
|
+
| **redis** | ✅ | ✅ | ✅ | |
|
|
564
|
+
| **mysql** | ✅ | ✅ | ✅ | |
|
|
565
|
+
| **mongodb** | ✅ | ✅ | ✅ | |
|
|
566
|
+
| **sqlserver** | ✅ | ✅ | ✅ | Needs memory (>2GB recommended) |
|
|
567
|
+
| **rabbitmq** | ✅ | ✅ | ✅ | |
|
|
568
|
+
| **grafana** | ✅ | ✅ | ✅ | |
|
|
569
|
+
| **prometheus** | ✅ | ✅ | ✅ | |
|
|
570
|
+
| **jaeger** | ✅ | ✅ | ✅ | |
|
|
571
|
+
| **playwright** | ✅ | ✅ | ✅ | Requires browser dependencies |
|
|
572
|
+
| **aws-cli** | ✅ | ✅ | ✅ | CLI tools work everywhere |
|
|
573
|
+
| **kubectl-helm** | ✅ | ✅ | ✅ | |
|
|
574
|
+
| **terraform** | ✅ | ✅ | ✅ | |
|
|
575
|
+
|
|
576
|
+
**Legend:**
|
|
577
|
+
|
|
578
|
+
- ✅ Fully supported
|
|
579
|
+
- ❌ Not supported (technical limitation)
|
|
580
|
+
|
|
581
|
+
The `--target` flag enables automatic validation during generation.
|
|
582
|
+
|
|
583
|
+
## ⚠️ Security Considerations
|
|
584
|
+
|
|
585
|
+
**Important:** Container Superposition is designed for **development environments only**. Be aware of these security implications:
|
|
586
|
+
|
|
587
|
+
### docker-sock Overlay
|
|
588
|
+
|
|
589
|
+
- **⚠️ Risk:** Provides **root-level access** to host Docker daemon
|
|
590
|
+
- **⚠️ Limitation:** Not supported in GitHub Codespaces (requires local Docker)
|
|
591
|
+
- **✅ Alternative:** Use `docker-in-docker` for isolation and portability
|
|
592
|
+
- **✅ When to use:** Local development only, trusted code only
|
|
593
|
+
|
|
594
|
+
**Why this matters:**
|
|
361
595
|
|
|
362
|
-
|
|
596
|
+
Mounting `/var/run/docker.sock` gives the container full control over the host's Docker daemon. A compromised container could:
|
|
363
597
|
|
|
364
|
-
-
|
|
365
|
-
-
|
|
366
|
-
-
|
|
367
|
-
|
|
598
|
+
- Access your entire filesystem via volume mounts
|
|
599
|
+
- Create privileged containers
|
|
600
|
+
- Effectively gain root access to your host machine
|
|
601
|
+
|
|
602
|
+
**Best practices:**
|
|
603
|
+
|
|
604
|
+
- ✅ Only use on your local development machine
|
|
605
|
+
- ✅ Never use in multi-tenant or production environments
|
|
606
|
+
- ✅ Audit containers created from within the devcontainer
|
|
607
|
+
- ❌ Don't use with untrusted code or dependencies
|
|
608
|
+
|
|
609
|
+
### Database Default Credentials
|
|
610
|
+
|
|
611
|
+
All database overlays (PostgreSQL, Redis, MySQL, etc.) use **development-only default credentials**:
|
|
612
|
+
|
|
613
|
+
- Default passwords like `postgres`, `redis`, `admin`
|
|
614
|
+
- No authentication enabled by default (where applicable)
|
|
615
|
+
- Designed for local development convenience
|
|
616
|
+
|
|
617
|
+
**Best practices:**
|
|
618
|
+
|
|
619
|
+
- ✅ Change default passwords for any networked testing
|
|
620
|
+
- ✅ Never expose database ports publicly
|
|
621
|
+
- ✅ Use `.env` (gitignored) for custom credentials
|
|
622
|
+
- ❌ Never commit real credentials to version control
|
|
623
|
+
|
|
624
|
+
### Environment Files
|
|
625
|
+
|
|
626
|
+
- **`.env.example`** - Committed to git, contains templates and defaults
|
|
627
|
+
- **`.env`** - Gitignored, contains your actual values (may include secrets)
|
|
628
|
+
|
|
629
|
+
**Best practices:**
|
|
630
|
+
|
|
631
|
+
- ✅ Copy `.env.example` to `.env` and customize
|
|
632
|
+
- ✅ Use placeholder values in `.env.example` (`CHANGEME`, `your-key-here`)
|
|
633
|
+
- ✅ Verify `.env` is in `.gitignore` before committing
|
|
634
|
+
- ❌ Never commit `.env` files with real credentials
|
|
635
|
+
|
|
636
|
+
### General Security Principles
|
|
637
|
+
|
|
638
|
+
- **Development only** - These configurations are optimized for developer productivity, not security
|
|
639
|
+
- **Local networks** - Keep devcontainer services on local networks, don't expose to internet
|
|
640
|
+
- **Update regularly** - Keep base images and overlays up to date
|
|
641
|
+
- **Audit dependencies** - Be aware of what's installed in your devcontainer
|
|
642
|
+
|
|
643
|
+
See individual overlay READMEs (especially [docker-sock](overlays/docker-sock/README.md)) for specific security considerations.
|
|
644
|
+
|
|
645
|
+
### Safe Upgrade and Regeneration
|
|
646
|
+
|
|
647
|
+
Every devcontainer generation creates a `superposition.json` manifest file that records your configuration choices. This manifest is the key to safe updates and iterations.
|
|
648
|
+
|
|
649
|
+
**Why the manifest exists:**
|
|
650
|
+
|
|
651
|
+
- **🔄 Reproducibility** - Recreate exact same configuration on any machine
|
|
652
|
+
- **⬆️ Upgrades** - Pull latest overlay improvements without starting from scratch
|
|
653
|
+
- **🧪 Experimentation** - Try different configurations with automatic backup
|
|
654
|
+
- **👥 Team Sharing** - Commit the manifest for consistent team environments
|
|
655
|
+
|
|
656
|
+
**When to regenerate (regen) vs manual edit:**
|
|
657
|
+
|
|
658
|
+
| Scenario | Use | Why |
|
|
659
|
+
| ---------------------------------- | ---------------------- | -------------------------------------------- |
|
|
660
|
+
| Update to latest overlay versions | `regen` | Get bug fixes and improvements automatically |
|
|
661
|
+
| Add/remove overlays | `init --from-manifest` | Let the tool handle merge complexity |
|
|
662
|
+
| Change port offset | `init --from-manifest` | Automatic port recalculation |
|
|
663
|
+
| Tweak VS Code settings | Manual edit | Simple JSON change, no regeneration needed |
|
|
664
|
+
| Add custom script | Manual edit | Direct file addition |
|
|
665
|
+
| Fix specific devcontainer bug | Manual edit | Quick fix without full regeneration |
|
|
666
|
+
| Switch base image | `init --from-manifest` | Template dependencies may change |
|
|
667
|
+
| Your project evolved significantly | `init` (fresh) | Clean slate with new requirements |
|
|
368
668
|
|
|
369
669
|
**Quick regeneration (recommended):**
|
|
370
670
|
|
|
371
671
|
```bash
|
|
372
|
-
# Simple regen command - automatically finds manifest in .devcontainer/
|
|
672
|
+
# Simple regen command - automatically finds manifest in .devcontainer/ or project root
|
|
373
673
|
npx container-superposition regen
|
|
374
674
|
|
|
375
675
|
# Creates backup and regenerates with exact same settings from manifest
|
|
676
|
+
# Perfect for updating to latest overlay versions
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
**Update to latest version and regenerate:**
|
|
680
|
+
|
|
681
|
+
```bash
|
|
682
|
+
# Update the tool and regenerate in one go
|
|
683
|
+
npx container-superposition@latest regen
|
|
684
|
+
|
|
685
|
+
# Or update globally first
|
|
686
|
+
npm update -g container-superposition
|
|
687
|
+
container-superposition regen
|
|
376
688
|
```
|
|
377
689
|
|
|
378
690
|
**Interactive regeneration with changes:**
|
|
@@ -438,6 +750,175 @@ npx container-superposition init --from-manifest ./.devcontainer/superposition.j
|
|
|
438
750
|
|
|
439
751
|
See [tool/README.md](tool/README.md) for full documentation.
|
|
440
752
|
|
|
753
|
+
## 📂 Filesystem Contract
|
|
754
|
+
|
|
755
|
+
Understanding what Container Superposition writes and where helps you manage your devcontainer configuration effectively.
|
|
756
|
+
|
|
757
|
+
### What Gets Written Where
|
|
758
|
+
|
|
759
|
+
**Generated by the tool:**
|
|
760
|
+
|
|
761
|
+
```
|
|
762
|
+
your-project/
|
|
763
|
+
├── .devcontainer/ # Main devcontainer directory
|
|
764
|
+
│ ├── devcontainer.json # Container configuration
|
|
765
|
+
│ ├── docker-compose.yml # Services (if using compose stack)
|
|
766
|
+
│ ├── .env.example # Environment variable templates
|
|
767
|
+
│ ├── ports.json # Port documentation and connection strings
|
|
768
|
+
│ ├── scripts/ # Setup and verification scripts
|
|
769
|
+
│ │ ├── post-create.sh # Runs once when container is created
|
|
770
|
+
│ │ └── post-start.sh # Runs every time container starts
|
|
771
|
+
│ └── custom/ # Your customizations (preserved across regen)
|
|
772
|
+
│ ├── devcontainer.patch.json
|
|
773
|
+
│ └── docker-compose.patch.yml
|
|
774
|
+
├── superposition.json # Manifest file (enables regeneration)
|
|
775
|
+
└── .devcontainer.backup-*/ # Automatic backups (gitignored)
|
|
776
|
+
```
|
|
777
|
+
|
|
778
|
+
### Files You Should Customize
|
|
779
|
+
|
|
780
|
+
**After generation:**
|
|
781
|
+
|
|
782
|
+
- **`.env`** - Copy from `.env.example`, add your actual values
|
|
783
|
+
- **`.devcontainer/custom/`** - Add your project-specific patches here
|
|
784
|
+
|
|
785
|
+
**Direct edits (survive regeneration):**
|
|
786
|
+
|
|
787
|
+
- `.devcontainer/custom/devcontainer.patch.json` - Extra devcontainer settings
|
|
788
|
+
- `.devcontainer/custom/docker-compose.patch.yml` - Additional services
|
|
789
|
+
- `.devcontainer/custom/environment.env` - Extra environment variables
|
|
790
|
+
- `.devcontainer/custom/scripts/*` - Custom setup scripts
|
|
791
|
+
|
|
792
|
+
**Direct edits (lost on regeneration):**
|
|
793
|
+
|
|
794
|
+
- `.devcontainer/devcontainer.json` - Regenerated from overlays
|
|
795
|
+
- `.devcontainer/docker-compose.yml` - Regenerated from overlays
|
|
796
|
+
- `.devcontainer/scripts/` - Regenerated from overlays
|
|
797
|
+
|
|
798
|
+
### Files You Should Commit
|
|
799
|
+
|
|
800
|
+
**Essential for team collaboration:**
|
|
801
|
+
|
|
802
|
+
- ✅ `superposition.json` - Enables `regen` command
|
|
803
|
+
- ✅ `.devcontainer/` - The generated configuration (team shares setup)
|
|
804
|
+
- ✅ `.env.example` - Template for environment variables
|
|
805
|
+
- ✅ `.devcontainer/custom/` - Your project-specific customizations
|
|
806
|
+
|
|
807
|
+
**Only for certain workflows:**
|
|
808
|
+
|
|
809
|
+
- ⚠️ `superposition.json` only - See [Team Workflow](docs/team-workflow.md) for manifest-only pattern
|
|
810
|
+
|
|
811
|
+
### Files in .gitignore
|
|
812
|
+
|
|
813
|
+
**Automatically added to your `.gitignore`:**
|
|
814
|
+
|
|
815
|
+
```gitignore
|
|
816
|
+
# Environment secrets (never commit)
|
|
817
|
+
.env
|
|
818
|
+
.devcontainer/.env
|
|
819
|
+
|
|
820
|
+
# Regeneration backups (local only)
|
|
821
|
+
.devcontainer.backup-*
|
|
822
|
+
```
|
|
823
|
+
|
|
824
|
+
### Workflow Examples
|
|
825
|
+
|
|
826
|
+
**Individual developer:**
|
|
827
|
+
|
|
828
|
+
```bash
|
|
829
|
+
# 1. Generate devcontainer
|
|
830
|
+
npx container-superposition init --preset web-api --language nodejs
|
|
831
|
+
|
|
832
|
+
# 2. Customize .env from template
|
|
833
|
+
cp .devcontainer/.env.example .devcontainer/.env
|
|
834
|
+
# Edit .env with your values
|
|
835
|
+
|
|
836
|
+
# 3. Add project-specific customization
|
|
837
|
+
mkdir -p .devcontainer/custom
|
|
838
|
+
echo '{"customizations": {"vscode": {"extensions": ["eamodio.gitlens"]}}}' > .devcontainer/custom/devcontainer.patch.json
|
|
839
|
+
|
|
840
|
+
# 4. Commit everything except .env
|
|
841
|
+
git add .devcontainer/ superposition.json
|
|
842
|
+
git commit -m "Add devcontainer configuration"
|
|
843
|
+
```
|
|
844
|
+
|
|
845
|
+
**Team collaboration:**
|
|
846
|
+
|
|
847
|
+
```bash
|
|
848
|
+
# Developer 1: Create and commit
|
|
849
|
+
npx container-superposition init --preset web-api --language nodejs
|
|
850
|
+
git add superposition.json .devcontainer/
|
|
851
|
+
git commit -m "Add devcontainer"
|
|
852
|
+
|
|
853
|
+
# Developer 2: Clone and use
|
|
854
|
+
git clone repo
|
|
855
|
+
code .
|
|
856
|
+
# VS Code: "Reopen in Container"
|
|
857
|
+
cp .devcontainer/.env.example .devcontainer/.env
|
|
858
|
+
# Customize .env with your values
|
|
859
|
+
|
|
860
|
+
# Developer 1: Update to add Redis
|
|
861
|
+
npx container-superposition init --from-manifest superposition.json
|
|
862
|
+
# Add redis in questionnaire
|
|
863
|
+
git add superposition.json .devcontainer/
|
|
864
|
+
git commit -m "Add Redis to devcontainer"
|
|
865
|
+
|
|
866
|
+
# Developer 2: Pull and regenerate
|
|
867
|
+
git pull
|
|
868
|
+
npx container-superposition regen
|
|
869
|
+
# VS Code: "Rebuild Container"
|
|
870
|
+
```
|
|
871
|
+
|
|
872
|
+
See **[Team Workflow Guide](docs/team-workflow.md)** for manifest-only workflow and CI integration.
|
|
873
|
+
|
|
874
|
+
## 📚 Examples
|
|
875
|
+
|
|
876
|
+
Real-world reference configurations to help you get started quickly.
|
|
877
|
+
|
|
878
|
+
### [Web API (Node.js)](examples/web-api-node/)
|
|
879
|
+
|
|
880
|
+
Full-stack web API with complete observability:
|
|
881
|
+
|
|
882
|
+
- **Stack**: Node.js + PostgreSQL + Redis
|
|
883
|
+
- **Observability**: OpenTelemetry Collector + Prometheus + Grafana + Loki
|
|
884
|
+
- **Use case**: Production-ready web API development
|
|
885
|
+
|
|
886
|
+
Each example includes a `superposition.json` manifest. To use:
|
|
887
|
+
|
|
888
|
+
```bash
|
|
889
|
+
cd examples/web-api-node
|
|
890
|
+
npx container-superposition regen
|
|
891
|
+
code .
|
|
892
|
+
# Reopen in Container
|
|
893
|
+
```
|
|
894
|
+
|
|
895
|
+
### [.NET Microservice](examples/dotnet-service/)
|
|
896
|
+
|
|
897
|
+
Microservice with distributed tracing and monitoring:
|
|
898
|
+
|
|
899
|
+
- **Stack**: .NET + PostgreSQL
|
|
900
|
+
- **Observability**: OpenTelemetry Collector + Jaeger + Prometheus
|
|
901
|
+
- **Use case**: Microservice development with full observability
|
|
902
|
+
|
|
903
|
+
```bash
|
|
904
|
+
cd examples/dotnet-service
|
|
905
|
+
npx container-superposition regen
|
|
906
|
+
code .
|
|
907
|
+
# Reopen in Container
|
|
908
|
+
```
|
|
909
|
+
|
|
910
|
+
Each example includes:
|
|
911
|
+
|
|
912
|
+
- ✅ `superposition.json` manifest for regeneration
|
|
913
|
+
- ✅ Complete documentation on services and usage
|
|
914
|
+
- ✅ Instructions for extending and customizing
|
|
915
|
+
|
|
916
|
+
**Want to create your own?** Generate a manifest with:
|
|
917
|
+
|
|
918
|
+
```bash
|
|
919
|
+
npx container-superposition init --stack compose --language nodejs --database postgres
|
|
920
|
+
```
|
|
921
|
+
|
|
441
922
|
### Preserving Project-Specific Customizations
|
|
442
923
|
|
|
443
924
|
**Problem**: When you regenerate a devcontainer (to add overlays or update), manual customizations are lost.
|
|
@@ -485,6 +966,86 @@ npm run init -- --from-manifest .devcontainer/superposition.json
|
|
|
485
966
|
|
|
486
967
|
See **[Custom Patches Guide](docs/custom-patches.md)** for complete documentation and examples.
|
|
487
968
|
|
|
969
|
+
### Team Collaboration Workflow
|
|
970
|
+
|
|
971
|
+
**Use Case:** Standardize dev environments across a team while allowing personal customizations.
|
|
972
|
+
|
|
973
|
+
Container Superposition supports a **manifest-first workflow** where:
|
|
974
|
+
|
|
975
|
+
- **Manifest** (`superposition.json`) is committed to version control
|
|
976
|
+
- **.devcontainer/** is generated locally and gitignored
|
|
977
|
+
- **Custom patches** (`.devcontainer/custom/`) can be committed for shared customizations
|
|
978
|
+
|
|
979
|
+
#### Quick Setup
|
|
980
|
+
|
|
981
|
+
**1. Team lead creates the manifest:**
|
|
982
|
+
|
|
983
|
+
```bash
|
|
984
|
+
# Generate manifest only (no .devcontainer/ files)
|
|
985
|
+
npx container-superposition init --write-manifest-only \
|
|
986
|
+
--stack compose \
|
|
987
|
+
--language nodejs \
|
|
988
|
+
--database postgres,redis
|
|
989
|
+
|
|
990
|
+
# Commit to repo
|
|
991
|
+
git add superposition.json .gitignore
|
|
992
|
+
git commit -m "Add team devcontainer manifest"
|
|
993
|
+
```
|
|
994
|
+
|
|
995
|
+
**2. Add to `.gitignore`:**
|
|
996
|
+
|
|
997
|
+
```gitignore
|
|
998
|
+
# DevContainer - generated locally
|
|
999
|
+
.devcontainer/
|
|
1000
|
+
|
|
1001
|
+
# Except custom directory (personal/shared customizations)
|
|
1002
|
+
!.devcontainer/custom/
|
|
1003
|
+
```
|
|
1004
|
+
|
|
1005
|
+
**3. Team members clone and generate:**
|
|
1006
|
+
|
|
1007
|
+
```bash
|
|
1008
|
+
git clone <repo>
|
|
1009
|
+
cd <repo>
|
|
1010
|
+
|
|
1011
|
+
# Generate .devcontainer/ from manifest
|
|
1012
|
+
npx container-superposition regen
|
|
1013
|
+
|
|
1014
|
+
# Open in VS Code and rebuild container
|
|
1015
|
+
code .
|
|
1016
|
+
```
|
|
1017
|
+
|
|
1018
|
+
**4. Personal customizations (optional):**
|
|
1019
|
+
|
|
1020
|
+
```bash
|
|
1021
|
+
# Add personal VS Code extensions, themes, etc.
|
|
1022
|
+
mkdir -p .devcontainer/custom
|
|
1023
|
+
cat > .devcontainer/custom/devcontainer.patch.json << 'EOF'
|
|
1024
|
+
{
|
|
1025
|
+
"customizations": {
|
|
1026
|
+
"vscode": {
|
|
1027
|
+
"extensions": ["eamodio.gitlens"],
|
|
1028
|
+
"settings": {
|
|
1029
|
+
"editor.fontSize": 14
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
EOF
|
|
1035
|
+
|
|
1036
|
+
# Regenerate to apply
|
|
1037
|
+
npx container-superposition regen
|
|
1038
|
+
```
|
|
1039
|
+
|
|
1040
|
+
**Benefits:**
|
|
1041
|
+
|
|
1042
|
+
- ✅ One command onboarding for new developers
|
|
1043
|
+
- ✅ No lock-in - generated files are plain JSON/YAML
|
|
1044
|
+
- ✅ Personal customizations don't conflict with team standard
|
|
1045
|
+
- ✅ CI can validate manifest without committing generated files
|
|
1046
|
+
|
|
1047
|
+
See **[Team Workflow Guide](docs/team-workflow.md)** for complete documentation, CI examples, and troubleshooting.
|
|
1048
|
+
|
|
488
1049
|
### Option 2: Manual Composition
|
|
489
1050
|
|
|
490
1051
|
1. **Copy a base template:**
|