Skip to main content

Setup Environment for Content Routing

Before building the content routing pipeline, you'll set up destination services and configure environment variables.

Prerequisites

This example requires the following services to be running:

Before you begin, please ensure these services are set up and running according to their respective guides. Additionally, ensure you have completed the Local Development Setup guide for general environment configuration.

Step 1: Configure Example-Specific Variables

After setting up the core services, configure content routing-specific variables:

# Alert destinations for severity routing (optional)
export PAGERDUTY_API_KEY="your_pagerduty_integration_key"
export SLACK_WEBHOOK_URL="https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK"

# Analytics and monitoring endpoints (optional)
export ANALYTICS_API_URL="https://analytics.example.com/events"
export SECURITY_MONITORING_URL="https://security.example.com/auth-events"

# Verification
echo "Kafka: $KAFKA_BROKERS"
echo "Slack: ${SLACK_WEBHOOK_URL:0:30}..."

Step 2: Verify Optional Services

If you plan to use the advanced routing features, verify connectivity to optional services:

Test PagerDuty Integration (Optional)

# Test PagerDuty integration
curl -X POST https://events.pagerduty.com/v2/enqueue \
-H "Content-Type: application/json" \
-H "Authorization: Token ${PAGERDUTY_API_KEY}" \
-d '{
"payload": {
"summary": "Test alert from content router setup",
"source": "content-routing-setup",
"severity": "info"
},
"routing_key": "test-routing-key",
"event_action": "trigger"
}'

Test Slack Integration (Optional)

# Test Slack webhook
curl -X POST $SLACK_WEBHOOK_URL \
-H "Content-Type: application/json" \
-d '{
"text": "Content routing setup test from '$(hostname)'",
"username": "content-router",
"icon_emoji": ":gear:"
}'

Test AWS S3 Access (Optional)

# Test S3 bucket access (if using geographic routing)
echo '{"test": "s3-access", "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"}' | \
aws s3 cp - s3://your-test-bucket/setup-test.json

# Verify upload
aws s3 ls s3://your-test-bucket/setup-test.json

# Clean up
aws s3 rm s3://your-test-bucket/setup-test.json

Next Steps

With your environment configured, you're ready to implement content routing techniques: