Quick Setup Guide - Monitoring Stack with Custom Domain
This guide will help you set up the monitoring stack on your DigitalOcean droplet with your custom domain.
Prerequisites
- ✅ DigitalOcean droplet with Ubuntu 22.04 LTS
- ✅ Domain managed by Cloudflare
- ✅ SSH access to your droplet
- ✅ Monitoring stack repository cloned on the droplet
Step 1: SSH to Your Droplet
ssh root@your_droplet_ip
Step 2: Navigate to Monitoring Stack Directory
cd /path/to/monitoring-stack
Step 3: Set Your Domain Variables
# Set your domain (replace with your actual domain)
export YOUR_DOMAIN=yourdomain.com
# Optional: Customize subdomains (defaults shown)
export GRAFANA_SUBDOMAIN=monitoring
export PROMETHEUS_SUBDOMAIN=prometheus
export ALERTMANAGER_SUBDOMAIN=alertmanager
Step 4: Run the Setup Script
./scripts/setup-custom-domain-tunnel.sh
This script will:
- Install Cloudflare tunnel (cloudflared)
- Create a tunnel for your domain
- Set up DNS records automatically
- Start the monitoring stack (Prometheus, Grafana, Alertmanager)
- Configure systemd service for automatic startup
Step 5: Access Your Monitoring Stack
After the script completes, your monitoring stack will be accessible at:
- Grafana Dashboard:
https://monitoring.yourdomain.com - Prometheus:
https://prometheus.yourdomain.com - Alertmanager:
https://alertmanager.yourdomain.com
Step 6: Initial Configuration
1. Change Grafana Password
- Go to
https://monitoring.yourdomain.com - Login with
admin/admin - Go to Settings → Users → Change Password
2. Update Service Configuration
Edit config/services.yaml to point to your actual services:
services:
etl_fastify:
host: "your-etl-server-ip" # Replace with actual IP
port: 3001
enabled: true
nestjs_monolith:
host: "your-nestjs-server-ip" # Replace with actual IP
port: 3000
enabled: true
3. Regenerate Prometheus Configuration
./scripts/generate-prometheus-config.sh
docker-compose restart prometheus
4. Configure Alerting (Optional)
Note: All alerting is now managed in Grafana. Prometheus no longer loads alert rules from etl-alerts.yml. Edit
grafana/provisioning/alerting/alertmanager.ymlto add your Slack webhook or email notifications.
Management Commands
# View all logs
docker-compose logs -f
# Restart the stack
docker-compose restart
# Stop the stack
docker-compose down
# Check tunnel status
cloudflared tunnel info sprout-monitoring
# View tunnel logs
journalctl -u cloudflared -f
Troubleshooting
Services Not Appearing
- Check if your services are running and accessible
- Verify the IP addresses in
config/services.yaml - Check firewall settings on your service servers
Tunnel Not Working
- Check tunnel status:
cloudflared tunnel info sprout-monitoring - View logs:
journalctl -u cloudflared -f - Verify DNS records in Cloudflare dashboard
Dashboard Not Loading
- Check if Grafana is running:
docker ps - View Grafana logs:
docker-compose logs grafana - Verify Prometheus data source in Grafana
Security Notes
- ✅ No ports need to be opened on your droplet
- ✅ All traffic is encrypted through Cloudflare tunnel
- ✅ SSL certificates are automatically managed
- ✅ Access is controlled through your domain
Next Steps
- Configure Dashboards: Import or create custom dashboards in Grafana
- Set Up Alerts: Configure alerting rules for your services
- Monitor Resources: Set up monitoring for your droplet's system resources
- Backup Configuration: Regularly backup your configuration files
Support
If you encounter issues:
- Check the logs:
docker-compose logs -f - Verify tunnel status:
cloudflared tunnel info sprout-monitoring - Test connectivity to your services
- Review the main README.md for detailed troubleshooting