Consolidate Dockerfiles for singular deployment

This commit is contained in:
khalid@traclabs.com
2026-04-23 00:32:32 -05:00
parent 80459e8336
commit 5229ccdb0f
4 changed files with 97 additions and 66 deletions

View File

@@ -12,33 +12,35 @@ An LLM-powered website editing framework. Edit your site via SMS, a web API, or
│ │ │
▼ ▼ ▼
┌─────────────────────────────────────────────────┐
Orchestrator (Express, port 3001)
Single Container (entrypoint.sh)
│ │
Webhook ──► Idempotency ──► Rate Limit ──►
┌──────────────────────────────────────┐
│ │ In-Process FIFO Queue (concurrency 1)
│ │
│ │ propose: route ► LLM ► proposal │
│ │ apply: validate ► writeContentFile│
└──────────────────────────────────────┘
SQLite: idempotency, proposals, rate limits,
audit log
└───────────────────────┬─────────────────────────┘
writes canonical JSON
┌──────────────────┐
content/ (JSON) │ ◄── shared volume
site-context.json
└────────┬─────────┘
│ reads with TTL cache
┌──────────────────┐
│ Astro SSR
│ (port 4321)
Homepage + Editor
└──────────────────┘
┌────────────────────────────────────────────┐
│ Orchestrator (Express, port 3001)
│ │
│ │ Webhook ──► Idempotency ──► Rate Limit
│ │
│ │ ┌──────────────────────────────────────┐ │
│ │ │ In-Process FIFO Queue (concurrency 1) │
propose: route ► LLM ► proposal │ │
apply: validate ► writeContentFile│
│ └──────────────────────────────────────┘
│ │ SQLite: idempotency, proposals, rate │ │
│ │ limits, audit log
└──────────────────┬─────────────────────────┘
│ writes canonical JSON │
▼ │
┌──────────────────┐
content/ (JSON) │ shared filesystem │
site-context.json│ │
└────────┬─────────┘
│ reads with TTL cache │
│ ┌────────────────────────────────────────────┐
│ Astro SSR (port 4321)
Homepage + Editor │ │
│ └────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────┘
```
## Quick Start
@@ -73,7 +75,7 @@ Copy `.env.example` to `.env` and set at minimum:
- `VONAGE_API_KEY` — your Vonage API key (from Dashboard)
- `VONAGE_API_SECRET` — your Vonage API secret (from Dashboard)
- `VONAGE_APPLICATION_ID` — your Vonage application ID
- `VONAGE_PRIVATE_KEY_PATH` — path to the `private.key` file generated when creating the Vonage application
- `VONAGE_PRIVATE_KEY_PATH` — path to the `private.key` file on disk, or set `VONAGE_PRIVATE_KEY` to the base64-encoded PEM content
- `VONAGE_API_SIGNATURE_SECRET` — webhook signature secret (from Dashboard → API Settings)
See `.env.example` for all options.
@@ -81,10 +83,10 @@ See `.env.example` for all options.
### Vonage Setup
1. Create a Vonage application in the Dashboard with Messages capability enabled.
2. Set the inbound message webhook URL to `https://smsapi.kadil.dev/webhooks/inbound` (POST).
3. Set the status webhook URL to `https://smsapi.kadil.dev/webhooks/status` (POST).
2. Set the inbound message webhook URL to `https://dynamicsites.kadil.dev/webhooks/inbound` (POST).
3. Set the status webhook URL to `https://dynamicsites.kadil.dev/webhooks/status` (POST).
4. Under API Settings, ensure Messages API is set as the default for SMS.
5. Copy the generated `private.key` to the project root.
5. Copy the generated `private.key` to the project root (or base64-encode it for `VONAGE_PRIVATE_KEY`).
6. Note your signature secret from Dashboard → API Settings for webhook verification.
### Docker
@@ -92,10 +94,12 @@ See `.env.example` for all options.
```bash
docker compose build
docker compose up -d
# Site: http://localhost:4321
# Site: http://localhost:4321
# Orchestrator: http://localhost:3001/health
```
Both the Astro SSR site and the orchestrator run in a single container, sharing the same `content/` directory. The entrypoint script starts both processes and seeds content from the image into the volume on first deploy.
## Project Structure
```
@@ -135,9 +139,9 @@ docker compose up -d
│ ├── sections/ # Astro section components
│ └── editor/ # React editor island
├── scripts/ # CLI tools
├── docker-compose.yml # Full stack (web + orchestrator)
├── Dockerfile # SSR site image
└── server/Dockerfile # Orchestrator image
├── Dockerfile # Combined image (Astro SSR + orchestrator)
├── docker-compose.yml # Full stack (single service)
└── entrypoint.sh # Starts both processes + seeds content
```
## Edit Flow
@@ -151,6 +155,7 @@ docker compose up -d
## Key Design Decisions
- **Single container**: Both Astro SSR and the orchestrator run in one container, sharing the filesystem for content reads and writes
- **No Redis, no BullMQ**: Simple in-process FIFO queue with concurrency 1
- **No git**: Content persistence is filesystem-only
- **SQLite for everything**: Idempotency, proposals, rate limits, audit log