This document describes the deployment of MiroShark as a Railway Staging Service for Bazodiac Pattern Analysis.
Dockerfile (Dockerfile)
- Currently installs both Node.js and Python dependencies
- Copies frontend and backend source code
- Exposes ports 3000 (frontend) and 5001 (backend)
- Starts both frontend and backend via npm run dev (development mode)
- Uses Python 3.11 base image with uv for Python dependency management
Railway Configuration (railway.json)
- Uses Dockerfile builder
- Points to root Dockerfile
- Has restart policy ON_FAILURE with 5 retries
- Missing: Healthcheck path configuration
Backend Runtime (backend/run.py)
- Uses FLASK_PORT environment variable with default 5001
- Does NOT prefer Railway's injected PORT environment variable
- Host defaults to 0.0.0.0
- No Railway-specific port handling
Flask Application (backend/app/__init__.py)
- Health check endpoint: GET /health (returns JSON with status)
- CORS enabled for /api/* routes
- Multiple API blueprints registered:
- /api/graph - graph operations
- /api/simulation - simulation lifecycle
- /api/report - report generation
- /api/templates - template management
- /api/settings - settings management
- /api/observability - observability endpoints
- /api/mcp - MCP integration
- /api/countries - demographic data
- /api/docs - OpenAPI documentation
- /api/feed - syndication feeds
- /share - public share pages
- /watch - spectator watch pages
- /sitemap - SEO sitemap
- /api/notifications - notification config
- Missing: Internal API authentication guard
Environment Variables (.env.example)
- Comprehensive LLM/Embedding provider configuration
- Neo4j connection settings
- Admin authentication for mutation endpoints
- Multiple notification channels (webhook, Discord, Slack, email, Telegram)
- Missing: Railway-specific internal API key variable
PORT environment variableBazodiac Pattern Prototype
-> Next.js Scenario Orchestrator
-> MIROSHARK_API_BASE_URL
-> MiroShark Railway API Service
-> Neo4j
-> LLM Provider
-> Embedding Provider
backend/run.py to prefer Railway PORTDockerfile.railway for backend-only deploymentrailway.json with healthcheck pathbefore_request authentication middleware/api/* routes with x-miroshark-internal-key header/health endpoint publicRAILWAY_VARIABLES.md with required variables checklist.env.example with Railway-specific placeholders/health endpointMIROSHARK_API_BASE_URL/health returns HTTP 200 locally and on Railwayx-miroshark-internal-key return 401/health endpoint for monitoringTwo scripts are provided for smoke testing:
scripts/smoke_test.py)SMOKE_TEST_URL and MIROSHARK_INTERNAL_KEY environment variablesUsage:
bash
export SMOKE_TEST_URL=https://your-service.railway.app
export MIROSHARK_INTERNAL_KEY=your-key
python scripts/smoke_test.py
Synthetic Seed Script (scripts/synthetic_seed.py)
bash
python scripts/synthetic_seed.py # Create test data
python scripts/synthetic_seed.py cleanup # Clean up test databackend/run.py port changesDockerfile.railway if createdbackend/app/__init__.pyrailway.json changes$ claude mcp add MiroShark \
-- python -m otcore.mcp_server <graph>