feat: Multi-instance development stack with full isolation#265
feat: Multi-instance development stack with full isolation#265betterclever merged 13 commits intomainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dfcfd0ac24
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -1,5 +1,6 @@ | |||
| import { Injectable, Logger, OnModuleDestroy, OnModuleInit } from '@nestjs/common'; | |||
| import { Consumer, Kafka } from 'kafkajs'; | |||
| import { getTopicResolver } from '@shipsec/backend-client'; | |||
There was a problem hiding this comment.
Add backend-client dependency for new imports
The new @shipsec/backend-client import is not declared in backend/package.json (and similarly in worker/package.json for the worker usage). In this workspace, missing declared dependencies typically cause module resolution failures during bun install/tsc/runtime (Cannot find module '@shipsec/backend-client'), so backend/worker startup will break in environments that enforce package boundaries. Add @shipsec/backend-client to each package’s dependencies (or switch to an already-declared package) to keep builds reproducible.
Useful? React with 👍 / 👎.
b22bd40 to
eca0b04
Compare
Add support for running multiple independent dev instances simultaneously with isolated Docker containers and PM2 processes. Key features: - Support instances 0-9 with clean syntax: just dev, just dev 1, just dev 2 stop - Dynamic port offsets: instance N uses base_port + N*100 - Instance-specific Docker Compose project names (shipsec-dev-N) - Instance-specific PM2 app naming and configuration - Auto-generate docker-compose overrides for port mappings - Support for 'just dev stop all' to shut everything down - Each instance gets isolated .instances/instance-X directories with copied env files - Temporal namespaces/task queues isolated per instance Files added: - scripts/dev-instance-manager.sh: Utility script for instance initialization and configuration Files modified: - justfile: Refactored 'dev' command to support multi-instance syntax and operations - pm2.config.cjs: Added instance-specific app naming, ports, and env file resolution Examples: just dev # Start instance 0 just dev 1 start # Start instance 1 just dev 2 logs # View logs for instance 2 just dev 1 stop # Stop instance 1 just dev status all # Check status of all instances just dev stop all # Stop all instances Signed-off-by: betterclever <paliwal.pranjal83@gmail.com> Amp-Thread-ID: https://ampcode.com/threads/T-019c2a4b-7659-7551-9e17-b36c1669f387 Co-authored-by: Amp <amp@ampcode.com>
Comprehensive documentation for the new multi-instance dev stack feature including: - Quick start examples - Architecture and port allocation table - Directory structure explanation - Complete command reference - Implementation details - Best practices and troubleshooting - Technical architecture overview - Environment variables reference Signed-off-by: betterclever <paliwal.pranjal83@gmail.com> Amp-Thread-ID: https://ampcode.com/threads/T-019c2a4b-7659-7551-9e17-b36c1669f387 Co-authored-by: Amp <amp@ampcode.com>
- Dynamic port offsets (base_port + instance*100) - Docker Compose project isolation per instance - PM2 process isolation with instance-specific naming - Database isolation (shipsec_instance_N) - Temporal namespace isolation (shipsec-dev-N) - Kafka topic isolation via KafkaTopicResolver - Workspace dependencies for backend-client package Signed-off-by: betterclever <paliwal.pranjal83@gmail.com> Amp-Thread-ID: https://ampcode.com/threads/T-019c2a82-8732-76ac-8726-58b1e5ab340b Co-authored-by: Amp <amp@ampcode.com>
- Move KafkaTopicResolver to backend/src/common and worker/src/common - Regenerate OpenAPI client from backend spec - Update imports in backend services to use local resolver - Remove unnecessary exports from backend-client package Signed-off-by: betterclever <paliwal.pranjal83@gmail.com> Amp-Thread-ID: https://ampcode.com/threads/T-019c2a82-8732-76ac-8726-58b1e5ab340b Co-authored-by: Amp <amp@ampcode.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
- Configured Redpanda with separate internal and external listeners to fix host connectivity (port 19092) - Updated dev configurations (PM2, env, justfile) to use external Kafka port 19092 - Improved 'just dev all clean' to support bulk cleanup of all instances - Refactored instance cleanup scripts to reduce duplication - Fixed CORS origin policy to dynamically support multiple instance ports - Updated E2E test script for cleaner termination and parallel isolation Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
e86a166 to
331714f
Compare
Multi-instance development environment supporting 10 concurrent isolated instances (0-9).
Key Features
Usage
```bash
just dev 1 start # Start instance 1
just dev 1 stop # Stop instance 1
just dev all stop # Stop all instances
just dev 1 clean # Reset instance 1 state
just dev 1 logs # View instance 1 logs
just dev all clean # Nuclear cleanup of all instances
```
Recent Improvements
Closes #265