Repository navigation
Closed
Labels
priority: highHigh priority
Description
Problem Statement
DigitalOcean security scan detected that demo.tale.dev is exposing FalkorDB (Redis protocol) on port 6379 to the public internet. This is a critical security vulnerability that could allow unauthorized access to the knowledge graph data.
Additional exposed ports discovered during investigation:
- PostgreSQL: 5432
- RAG service: 8001
- Crawler: 8002
- Search: 8003
Root Cause
The deployment script (scripts/deploy.sh) depends on repository compose files (compose.yml, compose.blue.yml, compose.green.yml) which expose ports for development convenience. Docker modifies iptables directly, bypassing UFW rules.
Current State
compose.ymlexposes ports: 6379 (FalkorDB), 5432 (PostgreSQL), 8001-8003 (services)compose.blue.ymlandcompose.green.ymlare separate files for blue-green deployment- Development and production share the same configuration
- All inter-service communication happens via Docker internal network (working correctly)
Proposed Solution
Create a self-contained Bun CLI tool (tools/deploy/) that:
- Generates Docker Compose configs inline - No external file dependencies
- Only exposes ports 80/443 - All other ports internal only
- Compiles to single binary - Easy deployment to any server
- Replaces bash script entirely - Type-safe, maintainable TypeScript
Why Bun CLI instead of Bash refactoring?
- Type safety: Catch errors at compile time
- Maintainability: Easier to test and extend
- Portability: Single binary, no runtime dependencies on server
- Modern tooling: Better error handling, structured code
Affected Components
-
tools/deploy/- Create new Bun CLI tool -
scripts/deploy.sh- Delete (after CLI is working) -
compose.blue.yml- Delete -
compose.green.yml- Delete -
compose.yml- Keep (development only, add clarifying comment)
Acceptance Criteria
- Bun CLI generates compose config inline (no external file dependencies)
- Only ports 80 and 443 exposed in production
-
telnet demo.tale.dev 6379fails (FalkorDB not accessible) -
telnet demo.tale.dev 5432fails (PostgreSQL not accessible) - Blue-green deployment works correctly (
tale-deploy deploy v1.0.0) - Rollback functionality preserved (
tale-deploy rollback) - Status command shows deployment state (
tale-deploy status) - All services can communicate via Docker internal network
- Caddy routes traffic correctly to platform-blue/green
- Binary compiles for Linux x64 target
Security Impact
Before: 5 ports exposed to public internet
After: Only 2 ports (80, 443) exposed via Caddy proxy
🤖 Generated with Claude Code
Metadata
Metadata
Assignees
Labels
priority: highHigh priority
Activity
larryro commentedon Jan 27, 2026
Implementation Plan: Bun CLI Deployment Tool
Directory Structure
Key Technologies
commander(npm)yaml(npm)Bun.spawn()Bun.file(),Bun.write()bun build --compilepackage.json
{ "name": "@tale/deploy", "version": "1.0.0", "type": "module", "scripts": { "dev": "bun run src/index.ts", "build": "bun build --compile --outfile=dist/tale-deploy src/index.ts", "build:linux": "bun build --compile --target=bun-linux-x64 --outfile=dist/tale-deploy-linux src/index.ts" }, "dependencies": { "commander": "^12.0.0", "yaml": "^2.4.0" }, "devDependencies": { "@types/bun": "latest" } }Compose Generator (Security Critical)
CLI Commands
Files to Modify/Delete
tools/deploy/scripts/deploy.shcompose.blue.ymlcompose.green.ymlcompose.ymlBuild & Deploy Process
Testing Strategy
1. Security Verification
2. Functionality Check
3. Caddy Routing
curl -k https://demo.tale.dev/api/health # Should return 200 OKImplementation Order
tools/deploy/directory structuredocker/client.ts,utils/logger.ts,state/*compose/generator.tswith security-hardened configsstatus,deploy,rollback,cleanup,resetbun run devscripts/deploy.sh,compose.blue.yml,compose.green.ymlcompose.yml🤖 Generated with Claude Code
[-]Security: Make deploy.sh self-contained and remove exposed ports in production[/-][+]Security: Create self-contained Bun CLI deployment tool[/+]feat(deploy): add self-contained Bun CLI deployment tool
ci(deploy): add workflow to build and release CLI binary
docs(compose): add development-only warning
chore: remove deprecated deployment files
fix(deploy): fix compose YAML generation issues
feat(deploy): add self-contained Bun CLI deployment tool
ci(deploy): add workflow to build and release CLI binary
docs(compose): add development-only warning
chore: remove deprecated deployment files
fix(deploy): fix compose YAML generation issues
feat(deploy): add self-contained Bun CLI deployment tool
ci(deploy): add workflow to build and release CLI binary
docs(compose): add development-only warning
chore: remove deprecated deployment files
fix(deploy): fix compose YAML generation issues
feat(deploy): add self-contained Bun CLI deployment tool
ci(deploy): add workflow to build and release CLI binary
docs(compose): add development-only warning
chore: remove deprecated deployment files
fix(deploy): fix compose YAML generation issues