- Add comprehensive database migrations (001-024) for schema evolution - Enhance API schema with expanded type definitions and resolvers - Add new middleware: audit logging, rate limiting, MFA enforcement, security, tenant auth - Implement new services: AI optimization, billing, blockchain, compliance, marketplace - Add adapter layer for cloud integrations (Cloudflare, Kubernetes, Proxmox, storage) - Update Crossplane provider with enhanced VM management capabilities - Add comprehensive test suite for API endpoints and services - Update frontend components with improved GraphQL subscriptions and real-time updates - Enhance security configurations and headers (CSP, CORS, etc.) - Update documentation and configuration files - Add new CI/CD workflows and validation scripts - Implement design system improvements and UI enhancements
Cloudflare Tunnel Configuration Guide
Overview
This guide covers configuring the Cloudflare Tunnel VM for SMOM-DBIS-138 deployment to provide secure public access.
Prerequisites
- Cloudflare Tunnel VM deployed and running
- SSH access to the VM
- Cloudflare account with Zero Trust enabled
- Domain configured in Cloudflare
Quick Start
1. Get VM IP Address
kubectl get proxmoxvm cloudflare-tunnel-vm -n default -o jsonpath='{.status.ipAddress}'
2. Create Tunnel in Cloudflare
Option A: Via Cloudflare Dashboard
- Go to Zero Trust → Networks → Tunnels
- Click "Create a tunnel"
- Select "Cloudflared"
- Name it:
smom-dbis-138-tunnel - Copy the tunnel token
Option B: Via API
./scripts/configure-cloudflare.sh
3. SSH into the VM
ssh admin@<vm-ip-address>
4. Configure Tunnel Credentials
# Create credentials file
sudo mkdir -p /etc/cloudflared
sudo nano /etc/cloudflared/tunnel-credentials.json
Paste the tunnel credentials JSON:
{
"AccountTag": "your-account-tag",
"TunnelSecret": "your-tunnel-secret",
"TunnelID": "your-tunnel-id",
"TunnelName": "smom-dbis-138-tunnel"
}
5. Configure Tunnel
# Copy configuration template
sudo cp /path/to/tunnel-config.yaml /etc/cloudflared/config.yaml
# Edit configuration
sudo nano /etc/cloudflared/config.yaml
6. Start Tunnel Service
# Start service
sudo systemctl start cloudflared
# Enable auto-start
sudo systemctl enable cloudflared
# Check status
sudo systemctl status cloudflared
Configuration Details
Tunnel Credentials
Location: /etc/cloudflared/tunnel-credentials.json
Contains:
- AccountTag: Your Cloudflare account ID
- TunnelSecret: Secret key for the tunnel
- TunnelID: Unique tunnel identifier
- TunnelName: Human-readable tunnel name
Tunnel Configuration
Location: /etc/cloudflared/config.yaml
Key sections:
tunnel: Tunnel name (must match credentials)credentials-file: Path to credentials JSONingress: Routing rules for servicesmetrics: Prometheus metrics endpointhealth-probe: Health check configuration
Ingress Rules
Pattern
ingress:
- hostname: service.example.com
service: http://backend-service:port
originRequest:
connectTimeout: 30s
tcpKeepAlive: 30s
Important Notes
- Rules are evaluated in order (first match wins)
- Catch-all rule (
http_status:404) must be last - Use internal hostnames or IPs for backend services
DNS Configuration
For each hostname in ingress rules, create a CNAME record:
Type: CNAME
Name: smom-api
Content: <tunnel-id>.cfargotunnel.com
Proxy: Enabled (orange cloud)
Or use Cloudflare API:
curl -X POST "https://api.cloudflare.com/client/v4/zones/{zone_id}/dns_records" \
-H "Authorization: Bearer {api_token}" \
-H "Content-Type: application/json" \
--data '{
"type": "CNAME",
"name": "smom-api",
"content": "<tunnel-id>.cfargotunnel.com",
"proxied": true
}'
Monitoring
Check Tunnel Status
sudo systemctl status cloudflared
View Logs
sudo tail -f /var/log/cloudflared/tunnel.log
Metrics Endpoint
curl http://localhost:9090/metrics
Troubleshooting
Tunnel Not Connecting
- Verify credentials file is correct
- Check tunnel is created in Cloudflare dashboard
- Verify DNS records point to tunnel
- Check firewall allows outbound HTTPS (443)
Service Not Accessible
- Verify ingress rule matches hostname
- Check backend service is running
- Verify internal network connectivity
- Check tunnel logs for errors
Test Connection
# Test from Cloudflare Tunnel VM
curl http://backend-service:port
# Test from external
curl https://your-domain.com
Security Best Practices
- Rotate Tunnel Secrets: Regularly rotate tunnel credentials
- Use Access Policies: Configure Cloudflare Access for authentication
- Monitor Logs: Review tunnel logs for suspicious activity
- Limit Ingress Rules: Only expose necessary services
- Use Private Networks: Keep backend services on private networks
Next Steps
- Configure Cloudflare Access policies
- Set up monitoring and alerting
- Configure rate limiting
- Set up backup tunnel for redundancy