Infrastructure Planning
Viewing typescript
switch to python
Infrastructure planning in Moose works similarly to version control systems like Git, but for your infrastructure. It helps you manage and track changes to your data infrastructure with confidence.
Overview
Moose’s planning functionality:
- Compares current infrastructure state with desired state
- Generates detailed plans for infrastructure changes
- Validates changes before applying them
- Provides development and production workflows
Infrastructure Components
Moose tracks changes across:
- OLAP Database Tables
- Streaming Engine Topics
- API Endpoints
- Background Processes
Using Planning
Development Mode
Development mode automatically plans and applies changes as you work:
Terminal
npx moose-cli dev
Terminal
moose-cli dev
This will:
- Watch for changes in your code
- Automatically plan infrastructure updates
- Apply changes locally
- Provide immediate feedback
Remote Planning
For production deployments, use remote planning to preview changes:
Terminal
npx moose-cli plan --url https://your-production-instance
Terminal
moose-cli plan --url https://your-production-instance
Authentication Required
Remote planning requires authentication. You can configure your moose server with the following steps:
- Generate a token using
moose-cli auth generate
- Project config for the server check:
moose.yaml
[authentication]
admin_api_key = "your-hashed-token"
- Supply the token when running
moose-cli plan
:--token your-auth-token
Understanding Plan Output
When you run a plan, Moose shows you what will change:
Infrastructure Changes:
✨ New Components
+ analytics_table (OLAP Table)
+ metrics_topic (Streaming Topic)
+ api/v2/metrics (API Endpoint)
🔄 Modified Components
~ users_table (Schema Update)
~ events_topic (Config Change)
❌ Removed Components
- deprecated_process (Background Process)
Planning Workflow
1. Development Flow
During local development:
- Run
moose dev
to start development mode - Make changes to your data models or configuration
- Moose automatically plans and applies changes
- View changes in real-time through the CLI
2. Production Deployment Flow
For production deployments:
- Develop and test changes locally
- Run remote planning against production
- Review planned changes
- Apply changes using your deployment process
Best Practices
Development
- Use
moose dev
for local development - Monitor plan outputs for warnings
Production
- Always use remote planning before deployments
- Review changes carefully in production plans
- Maintain proper authentication (as a default the admin endpoint will be returning 401 Unauthorized if the token is not configured)
Troubleshooting
- Authentication Errors
- Verify your authentication token
- Generate a new token using
moose-cli auth generate