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
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
# Team Collaboration Workflow
|
|
2
|
+
|
|
3
|
+
This guide explains how to use Container Superposition in a team setting, where you want to standardize development environments without locking developers into specific configurations.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The team collaboration workflow separates **team standards** (committed manifest) from **generated files** (local, gitignored) and **personal customizations** (optional, committed).
|
|
8
|
+
|
|
9
|
+
**Key Benefits:**
|
|
10
|
+
|
|
11
|
+
- ✅ **No lock-in** - Generated files are plain JSON/YAML, fully editable
|
|
12
|
+
- ✅ **One-command onboarding** - New developers run `npx container-superposition regen`
|
|
13
|
+
- ✅ **Personal customizations** - Developers can add their own preferences via `.devcontainer/custom/`
|
|
14
|
+
- ✅ **Version control friendly** - Only manifest is committed, not generated files
|
|
15
|
+
- ✅ **CI validation** - Validate manifest without committing generated files
|
|
16
|
+
|
|
17
|
+
## Repository Structure
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
my-project/
|
|
21
|
+
├── superposition.json # Committed - team-wide standard
|
|
22
|
+
├── .gitignore # Ignore .devcontainer/ (except custom/)
|
|
23
|
+
├── .devcontainer/ # Generated locally, in .gitignore
|
|
24
|
+
│ ├── devcontainer.json # Generated from manifest
|
|
25
|
+
│ ├── docker-compose.yml # Generated from manifest
|
|
26
|
+
│ ├── .env.example # Generated from manifest
|
|
27
|
+
│ ├── README.md # Generated from manifest
|
|
28
|
+
│ └── custom/ # Optional - committed personal customizations
|
|
29
|
+
│ ├── devcontainer.patch.json
|
|
30
|
+
│ └── docker-compose.patch.yml
|
|
31
|
+
└── src/ # Your application code
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Step-by-Step Setup
|
|
35
|
+
|
|
36
|
+
### 1. Create the Team Manifest
|
|
37
|
+
|
|
38
|
+
The team lead or maintainer creates the initial manifest:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Generate manifest only (no .devcontainer/ files)
|
|
42
|
+
npx container-superposition init --write-manifest-only \
|
|
43
|
+
--stack compose \
|
|
44
|
+
--language nodejs \
|
|
45
|
+
--database postgres,redis \
|
|
46
|
+
--observability prometheus,grafana
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
This creates `superposition.json` in the current directory:
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"manifestVersion": "1",
|
|
54
|
+
"generatedBy": "0.1.2",
|
|
55
|
+
"generated": "2026-02-17T14:00:00.000Z",
|
|
56
|
+
"baseTemplate": "compose",
|
|
57
|
+
"baseImage": "bookworm",
|
|
58
|
+
"overlays": ["nodejs", "postgres", "redis", "prometheus", "grafana"],
|
|
59
|
+
"portOffset": 0
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 2. Configure Git Ignore
|
|
64
|
+
|
|
65
|
+
Add the following to your `.gitignore`:
|
|
66
|
+
|
|
67
|
+
```gitignore
|
|
68
|
+
# DevContainer - generated locally from superposition.json
|
|
69
|
+
.devcontainer/
|
|
70
|
+
|
|
71
|
+
# Exception: Allow custom directory (personal customizations)
|
|
72
|
+
!.devcontainer/custom/
|
|
73
|
+
|
|
74
|
+
# Exception: Keep .gitignore itself
|
|
75
|
+
!.devcontainer/.gitignore
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Recommended:** Also create `.devcontainer/.gitignore` to prevent accidental commits:
|
|
79
|
+
|
|
80
|
+
```gitignore
|
|
81
|
+
# Ignore all generated files
|
|
82
|
+
*
|
|
83
|
+
|
|
84
|
+
# Except custom directory and this .gitignore
|
|
85
|
+
!custom/
|
|
86
|
+
!.gitignore
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 3. Commit the Manifest
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
git add superposition.json .gitignore
|
|
93
|
+
git commit -m "Add devcontainer manifest for standardized dev environment"
|
|
94
|
+
git push
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 4. Document for Team Members
|
|
98
|
+
|
|
99
|
+
Add to your `README.md`:
|
|
100
|
+
|
|
101
|
+
````markdown
|
|
102
|
+
## Development Setup
|
|
103
|
+
|
|
104
|
+
This project uses [Container Superposition](https://github.com/veggerby/container-superposition) for standardized development environments.
|
|
105
|
+
|
|
106
|
+
### Prerequisites
|
|
107
|
+
|
|
108
|
+
- Docker Desktop or Docker Engine
|
|
109
|
+
- VS Code with Dev Containers extension
|
|
110
|
+
|
|
111
|
+
### Setup
|
|
112
|
+
|
|
113
|
+
1. Clone the repository
|
|
114
|
+
2. Generate devcontainer from manifest:
|
|
115
|
+
\```bash
|
|
116
|
+
npx container-superposition regen
|
|
117
|
+
\```
|
|
118
|
+
3. Open in VS Code and rebuild container (Command Palette: "Dev Containers: Rebuild Container")
|
|
119
|
+
|
|
120
|
+
The devcontainer includes:
|
|
121
|
+
|
|
122
|
+
- Node.js with TypeScript
|
|
123
|
+
- PostgreSQL and Redis
|
|
124
|
+
- Prometheus and Grafana for observability
|
|
125
|
+
````
|
|
126
|
+
|
|
127
|
+
## Developer Onboarding
|
|
128
|
+
|
|
129
|
+
New team members follow these steps:
|
|
130
|
+
|
|
131
|
+
### 1. Clone Repository
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
git clone https://github.com/your-org/my-project.git
|
|
135
|
+
cd my-project
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### 2. Generate Devcontainer
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
npx container-superposition regen
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
This reads `superposition.json` and generates the `.devcontainer/` folder locally.
|
|
145
|
+
|
|
146
|
+
### 3. Open in Container
|
|
147
|
+
|
|
148
|
+
Open the project in VS Code:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
code .
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Then:
|
|
155
|
+
|
|
156
|
+
1. Command Palette (`Cmd/Ctrl+Shift+P`)
|
|
157
|
+
2. Select "Dev Containers: Rebuild and Reopen in Container"
|
|
158
|
+
3. Wait for container to build
|
|
159
|
+
4. Start developing!
|
|
160
|
+
|
|
161
|
+
## Personal Customizations
|
|
162
|
+
|
|
163
|
+
Developers can add their own customizations without affecting the team standard.
|
|
164
|
+
|
|
165
|
+
### Example: Add Personal VS Code Extensions
|
|
166
|
+
|
|
167
|
+
Create `.devcontainer/custom/devcontainer.patch.json`:
|
|
168
|
+
|
|
169
|
+
```json
|
|
170
|
+
{
|
|
171
|
+
"customizations": {
|
|
172
|
+
"vscode": {
|
|
173
|
+
"extensions": ["eamodio.gitlens", "usernamehw.errorlens", "pkief.material-icon-theme"],
|
|
174
|
+
"settings": {
|
|
175
|
+
"editor.fontSize": 14,
|
|
176
|
+
"workbench.colorTheme": "Monokai"
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Example: Add Personal Docker Compose Service
|
|
184
|
+
|
|
185
|
+
Create `.devcontainer/custom/docker-compose.patch.yml`:
|
|
186
|
+
|
|
187
|
+
```yaml
|
|
188
|
+
services:
|
|
189
|
+
my-debug-service:
|
|
190
|
+
image: redis-commander:latest
|
|
191
|
+
ports:
|
|
192
|
+
- '8081:8081'
|
|
193
|
+
networks:
|
|
194
|
+
- devnet
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Regenerate to Apply
|
|
198
|
+
|
|
199
|
+
After adding customizations:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
npx container-superposition regen
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
The custom patches are automatically merged with the team standard.
|
|
206
|
+
|
|
207
|
+
**Commit your customizations:**
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
git add .devcontainer/custom/
|
|
211
|
+
git commit -m "Add personal dev environment customizations"
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Updating the Team Standard
|
|
215
|
+
|
|
216
|
+
When the team needs to add or remove overlays:
|
|
217
|
+
|
|
218
|
+
### 1. Update the Manifest
|
|
219
|
+
|
|
220
|
+
You can either:
|
|
221
|
+
|
|
222
|
+
**Option A: Manually edit `superposition.json`**
|
|
223
|
+
|
|
224
|
+
```json
|
|
225
|
+
{
|
|
226
|
+
"overlays": [
|
|
227
|
+
"nodejs",
|
|
228
|
+
"postgres",
|
|
229
|
+
"redis",
|
|
230
|
+
"prometheus",
|
|
231
|
+
"grafana",
|
|
232
|
+
"jaeger" // Added
|
|
233
|
+
]
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
**Option B: Regenerate with new settings**
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
npx container-superposition init --write-manifest-only \
|
|
241
|
+
--stack compose \
|
|
242
|
+
--language nodejs \
|
|
243
|
+
--database postgres,redis \
|
|
244
|
+
--observability prometheus,grafana,jaeger
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### 2. Test Locally
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
npx container-superposition regen
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Verify the changes work as expected.
|
|
254
|
+
|
|
255
|
+
### 3. Commit and Push
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
git add superposition.json
|
|
259
|
+
git commit -m "Add Jaeger tracing to devcontainer"
|
|
260
|
+
git push
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### 4. Team Members Update
|
|
264
|
+
|
|
265
|
+
Team members pull the changes and regenerate:
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
git pull
|
|
269
|
+
npx container-superposition regen
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
Then rebuild their container in VS Code.
|
|
273
|
+
|
|
274
|
+
## CI/CD Integration
|
|
275
|
+
|
|
276
|
+
You can validate the manifest in CI without generating files.
|
|
277
|
+
|
|
278
|
+
### GitHub Actions Example
|
|
279
|
+
|
|
280
|
+
Create `.github/workflows/validate-devcontainer.yml`:
|
|
281
|
+
|
|
282
|
+
```yaml
|
|
283
|
+
name: Validate DevContainer
|
|
284
|
+
|
|
285
|
+
on:
|
|
286
|
+
pull_request:
|
|
287
|
+
paths:
|
|
288
|
+
- 'superposition.json'
|
|
289
|
+
- '.github/workflows/validate-devcontainer.yml'
|
|
290
|
+
|
|
291
|
+
jobs:
|
|
292
|
+
validate:
|
|
293
|
+
runs-on: ubuntu-latest
|
|
294
|
+
steps:
|
|
295
|
+
- uses: actions/checkout@v4
|
|
296
|
+
|
|
297
|
+
- name: Setup Node.js
|
|
298
|
+
uses: actions/setup-node@v4
|
|
299
|
+
with:
|
|
300
|
+
node-version: '20'
|
|
301
|
+
|
|
302
|
+
- name: Validate manifest with plan command
|
|
303
|
+
run: |
|
|
304
|
+
npx container-superposition plan --from-manifest superposition.json
|
|
305
|
+
|
|
306
|
+
- name: Generate and smoke test
|
|
307
|
+
run: |
|
|
308
|
+
npx container-superposition regen --no-interactive
|
|
309
|
+
# Verify key files exist
|
|
310
|
+
test -f .devcontainer/devcontainer.json
|
|
311
|
+
test -f .devcontainer/docker-compose.yml
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### GitLab CI Example
|
|
315
|
+
|
|
316
|
+
```yaml
|
|
317
|
+
validate-devcontainer:
|
|
318
|
+
image: node:20
|
|
319
|
+
stage: test
|
|
320
|
+
only:
|
|
321
|
+
changes:
|
|
322
|
+
- superposition.json
|
|
323
|
+
- .gitlab-ci.yml
|
|
324
|
+
script:
|
|
325
|
+
- npx container-superposition plan --from-manifest superposition.json
|
|
326
|
+
- npx container-superposition regen --no-interactive
|
|
327
|
+
- test -f .devcontainer/devcontainer.json
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
## Migration from Existing Setup
|
|
331
|
+
|
|
332
|
+
If you already have a `.devcontainer/` folder:
|
|
333
|
+
|
|
334
|
+
### 1. Generate Manifest from Existing Config
|
|
335
|
+
|
|
336
|
+
If you have a `superposition.json` in `.devcontainer/`, move it:
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
mv .devcontainer/superposition.json .
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
If you don't have a manifest, create one based on your current setup:
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
npx container-superposition init --write-manifest-only \
|
|
346
|
+
--stack compose \
|
|
347
|
+
--language nodejs \
|
|
348
|
+
--database postgres
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### 2. Backup Existing Config
|
|
352
|
+
|
|
353
|
+
```bash
|
|
354
|
+
mv .devcontainer .devcontainer.old
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### 3. Generate from Manifest
|
|
358
|
+
|
|
359
|
+
```bash
|
|
360
|
+
npx container-superposition regen
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
### 4. Compare and Migrate Customizations
|
|
364
|
+
|
|
365
|
+
Compare your old config with the new one:
|
|
366
|
+
|
|
367
|
+
```bash
|
|
368
|
+
diff -r .devcontainer.old .devcontainer
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
Move any custom configurations to `.devcontainer/custom/`:
|
|
372
|
+
|
|
373
|
+
```bash
|
|
374
|
+
mkdir -p .devcontainer/custom
|
|
375
|
+
# Move your custom patches
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
### 5. Update Git Ignore
|
|
379
|
+
|
|
380
|
+
Add `.devcontainer/` to `.gitignore` (except `custom/`).
|
|
381
|
+
|
|
382
|
+
### 6. Commit Manifest
|
|
383
|
+
|
|
384
|
+
```bash
|
|
385
|
+
git rm -r .devcontainer # Remove from version control
|
|
386
|
+
git add .gitignore superposition.json .devcontainer/custom/
|
|
387
|
+
git commit -m "Migrate to manifest-first workflow"
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
## Troubleshooting
|
|
391
|
+
|
|
392
|
+
### "No manifest found" Error
|
|
393
|
+
|
|
394
|
+
**Problem:** `npx container-superposition regen` says "No manifest found"
|
|
395
|
+
|
|
396
|
+
**Solution:** Ensure `superposition.json` exists in:
|
|
397
|
+
|
|
398
|
+
- Current directory (`./superposition.json`), or
|
|
399
|
+
- `.devcontainer/` directory (legacy location)
|
|
400
|
+
|
|
401
|
+
### Merge Conflicts in Generated Files
|
|
402
|
+
|
|
403
|
+
**Problem:** Developers have merge conflicts in `.devcontainer/devcontainer.json`
|
|
404
|
+
|
|
405
|
+
**Solution:** This shouldn't happen if `.devcontainer/` is gitignored. If it does:
|
|
406
|
+
|
|
407
|
+
1. Ensure `.devcontainer/` is in `.gitignore`
|
|
408
|
+
2. Remove from version control: `git rm -r --cached .devcontainer/`
|
|
409
|
+
3. Each developer runs: `npx container-superposition regen`
|
|
410
|
+
|
|
411
|
+
### Custom Patches Not Applied
|
|
412
|
+
|
|
413
|
+
**Problem:** Changes in `.devcontainer/custom/` aren't showing up
|
|
414
|
+
|
|
415
|
+
**Solution:**
|
|
416
|
+
|
|
417
|
+
1. Verify custom patches are valid JSON/YAML
|
|
418
|
+
2. Run `npx container-superposition regen` to regenerate
|
|
419
|
+
3. Check that custom directory is not in `.gitignore`
|
|
420
|
+
|
|
421
|
+
### Port Conflicts
|
|
422
|
+
|
|
423
|
+
**Problem:** Multiple team members running containers on same machine
|
|
424
|
+
|
|
425
|
+
**Solution:** Each developer can use a different port offset:
|
|
426
|
+
|
|
427
|
+
```bash
|
|
428
|
+
# Developer A (no offset)
|
|
429
|
+
npx container-superposition regen
|
|
430
|
+
|
|
431
|
+
# Developer B (offset +100)
|
|
432
|
+
npx container-superposition init --from-manifest superposition.json \
|
|
433
|
+
--port-offset 100 --output .devcontainer
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
Or create personal manifests with different offsets in `.devcontainer/custom/`.
|
|
437
|
+
|
|
438
|
+
## Best Practices
|
|
439
|
+
|
|
440
|
+
### 1. Document Requirements in README
|
|
441
|
+
|
|
442
|
+
Always document the prerequisites and setup steps in your project's README.
|
|
443
|
+
|
|
444
|
+
### 2. Keep Manifest Minimal
|
|
445
|
+
|
|
446
|
+
Only include overlays the team actually needs. Developers can add extras via custom patches.
|
|
447
|
+
|
|
448
|
+
### 3. Use Presets for Common Stacks
|
|
449
|
+
|
|
450
|
+
If your team uses a standard stack, use presets:
|
|
451
|
+
|
|
452
|
+
```bash
|
|
453
|
+
npx container-superposition init --write-manifest-only --preset web-api
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
### 4. Version Control Custom Directory
|
|
457
|
+
|
|
458
|
+
Commit `.devcontainer/custom/` to let developers share useful customizations:
|
|
459
|
+
|
|
460
|
+
```bash
|
|
461
|
+
git add .devcontainer/custom/
|
|
462
|
+
git commit -m "Share useful debug extensions"
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
### 5. Regular Updates
|
|
466
|
+
|
|
467
|
+
Periodically update overlays to get security patches and new features:
|
|
468
|
+
|
|
469
|
+
```bash
|
|
470
|
+
# Update tool
|
|
471
|
+
npm update container-superposition
|
|
472
|
+
|
|
473
|
+
# Regenerate
|
|
474
|
+
npx container-superposition regen
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
### 6. Test Before Committing
|
|
478
|
+
|
|
479
|
+
Always test manifest changes locally before committing:
|
|
480
|
+
|
|
481
|
+
```bash
|
|
482
|
+
# Make changes to superposition.json
|
|
483
|
+
npx container-superposition regen
|
|
484
|
+
# Test in container
|
|
485
|
+
# If good, commit
|
|
486
|
+
git add superposition.json
|
|
487
|
+
git commit -m "Update devcontainer manifest"
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
## Advanced: Monorepo Setup
|
|
491
|
+
|
|
492
|
+
For monorepos with multiple services:
|
|
493
|
+
|
|
494
|
+
```
|
|
495
|
+
monorepo/
|
|
496
|
+
├── superposition.json # Shared base manifest
|
|
497
|
+
├── service-a/
|
|
498
|
+
│ ├── superposition.json # Service-specific manifest (extends base)
|
|
499
|
+
│ └── .devcontainer/ # Generated locally
|
|
500
|
+
├── service-b/
|
|
501
|
+
│ ├── superposition.json
|
|
502
|
+
│ └── .devcontainer/
|
|
503
|
+
└── .gitignore # Ignore all .devcontainer/ folders
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
Each service can have its own manifest that extends the base:
|
|
507
|
+
|
|
508
|
+
**service-a/superposition.json:**
|
|
509
|
+
|
|
510
|
+
```json
|
|
511
|
+
{
|
|
512
|
+
"baseTemplate": "compose",
|
|
513
|
+
"baseImage": "bookworm",
|
|
514
|
+
"overlays": ["nodejs", "postgres"]
|
|
515
|
+
}
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
**service-b/superposition.json:**
|
|
519
|
+
|
|
520
|
+
```json
|
|
521
|
+
{
|
|
522
|
+
"baseTemplate": "compose",
|
|
523
|
+
"baseImage": "bookworm",
|
|
524
|
+
"overlays": ["python", "redis", "rabbitmq"]
|
|
525
|
+
}
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
Developers work on specific services:
|
|
529
|
+
|
|
530
|
+
```bash
|
|
531
|
+
cd service-a
|
|
532
|
+
npx container-superposition regen
|
|
533
|
+
code .
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
## See Also
|
|
537
|
+
|
|
538
|
+
- [Quick Reference](quick-reference.md) - Common commands and flags
|
|
539
|
+
- [Overlay Documentation](overlays.md) - Available overlays
|
|
540
|
+
- [Custom Patches](../tool/README.md#custom-patches) - Custom patch format
|