-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2197 from benipeled/packer
Add cloud-image build scripts
- Loading branch information
Showing
32 changed files
with
2,889 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,4 @@ docs/.Python | |
docs/poetry.lock | ||
grafana/build/ | ||
CURRENT_VERSION.sh | ||
|
||
packer-manifest.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Scylla Monitor Image | ||
|
||
## Requirements | ||
- Packer >= v1.10.0 | ||
- Packer AWS and GCP plugins | ||
|
||
To install the required plugins, run the following: | ||
|
||
```shell | ||
packer plugins install github.com/hashicorp/googlecompute | ||
packer plugins install github.com/hashicorp/amazon | ||
``` | ||
|
||
## Build | ||
To build the Scylla Monitor Image, make sure you have [Authentication](#authentication) set up, and run the following command from the `siren-devops/cluster/monitor` directory: | ||
|
||
```shell | ||
packer build -var monitor_version="4.6.1" scylla-monitor-template.json | ||
``` | ||
You can build a specific cloud only by using the `-only` flag. for example: | ||
```shell | ||
# AWS only | ||
packer build -only=amazon-ebs -var monitor_version="4.6.1" scylla-monitor-template.json | ||
|
||
# GCP only | ||
packer build -only=googlecompute -var monitor_version="4.6.1" scylla-monitor-template.json | ||
``` | ||
## Variables | ||
|
||
|
||
The Scylla Monitor Image uses default variables that are declared in the packer template file, for example `aws_source_ami`, `gcp_project_id` etc. | ||
You can override these default variables by creating a `variables.json` with the desired variable values, for example: | ||
|
||
```json | ||
{ | ||
"monitor_version": "4.6.1", | ||
"aws_subnet_id": "your_aws_subnet_id", | ||
"gcp_project_id": "your_gcp_project_id", | ||
"gcp_zone": "your_gcp_zone" | ||
} | ||
``` | ||
And when running the packer build command, include the `-var-file` option to specify the `variables.json` file: | ||
|
||
```shell | ||
packer build -var-file=variables.json scylla-monitor-template.json | ||
``` | ||
|
||
|
||
## Authentication | ||
|
||
### AWS | ||
Ensure `aws_access_key_id` and `aws_secret_access_key` are configured either in a local credentials file (ex. `~/.aws/credentials`) or as environment variables. | ||
|
||
#### GCP | ||
Set your GCP service account key as an environment variable: | ||
```shell | ||
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/service-account-file.json" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
UA_ANALTYICS=UA-43975320-4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/bash | ||
print_usage() { | ||
echo "add_centos_user.sh [--os centos/ubuntu] [--copy]" | ||
exit 1 | ||
} | ||
OS="centos" | ||
COPY="" | ||
while [ $# -gt 0 ]; do | ||
case "$1" in | ||
"--os") | ||
OS="$2" | ||
shift 2 | ||
;; | ||
"--copy") | ||
COPY="1" | ||
shift 1 | ||
;; | ||
*) | ||
print_usage | ||
;; | ||
esac | ||
done | ||
|
||
if [ "$OS" = "ubuntu" ]; then | ||
sudo useradd -m -s $(which bash) -G sudo -G docker centos | ||
echo "centos ALL=(ALL) NOPASSWD:ALL" |sudo tee -a /etc/sudoers.d/100-cloud-cntos-user > /dev/null | ||
if [ "$COPY" = "1" ]; then | ||
sudo cp -r /home/ubuntu/scylla-grafana-monitoring-scylla-monitoring /home/centos/ | ||
fi | ||
sudo chown -R centos:centos /home/centos | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
BASE=`dirname "$(readlink -f "$0")"` | ||
echo "clearing $BASE/scylla-grafana-monitoring-scylla-monitoring/grafana/build/*/$1.*.json" | ||
for FILE in $BASE/scylla-grafana-monitoring-scylla-monitoring/grafana/build/ver_*/$1.*.json; do | ||
rm -f "$FILE" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
{ | ||
"dashboard": { | ||
"class": "dashboard", | ||
"uid": "dbaas", | ||
"originalTitle": "Scylla Cloud Solution", | ||
"rows": [ | ||
{ | ||
"collapse": false, | ||
"editable": true, | ||
"height": "200px", | ||
"panels": [ | ||
{ | ||
"class": "text_panel", | ||
"content": "<img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAkYAAAB2CAYAAAAtOFzoAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAD6VJREFUeNrs3Y1V20oWwHGRkwLcwSoVxKkgooJHKoioAKggpgKTCuxUYKcCOxXAqwC/CvBWwOqGcY4fi0HSvZov/3/n6JDzdjHyaEZz57soAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA5E6O5Ys+Pj6Omx+jgwlxcrImO/RO27L5Ub7yf7lr0ndLSgEACIzCVNRV80Ouz831akD0AgmQ7prrb/l3U6FvyCb/Ci7l+uh+dk3bu2dpe0eqAgAIjIaptM+aH38111nHyrpNZf6zuebHGCTtpasEmqXxx0t6LpvrR0xB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7cQ7Tfp/VxGsPGZQCip+0pWUbS+NLOcdIenKupT7YDB5feevTexZrLXYX4wUMU2iZK/ZTzSij33XbBaOiXw9bdx6cUtkIAEJbREv0fMXwX15OvbaR+C/gVhurQmPvcSPldzBne9WjIXJjTAAGSVMrSY3Ea687W1tH+XjAqPUi+hzN3AZEcrzJh6AxAS9ol+hsXkMRCG6SV7qy4IHV2Yb+45/d5mT6/x/sUcr3rOVjvHUYqk+zKgSpnKSDfj/XYib3u0Lkbt5e0PiuG23VU0lm6SJdHFgytqc9ezAspiKFXdc3z/OOjMj1+RpZu8v79rPyMcRFotEUW97g9law2fPQ+xzTZwyj3Jtt9dj/7TjiTAiXLDNcM3bya3uVeeo8VmX7zLM03pC4AZFVfSH28MgiOzkNMYznJ7EHs9kIav1Ex/76olE2CU0nvsni9R0lajlsCTwA4quBI5jv1GeqUuvkLB4YDAIDcAqSqueTw7zYemmsScMuB3054bAAAYOAAqSye5qvKdIzngY/0DP2KbBI8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAR+p8AAwBZhVVEP80/TAAAAABJRU5ErkJggg==\" height=\"70\">\n<span style=\"font-size:40px\"> DBAAS Overview</span><hr style=\"border-top: 3px solid #5780c1;\">", | ||
"gridPos": { | ||
"x": 0, | ||
"y": 0, | ||
"w": 24, | ||
"h": 4 | ||
} | ||
} | ||
], | ||
"title": "New row" | ||
}, | ||
{ | ||
"class": "row", | ||
"height": "150px", | ||
"panels": [ | ||
{ | ||
"class": "single_stat_panel", | ||
"targets": [ | ||
{ | ||
"expr": "count(up{job=\"monitoring\"})", | ||
"intervalFactor": 1, | ||
"legendFormat": "Total number of Clusters", | ||
"refId": "A", | ||
"step": 40 | ||
} | ||
], | ||
"title": "Clusters" | ||
}, | ||
{ | ||
"class": "single_stat_panel_fail", | ||
"targets": [ | ||
{ | ||
"expr": "count(scrape_samples_scraped{job=\"monitoring\"}==0) OR vector(0)", | ||
"intervalFactor": 1, | ||
"legendFormat": "Unreachable Prometheus Servers", | ||
"refId": "A", | ||
"step": 20 | ||
} | ||
], | ||
"thresholds": "1,2", | ||
"title": "Prometheus" | ||
}, | ||
{ | ||
"class": "single_stat_panel_fail", | ||
"targets": [ | ||
{ | ||
"expr": "count(scrape_samples_scraped{job=\"alarms\"}==0) OR vector(0)", | ||
"intervalFactor": 1, | ||
"legendFormat": "Unreachable Alarm manager", | ||
"refId": "A", | ||
"step": 20 | ||
} | ||
], | ||
"thresholds": "1,2", | ||
"title": "Alarm-Manager" | ||
}, | ||
{ | ||
"class": "single_stat_panel_fail", | ||
"targets": [ | ||
{ | ||
"expr": "count(scrape_samples_scraped{job=\"node_exporter\"}==0) OR vector(0)", | ||
"intervalFactor": 1, | ||
"legendFormat": "Unreachable Node Exporter", | ||
"refId": "A", | ||
"step": 20 | ||
} | ||
], | ||
"thresholds": "1,2", | ||
"title": "node-exporter" | ||
}, | ||
{ | ||
"class": "text_panel", | ||
"content": "## ", | ||
"mode": "markdown", | ||
"span": 1, | ||
"style": {} | ||
}, | ||
{ | ||
"class": "alert_table", | ||
"span": 6, | ||
"title": "Active Alerts" | ||
} | ||
], | ||
"title": "Statistic Row" | ||
}, | ||
{ | ||
"class": "row", | ||
"panels": [ | ||
{ | ||
"class": "percent_panel", | ||
"span": 3, | ||
"targets": [ | ||
{ | ||
"expr": "100*(sum(node_filesystem_size{cluster=~\"$cluster|$^\", mountpoint=~\"$mount_point\"}) by (cluster,instance, mountpoint)-sum(node_filesystem_avail{cluster=~\"$cluster|$^\", mountpoint=~\"$mount_point\"}) by (cluster,instance, mountpoint))/sum(node_filesystem_size{cluster=~\"$cluster|$^\", mountpoint=~\"$mount_point\"}) by (cluster,instance, mountpoint)", | ||
"intervalFactor": 1, | ||
"legendFormat": "", | ||
"metric": "", | ||
"refId": "A", | ||
"step": 1 | ||
} | ||
], | ||
"title": "Disk Size" | ||
}, | ||
{ | ||
"class": "percent_panel", | ||
"span": 3, | ||
"targets": [ | ||
{ | ||
"expr": "sum(rate(node_cpu_seconds_total{cluster=~\"$cluster|$^\", mode=\"idle\"}[30s])) by (cluster,instance)", | ||
"intervalFactor": 1, | ||
"legendFormat": "", | ||
"metric": "", | ||
"refId": "A", | ||
"step": 1 | ||
} | ||
], | ||
"title": "CPU Load" | ||
}, | ||
{ | ||
"class": "percent_panel", | ||
"span": 3, | ||
"targets": [ | ||
{ | ||
"expr": "100*(sum(node_memory_MemTotal_bytes{cluster=~\"$cluster|$^\"}) by (cluster,instance) - sum(node_memory_MemFree_bytes{cluster=~\"$cluster|$^\"}) by (cluster,instance))/sum(node_memory_MemTotal_bytes{cluster=~\"$cluster|$^\"}) by (cluster,instance)", | ||
"intervalFactor": 1, | ||
"legendFormat": "", | ||
"metric": "", | ||
"refId": "A", | ||
"step": 1 | ||
} | ||
], | ||
"title": "Memory Usage" | ||
}, | ||
{ | ||
"class": "bytes_panel", | ||
"span": 3, | ||
"targets": [ | ||
{ | ||
"expr": "sum(rate(node_network_transmit_bytes{cluster=~\"$cluster|$^\", device!~\"lo\"}[30s])) by (cluster,instance)", | ||
"intervalFactor": 1, | ||
"legendFormat": "", | ||
"metric": "", | ||
"refId": "A", | ||
"step": 1 | ||
} | ||
], | ||
"title": "Data transfer" | ||
} | ||
|
||
] | ||
} | ||
], | ||
"templating": { | ||
"list": [ | ||
{ | ||
"class": "template_variable_all", | ||
"label": "cluster", | ||
"name": "cluster", | ||
"query": "label_values(node_filesystem_avail, cluster)" | ||
}, | ||
{ | ||
"class": "template_variable_all", | ||
"label": "mountpoint", | ||
"name": "mount_point", | ||
"query": "label_values(node_filesystem_avail,mountpoint)", | ||
"sort": 3 | ||
} | ||
] | ||
}, | ||
"tags": [ | ||
"dbaas" | ||
], | ||
"time": { | ||
"from": "now-30m", | ||
"to": "now" | ||
}, | ||
"title": "DBaS monitoring", | ||
"version": 3 | ||
} | ||
} |
Oops, something went wrong.