Infrastructure Planning

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

This will:

  1. Watch for changes in your code
  2. Automatically plan infrastructure updates
  3. Apply changes locally
  4. Provide immediate feedback

Remote Planning

For production deployments, use remote planning to preview changes:

Terminal
npx moose-cli plan --url https://your-production-instance
Authentication Required

Remote planning requires authentication. You can configure your moose server with the following steps:

  1. Generate a token using moose-cli auth generate
  2. Project config for the server check:
moose.yaml
[authentication]
admin_api_key = "your-hashed-token"
  1. 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:

  1. Run moose dev to start development mode
  2. Make changes to your data models or configuration
  3. Moose automatically plans and applies changes
  4. View changes in real-time through the CLI

2. Production Deployment Flow

For production deployments:

  1. Develop and test changes locally
  2. Run remote planning against production
  3. Review planned changes
  4. 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

  1. Authentication Errors
    • Verify your authentication token
    • Generate a new token using moose-cli auth generate