generated from coulomb/repo-seed
feat(WP-0004): railiance deployment & service ops
- Dockerfile (multi-stage, uv-based, slim runtime) - .dockerignore - docker-compose.railiance.yml (Temporal + NATS + PG, no Elasticsearch) - GET /health endpoint (db + temporal probes, 200/503) - .env.example (complete env var reference) - Makefile: migrate, sync-all, dev-up/down, railiance-up/down, start-worker, start-api, start-event-router, help targets; extracted sync-event-types Python to scripts/sync_event_types.py - SIGTERM graceful shutdown in worker.py and event_router.py - docs/runbook.md: Railiance deployment section Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
68
Makefile
68
Makefile
@@ -1,24 +1,54 @@
|
||||
.PHONY: sync-event-types sync-activity-definitions test
|
||||
-include .env
|
||||
export
|
||||
|
||||
sync-activity-definitions:
|
||||
.PHONY: sync-event-types sync-activity-definitions test migrate sync-all \
|
||||
dev-up dev-down railiance-up railiance-down \
|
||||
start-worker start-api start-event-router help
|
||||
|
||||
sync-activity-definitions: ## Sync ActivityDefinition files into DB
|
||||
uv run python -m activity_core.sync_activity_definitions
|
||||
|
||||
sync-event-types:
|
||||
uv run python -c "
|
||||
import asyncio, os
|
||||
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
|
||||
from activity_core.event_type_registry import sync_event_types
|
||||
sync-event-types: ## Sync event type YAML files into DB
|
||||
uv run python scripts/sync_event_types.py
|
||||
|
||||
async def main():
|
||||
db_url = os.environ.get('ACTCORE_DB_URL', 'postgresql+asyncpg://actcore:actcore@localhost:5433/actcore')
|
||||
engine = create_async_engine(db_url)
|
||||
factory = async_sessionmaker(engine, expire_on_commit=False)
|
||||
n = await sync_event_types(factory)
|
||||
print(f'Synced {n} event types')
|
||||
await engine.dispose()
|
||||
|
||||
asyncio.run(main())
|
||||
"
|
||||
|
||||
test:
|
||||
test: ## Run test suite
|
||||
uv run pytest tests/ -v
|
||||
|
||||
# ── Database ──────────────────────────────────────────────────────────────────
|
||||
|
||||
migrate: ## Apply all pending Alembic migrations
|
||||
uv run alembic upgrade head
|
||||
|
||||
sync-all: sync-event-types sync-activity-definitions ## Sync event types and activity definitions
|
||||
|
||||
# ── Infrastructure ─────────────────────────────────────────────────────────────
|
||||
|
||||
dev-up: ## Start full dev stack (Temporal + PG + ES + NATS)
|
||||
docker compose -f docker-compose.dev.yml up -d
|
||||
|
||||
dev-down: ## Stop and remove dev stack containers
|
||||
docker compose -f docker-compose.dev.yml down
|
||||
|
||||
railiance-up: ## Build image and start full railiance stack (no Elasticsearch)
|
||||
docker compose -f docker-compose.railiance.yml up -d --build
|
||||
|
||||
railiance-down: ## Stop and remove railiance stack containers
|
||||
docker compose -f docker-compose.railiance.yml down
|
||||
|
||||
# ── Local dev processes ───────────────────────────────────────────────────────
|
||||
|
||||
start-worker: ## Start Temporal worker (reads env from .env if present)
|
||||
uv run python -m activity_core.worker
|
||||
|
||||
start-api: ## Start FastAPI server on :8010 with hot reload
|
||||
uv run uvicorn activity_core.api:app --host 0.0.0.0 --port 8010 --reload
|
||||
|
||||
start-event-router: ## Start NATS event router
|
||||
uv run python -m activity_core.event_router
|
||||
|
||||
# ── Help ──────────────────────────────────────────────────────────────────────
|
||||
|
||||
help: ## Show this help message
|
||||
@grep -E '^[a-zA-Z_-]+:.*?##' $(MAKEFILE_LIST) | \
|
||||
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-24s\033[0m %s\n", $$1, $$2}' | \
|
||||
sort
|
||||
|
||||
Reference in New Issue
Block a user