Add prototype deployment workflow
This commit is contained in:
parent
5195f9c052
commit
9e2fdb9643
11
README.md
11
README.md
@ -31,6 +31,17 @@ pnpm typecheck
|
|||||||
pnpm --filter @lysnrai/platform-service dev
|
pnpm --filter @lysnrai/platform-service dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Prototype Deployment
|
||||||
|
|
||||||
|
For a single-host prototype, use Docker Compose with the repo root [`docker-compose.yml`](/root/bytelyst.ai/repos/learning_ai_common_plat/docker-compose.yml).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp .env.example .env
|
||||||
|
./scripts/prototype-up.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
See [docs/PROTOTYPE_DEPLOYMENT.md](docs/PROTOTYPE_DEPLOYMENT.md) for the required environment variables and day-to-day commands.
|
||||||
|
|
||||||
## Current Capability Surface
|
## Current Capability Surface
|
||||||
|
|
||||||
- **Shared packages** — 36 `@bytelyst/*` packages covering auth, config, API clients, storage, sync, telemetry, diagnostics, design tokens, SDK support, and testing.
|
- **Shared packages** — 36 `@bytelyst/*` packages covering auth, config, API clients, storage, sync, telemetry, diagnostics, design tokens, SDK support, and testing.
|
||||||
|
|||||||
64
docs/PROTOTYPE_DEPLOYMENT.md
Normal file
64
docs/PROTOTYPE_DEPLOYMENT.md
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
# Prototype Deployment
|
||||||
|
|
||||||
|
This repo is currently set up to run as a single-host prototype with Docker Compose.
|
||||||
|
|
||||||
|
## What This Includes
|
||||||
|
|
||||||
|
- `platform-service`
|
||||||
|
- `extraction-service`
|
||||||
|
- `mcp-server`
|
||||||
|
- `gateway` (Traefik)
|
||||||
|
- `loki`
|
||||||
|
- `grafana`
|
||||||
|
|
||||||
|
## What Stays External
|
||||||
|
|
||||||
|
- Azure Cosmos DB
|
||||||
|
- Azure Key Vault if you choose to use it
|
||||||
|
- Any real API credentials such as Stripe or Gemini
|
||||||
|
|
||||||
|
For the prototype phase, keep secrets in `.env` and keep state in managed external services rather than adding more local containers.
|
||||||
|
|
||||||
|
## First-Time Setup
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp .env.example .env
|
||||||
|
```
|
||||||
|
|
||||||
|
Fill in at least:
|
||||||
|
|
||||||
|
- `COSMOS_ENDPOINT`
|
||||||
|
- `COSMOS_KEY`
|
||||||
|
- `JWT_SECRET`
|
||||||
|
|
||||||
|
If you want extraction features that call Gemini, also set:
|
||||||
|
|
||||||
|
- `GEMINI_API_KEY`
|
||||||
|
|
||||||
|
## Start The Stack
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./scripts/prototype-up.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
That script will:
|
||||||
|
|
||||||
|
1. Validate the required environment variables.
|
||||||
|
2. Build the shared packages needed by the Docker images.
|
||||||
|
3. Build and start the Compose stack.
|
||||||
|
|
||||||
|
## Day-To-Day Commands
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose ps
|
||||||
|
docker compose logs -f platform-service
|
||||||
|
docker compose logs -f extraction-service
|
||||||
|
docker compose logs -f mcp-server
|
||||||
|
docker compose down
|
||||||
|
```
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
- This is intended for early prototype use on a single machine.
|
||||||
|
- Do not commit `.env`.
|
||||||
|
- When the project moves to a more secure environment later, keep the same service boundaries and move secrets out of `.env` into a proper secret manager.
|
||||||
52
scripts/check-prototype-env.sh
Executable file
52
scripts/check-prototype-env.sh
Executable file
@ -0,0 +1,52 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||||
|
ENV_FILE="${1:-$REPO_ROOT/.env}"
|
||||||
|
|
||||||
|
if [[ ! -f "$ENV_FILE" ]]; then
|
||||||
|
echo "Missing env file: $ENV_FILE"
|
||||||
|
echo "Copy .env.example to .env and fill in the required values."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
required_vars=(
|
||||||
|
COSMOS_ENDPOINT
|
||||||
|
COSMOS_KEY
|
||||||
|
JWT_SECRET
|
||||||
|
)
|
||||||
|
|
||||||
|
optional_vars=(
|
||||||
|
GEMINI_API_KEY
|
||||||
|
)
|
||||||
|
|
||||||
|
missing_required=()
|
||||||
|
missing_optional=()
|
||||||
|
|
||||||
|
for var_name in "${required_vars[@]}"; do
|
||||||
|
value="$(grep -E "^${var_name}=" "$ENV_FILE" | tail -n 1 | cut -d= -f2- || true)"
|
||||||
|
if [[ -z "${value// }" ]] || [[ "$value" == your-* ]]; then
|
||||||
|
missing_required+=("$var_name")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for var_name in "${optional_vars[@]}"; do
|
||||||
|
value="$(grep -E "^${var_name}=" "$ENV_FILE" | tail -n 1 | cut -d= -f2- || true)"
|
||||||
|
if [[ -z "${value// }" ]] || [[ "$value" == your-* ]]; then
|
||||||
|
missing_optional+=("$var_name")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if ((${#missing_required[@]} > 0)); then
|
||||||
|
echo "Missing required environment variables in $ENV_FILE:"
|
||||||
|
printf ' - %s\n' "${missing_required[@]}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Required environment variables look present in $ENV_FILE."
|
||||||
|
|
||||||
|
if ((${#missing_optional[@]} > 0)); then
|
||||||
|
echo "Optional variables not set:"
|
||||||
|
printf ' - %s\n' "${missing_optional[@]}"
|
||||||
|
echo "Extraction features that call Gemini may not work until these are configured."
|
||||||
|
fi
|
||||||
25
scripts/prototype-up.sh
Executable file
25
scripts/prototype-up.sh
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||||
|
cd "$REPO_ROOT"
|
||||||
|
|
||||||
|
if [[ ! -f .env ]]; then
|
||||||
|
echo "Missing .env in $REPO_ROOT"
|
||||||
|
echo "Run: cp .env.example .env"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
"$REPO_ROOT/scripts/check-prototype-env.sh" "$REPO_ROOT/.env"
|
||||||
|
"$REPO_ROOT/scripts/docker-prep.sh"
|
||||||
|
|
||||||
|
echo "Starting prototype stack with Docker Compose..."
|
||||||
|
docker compose up -d --build
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Prototype stack started."
|
||||||
|
echo "Useful commands:"
|
||||||
|
echo " docker compose ps"
|
||||||
|
echo " docker compose logs -f platform-service"
|
||||||
|
echo " docker compose logs -f extraction-service"
|
||||||
|
echo " docker compose logs -f mcp-server"
|
||||||
Loading…
Reference in New Issue
Block a user