Skip to content

Commit a26a3ca

Browse files
authored
Merge pull request #53 from redis-field-engineering/FIELDENG-737-grafana-v-2-kickstarter-terraform
Fieldeng 737 grafana v 2 kickstarter terraform
2 parents 1c48947 + d6d9ec7 commit a26a3ca

File tree

9 files changed

+573
-12
lines changed

9 files changed

+573
-12
lines changed

grafana_v2/dashboards/grafana_v9-11/cloud/basic/redis-cloud-active-active-dashboard_v9-11.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@
10641064
"list": [
10651065
{
10661066
"current": {},
1067-
"definition": "label_values(redis_up,cluster)",
1067+
"definition": "label_values(redis_server_up,cluster)",
10681068
"description": "The name of the deployed cluster",
10691069
"hide": 0,
10701070
"includeAll": false,
@@ -1073,7 +1073,7 @@
10731073
"name": "cluster",
10741074
"options": [],
10751075
"query": {
1076-
"query": "label_values(redis_up,cluster)",
1076+
"query": "label_values(redis_server_up,cluster)",
10771077
"refId": "PrometheusVariableQueryEditor-VariableQuery"
10781078
},
10791079
"refresh": 1,

grafana_v2/dashboards/grafana_v9-11/software/basic/redis-software-active-active-dashboard_v9-11.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@
10641064
"list": [
10651065
{
10661066
"current": {},
1067-
"definition": "label_values(redis_up,cluster)",
1067+
"definition": "label_values(redis_server_up,cluster)",
10681068
"description": "The name of the deployed cluster",
10691069
"hide": 0,
10701070
"includeAll": false,
@@ -1073,7 +1073,7 @@
10731073
"name": "cluster",
10741074
"options": [],
10751075
"query": {
1076-
"query": "label_values(redis_up,cluster)",
1076+
"query": "label_values(redis_server_up,cluster)",
10771077
"refId": "PrometheusVariableQueryEditor-VariableQuery"
10781078
},
10791079
"refresh": 1,

grafana_v2/dashboards/grafana_v9-11/software/basic/redis-software-cluster-dashboard_v9-11.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
"uid": "${DS_PROMETHEUS}"
136136
},
137137
"editorMode": "builder",
138-
"expr": "count(redis_up{cluster=\"$cluster\"})",
138+
"expr": "count(redis_server_up{cluster=\"$cluster\"})",
139139
"legendFormat": "count",
140140
"range": true,
141141
"refId": "A"
@@ -893,4 +893,4 @@
893893
"uid": "UjCh-Ya4K",
894894
"version": 1,
895895
"weekStart": ""
896-
}
896+
}

grafana_v2/dashboards/grafana_v9-11/software/basic/redis-software-shard-dashboard_v9-11.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6076,15 +6076,15 @@
60766076
"type": "prometheus",
60776077
"uid": "${DS_PROMETHEUS}"
60786078
},
6079-
"definition": "label_values(redis_up{cluster=\"$cluster\", db=\"$db\"}, redis)",
6079+
"definition": "label_values(redis_server_up{cluster=\"$cluster\", db=\"$db\"}, redis)",
60806080
"hide": 0,
60816081
"includeAll": false,
60826082
"label": "shard",
60836083
"multi": false,
60846084
"name": "shard",
60856085
"options": [],
60866086
"query": {
6087-
"query": "label_values(redis_up{cluster=\"$cluster\", db=\"$db\"}, redis)",
6087+
"query": "label_values(redis_server_up{cluster=\"$cluster\", db=\"$db\"}, redis)",
60886088
"refId": "StandardVariableQuery"
60896089
},
60906090
"refresh": 1,
@@ -6204,4 +6204,4 @@
62046204
"uid": "OLAsUMAVz",
62056205
"version": 1,
62066206
"weekStart": ""
6207-
}
6207+
}

grafana_v2/dashboards/kickstart/shard.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6026,14 +6026,14 @@
60266026
"type": "prometheus",
60276027
"name": "prometheus-demo"
60286028
},
6029-
"definition": "label_values(redis_up{bdb=\"$bdb\", cluster=\"$cluster\", redis=\"$shard\"}, status)",
6029+
"definition": "label_values(redis_server_up{db=\"$db\", cluster=\"$cluster\", redis=\"$shard\"}, status)",
60306030
"hide": 2,
60316031
"includeAll": false,
60326032
"multi": false,
60336033
"name": "status",
60346034
"options": [],
60356035
"query": {
6036-
"query": "label_values(redis_up{bdb=\"$bdb\", cluster=\"$cluster\", redis=\"$shard\"}, status)",
6036+
"query": "label_values(redis_server_up{db=\"$db\", cluster=\"$cluster\", redis=\"$shard\"}, status)",
60376037
"refId": "StandardVariableQuery"
60386038
},
60396039
"refresh": 1,

grafana_v2/kickstart_v2/docker-compose.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
services:
22
prometheus:
33
image: prom/prometheus:latest
4+
command:
5+
- '--config.file=/etc/prometheus/prometheus.yml'
6+
- '--storage.tsdb.path=/prometheus'
7+
- '--web.console.libraries=/etc/prometheus/console_libraries'
8+
- '--web.console.templates=/etc/prometheus/consoles'
9+
- '--storage.tsdb.retention.time=7d'
10+
- '--storage.tsdb.retention.size=10GB'
11+
- '--web.enable-lifecycle'
412
links:
513
- alertmanager
614
volumes:
@@ -26,7 +34,7 @@ services:
2634
image: prom/alertmanager:latest
2735
container_name: alertmanager
2836
ports:
29-
- 9093:9093
37+
- 9093:9093
3038
networks:
3139
kickstart:
3240
ipv4_address: "172.27.2.4"
Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
# Redis Cloud Grafana Kickstarter for GCP
2+
3+
The Redis Cloud Grafana Kickstarter automates the deployment of a complete observability stack for your Redis Cloud Pro databases on Google Cloud Platform. This Terraform configuration creates the necessary infrastructure and sets up a monitoring solution with custom domain and SSL encryption, perfect for getting started with Redis monitoring, demos, and development environments.
4+
5+
## What This Kickstarter Does
6+
7+
- **Network Infrastructure**: Creates a new VPC and subnet in GCP (or uses existing ones if provided)
8+
- **VPC Peering**: Establishes secure peering between your GCP VPC and Redis Cloud Pro subscription (If you bring your own VCP it's assumed it's already peered)
9+
- **Monitoring Stack**: Deploys a VM with Prometheus and Grafana pre-configured for Redis monitoring
10+
- **Dashboard Integration**: Automatically installs Redis Cloud dashboards from this repository
11+
- **SSL & Domain Setup**: Configures nginx reverse proxy with Let's Encrypt SSL certificates
12+
- **DNS Management**: Creates DNS records for secure HTTPS access to your Grafana instance
13+
14+
## Prerequisites
15+
16+
Before running this kickstarter, ensure you have:
17+
18+
### Redis Cloud Requirements
19+
- Redis Cloud Pro subscription with at least one database
20+
- Redis Cloud API credentials (API Key and Secret Key)
21+
- Subscription ID and database name
22+
23+
### GCP Requirements
24+
- GCP project with billing enabled
25+
- Terraform installed locally
26+
- GCP credentials configured (via `gcloud auth application-default login`)
27+
- A managed DNS zone in Cloud DNS
28+
- SSH key pair for VM access
29+
30+
### Required GCP APIs
31+
Enable the following APIs in your GCP project:
32+
- Compute Engine API
33+
- Cloud DNS API
34+
- Cloud Resource Manager API
35+
36+
## Configuration
37+
38+
### 1. Create Variables File
39+
40+
Create a `terraform.tfvars` file in this directory with your configuration:
41+
42+
```hcl
43+
# Redis Cloud Configuration
44+
redis_cloud_api_key = "your-redis-cloud-api-key"
45+
redis_cloud_account_key = "your-redis-cloud-account-key"
46+
subscription_id = "12345"
47+
db_name = "your-database-name"
48+
49+
# GCP Configuration
50+
gcp_project = "your-gcp-project-id"
51+
gcloud_region = "us-central1"
52+
gcloud_zone = "us-central1-a"
53+
gcloud_username = "your-username"
54+
55+
# SSH Configuration
56+
ssh_key_file = "path/to/your/private-key"
57+
58+
# DNS Configuration
59+
dns-zone-name = "your-dns-zone-name"
60+
zone_dns_name = "yourdomain.com"
61+
subdomain = "grafana"
62+
63+
# Optional: Use Existing Infrastructure
64+
# existing_vpc_id = "projects/your-project/global/networks/existing-vpc"
65+
# existing_subnet_id = "projects/your-project/regions/us-central1/subnetworks/existing-subnet"
66+
# existing_vpc_name = "existing-vpc"
67+
```
68+
69+
### 2. Infrastructure Options
70+
71+
The kickstarter supports two deployment modes:
72+
73+
#### Option A: Create New Infrastructure (Default)
74+
Leave the `existing_*` variables commented out. The kickstarter will create:
75+
- New VPC (`redispeer-test-vpc`)
76+
- New subnet (`redispeer-test-subnet`)
77+
- Firewall rules for SSH, HTTP, HTTPS, and Grafana access
78+
79+
#### Option B: Use Existing Infrastructure
80+
Uncomment and configure the `existing_*` variables to use your existing VPC and subnet.
81+
82+
## Deployment Steps
83+
84+
### 1. Initialize Terraform
85+
```bash
86+
terraform init
87+
```
88+
89+
### 2. Review the Plan
90+
```bash
91+
terraform plan
92+
```
93+
94+
### 3. Deploy the Infrastructure
95+
```bash
96+
terraform apply
97+
```
98+
99+
The deployment process will:
100+
1. Create or configure network infrastructure
101+
2. Set up VPC peering with Redis Cloud
102+
3. Launch and configure the monitoring VM
103+
4. Install Docker, Python, and monitoring tools
104+
5. Deploy Prometheus and Grafana with Redis dashboards
105+
6. Configure nginx with SSL certificates
106+
7. Set up DNS records
107+
108+
**Note**: The complete deployment takes approximately 10-15 minutes.
109+
110+
### 4. Access Your Grafana Instance
111+
112+
Once deployment completes, access your Grafana instance at:
113+
```
114+
https://your-subdomain.yourdomain.com
115+
```
116+
117+
Default Grafana credentials:
118+
- **Username**: `admin`
119+
- **Password**: `admin` (you'll be prompted to change this on first login)
120+
121+
## What You Get
122+
123+
After successful deployment, you'll have:
124+
125+
- **Secure Access**: HTTPS-enabled Grafana instance with Let's Encrypt SSL certificates
126+
- **Pre-configured Dashboards**: Redis Cloud monitoring dashboards automatically imported
127+
- **Prometheus Integration**: Metrics collection from your Redis Cloud databases
128+
- **Custom Domain**: Professional URL for your monitoring solution
129+
- **Auto-renewal**: SSL certificates automatically renewed via cron job
130+
131+
## Available Dashboards
132+
133+
The kickstarter installs the following Redis Cloud dashboards:
134+
- **Active-Active Dashboard**: Multi-region database monitoring
135+
- **Database Dashboard**: Core database metrics and performance
136+
- **Proxy Dashboard**: Redis Cloud proxy performance metrics
137+
- **Cluster Dashboard**: Overall cluster health and status
138+
139+
## Production Considerations
140+
141+
This kickstarter is designed to get you up and running quickly with Redis monitoring. For production workloads requiring high availability, data persistence, and enterprise-grade reliability, consider these alternatives:
142+
143+
- **Grafana Cloud**: Fully managed Grafana service with built-in high availability
144+
- **Managed Prometheus**: Cloud provider managed Prometheus services (GCP Managed Service for Prometheus, AWS Managed Prometheus)
145+
- **Kubernetes Deployment**: Deploy Prometheus and Grafana using Helm charts with persistent storage, clustering, and backup strategies
146+
- **Enterprise Solutions**: Redis Insight, Datadog, New Relic, or other enterprise monitoring platforms
147+
148+
The kickstarter provides an excellent foundation for understanding your Redis metrics and can serve as a reference for building more robust monitoring infrastructure.
149+
150+
## Troubleshooting
151+
152+
### Common Issues
153+
154+
**DNS Propagation**: If SSL certificate generation fails, wait 5-10 minutes for DNS propagation and re-run `terraform apply`.
155+
156+
**SSH Connection Issues**: Ensure your SSH key has appropriate permissions (`chmod 600 path/to/private-key`).
157+
158+
**API Rate Limits**: If you encounter Redis Cloud API rate limits, wait a few minutes and retry.
159+
160+
### Accessing Logs
161+
162+
SSH into the VM to check service status:
163+
```bash
164+
# Connect to VM
165+
ssh -i path/to/private-key username@vm-external-ip
166+
167+
# Check Grafana status
168+
sudo docker ps
169+
170+
# View Grafana logs
171+
sudo docker logs grafana
172+
173+
# Check nginx status
174+
sudo systemctl status nginx
175+
```
176+
177+
## Cleanup
178+
179+
To remove all created resources:
180+
```bash
181+
terraform destroy
182+
```
183+
184+
**Warning**: This will permanently delete all infrastructure created by this kickstarter.
185+
186+
## Support
187+
188+
For issues and questions:
189+
- Review the [main repository documentation](../../../../README.adoc)
190+
- Check [Redis Cloud documentation](https://docs.redis.com/latest/rc/)
191+
- Open an issue in the repository
192+
193+
---
194+
195+
*This kickstarter is part of the Redis Enterprise Observability toolkit. For more monitoring solutions and dashboards, explore the complete repository.*

0 commit comments

Comments
 (0)