Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
f0d8cf0
wip
mrnicegyu11 Sep 19, 2024
e906b41
Merge remote-tracking branch 'upstream/main' into main
mrnicegyu11 Oct 23, 2024
14c751d
Merge remote-tracking branch 'upstream/main' into main
mrnicegyu11 Oct 23, 2024
293f63c
Add csi-s3 and have portainer use it
mrnicegyu11 Oct 24, 2024
f7f72ec
Change request @hrytsuk 1GB max portainer volume size
mrnicegyu11 Oct 25, 2024
94cfb76
t push
mrnicegyu11 Oct 28, 2024
509c717
Merge remote-tracking branch 'upstream/main'
mrnicegyu11 Oct 29, 2024
1a65ecf
Merge remote-tracking branch 'upstream/main'
mrnicegyu11 Nov 13, 2024
77ee45e
Merge remote-tracking branch 'upstream/main'
mrnicegyu11 Nov 25, 2024
c9c70d6
Arch Linux Certificates Customization
mrnicegyu11 Dec 3, 2024
7b8be53
Merge remote-tracking branch 'upstream/main'
mrnicegyu11 Dec 5, 2024
bcd61cd
Merge remote-tracking branch 'upstream/main'
mrnicegyu11 Dec 12, 2024
58e1030
Merge remote-tracking branch 'upstream/main'
mrnicegyu11 Dec 13, 2024
5b1c3fb
Add grafana terrform tooling
mrnicegyu11 Dec 16, 2024
00bc0c7
Make osparc-config dotenv-precommit pass: Use all caps env-vars
mrnicegyu11 Dec 16, 2024
2e009bc
Refactoring: jinja2 takes .env file path as explicit argument (like i…
mrnicegyu11 Dec 16, 2024
8903007
Make CI_ENV_FILE vailable in makefile
mrnicegyu11 Dec 16, 2024
f520e7c
Refactor makefile targets
mrnicegyu11 Dec 16, 2024
764bb22
Add grafana terraform gitignore
mrnicegyu11 Dec 16, 2024
ead277a
Rename envvar: TF_STATE_S3_GRAFANAKEY
mrnicegyu11 Dec 16, 2024
13f92ba
Remove old scripts, makefile targets
mrnicegyu11 Dec 18, 2024
ebe66c0
Remove unused files
mrnicegyu11 Dec 18, 2024
fcab094
undue arch style commit
mrnicegyu11 Dec 18, 2024
2ba8070
Remove references to Tempo
mrnicegyu11 Dec 18, 2024
015cef0
Merge remote-tracking branch 'upstream/main' into 2024/add/grafanaTer…
mrnicegyu11 Jan 3, 2025
ebb9c2c
CHange request YH: Stop trying tor ecah grafana eventually
mrnicegyu11 Jan 3, 2025
a929e35
Change request YH: Move tf scripts to terraform folder
mrnicegyu11 Jan 3, 2025
989eaa3
Change request YH: stricter check
mrnicegyu11 Jan 3, 2025
75c79fe
Add files remove typo
mrnicegyu11 Jan 3, 2025
dc76837
Merge branch 'main' into 2024/add/grafanaTerraform
mrnicegyu11 Jan 6, 2025
bb59907
Add terraform fmt pre-commit hook
mrnicegyu11 Jan 3, 2025
c52b3f9
Use ansible.env file in lieu of ci.env if available
mrnicegyu11 Jan 3, 2025
c2c748f
Rename and refactor
mrnicegyu11 Jan 7, 2025
3404851
Merge remote-tracking branch 'upstream/main' into 2024/add/grafanaTer…
mrnicegyu11 Jan 8, 2025
73c384f
wip
mrnicegyu11 Jan 9, 2025
0aa010e
wip
mrnicegyu11 Jan 9, 2025
9f7be0b
remove line
mrnicegyu11 Jan 10, 2025
8eb2e73
Merge branch 'main' into 2024/add/grafanaTerraform
mrnicegyu11 Jan 13, 2025
ac627ea
Makefile repo base dir without git
mrnicegyu11 Jan 14, 2025
dc08b16
Grafana terraform ceph fixes
mrnicegyu11 Jan 14, 2025
22edf67
Fix indentation
mrnicegyu11 Jan 10, 2025
51e23c4
Add manual to traefik redirect capture all rule (#933)
YuryHrytsuk Jan 16, 2025
8728f6c
Introduce rolling docker config / secret update concept :tada: :rocke…
YuryHrytsuk Jan 30, 2025
ef8bf6b
Update traefik router hardcoded priorities (#953)
YuryHrytsuk Jan 30, 2025
bcecab7
Configure redis replicas via ENV (#957)
YuryHrytsuk Jan 31, 2025
e055bbd
Filestash: remove special docker node label (#959)
YuryHrytsuk Feb 3, 2025
998081a
rabbit: configurable replicas (#964)
YuryHrytsuk Feb 3, 2025
83e21a8
💄 minor: Change DNS Server to Quad9 (#967)
mrnicegyu11 Feb 5, 2025
0e86628
single replica (#968)
sanderegg Feb 10, 2025
54be62a
Remove docker api proxy from validate simcore settings (#972)
YuryHrytsuk Feb 13, 2025
9001e23
Add appmotiongateway add dalco
mrnicegyu11 Feb 26, 2025
f5d5e63
Add appmotiongateway add dalco - 2
mrnicegyu11 Feb 26, 2025
721069e
Add appmotiongateway add dalco - 3
mrnicegyu11 Feb 26, 2025
80b24ff
Seperate dalco-staging: disable redis special handling (#976)
mrnicegyu11 Mar 3, 2025
bf5e264
Fix deploy ops failure
mrnicegyu11 Mar 4, 2025
5959bd5
Merge branch 'main' into 2024/add/grafanaTerraform
mrnicegyu11 Mar 5, 2025
7433f2a
Make curl in ensure_grafana_online_ timeout after 10s
mrnicegyu11 Mar 7, 2025
2da8740
Timeout in wait_graylog_is_online
mrnicegyu11 Mar 7, 2025
a87ee6b
Fix osparc.local pydantic validation failure director-v0
mrnicegyu11 Mar 7, 2025
e9a5631
Merge remote-tracking branch 'upstream/main' into 2024/add/grafanaTer…
mrnicegyu11 Mar 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions certificates/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,10 @@ install-root-certificate: rootca.crt ## installs a certificate in the host syste
echo "Is the DOCKER service ready? press when ready" && read -n 1; \
fi;\
echo "======================================";,\
$(if $(IS_OSX), \
sudo security add-trusted-cert -d -k /Library/Keychains/System.keychain $<; \
echo "Please restart the DOCKER service now..." && read -n 1; \
echo "Is the DOCKER service ready? press when ready" && read -n 1; \
, \
sudo cp $< /usr/local/share/ca-certificates/osparc.crt; \
sudo update-ca-certificates -f; \
echo "# restarting docker daemon"; \
sudo cp $< /etc/ca-certificates/trust-source/anchors/osparc.crt; \
sudo trust extract-compat && \
echo "# restarting docker daemon" && \
sudo systemctl restart docker \
) \
)


Expand Down
16 changes: 16 additions & 0 deletions scripts/tf_helper_list_json_files_in_folder.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -e

DIRECTORY=$1

# Find all JSON files within the directory
FILES=$(find "$DIRECTORY" -mindepth 1 -maxdepth 1 -type f -name '*.json')

# Create a JSON object where each file's basename is the key, with full paths as values
JSON_OBJECT=$(echo "$FILES" | while read -r FILE; do
BASENAME=$(basename "$FILE" .json)
echo "{\"$BASENAME\": \"$FILE\"}"
done | jq -s 'add')

# Output the JSON map
jq -n --argjson files "$JSON_OBJECT" '$files'
16 changes: 16 additions & 0 deletions scripts/tf_helper_list_subfolders.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -e

DIRECTORY=$1

# Use `find` to get the directories' base names
SUBFOLDERS=$(find "$DIRECTORY" -mindepth 1 -maxdepth 1 -type d -exec basename {} \;)

# Convert the subfolder names into a JSON object with jq, where each is paired with itself
JSON_OBJECT=$(echo "$SUBFOLDERS" | tr ' ' '\n' | jq -Rn '
[inputs] |
map(select(. != "")) |
map({key: ., value: .}) |
from_entries')
# Output the JSON map
jq -n --argjson subfolders "$JSON_OBJECT" '$subfolders'
32 changes: 27 additions & 5 deletions services/monitoring/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,23 @@ update.grafana.pwd: .env ## Change grafana pwd
grafanacontainerid=$$(docker ps | grep grafana | awk '{print $$1;}');\
docker exec -ti $$grafanacontainerid grafana-cli admin reset-admin-password $$TRAEFIK_PASSWORD

.PHONY: ensure-grafana-online
ensure-grafana-online:
@set -o allexport; \
source $(REPO_CONFIG_LOCATION); \
set +o allexport; \
url=$${TF_VAR_grafana_url}; \
echo "Waiting for grafana at $$url to become reachable."; \
while true; do \
status_code=$$(curl -k -o /dev/null -s -w "%{http_code}" $$url); \
if [ "$$status_code" -ge 200 ] && [ "$$status_code" -lt 400 ]; then \
echo "Grafana is online"; \
break; \
else \
echo "Grafana still unreachable, waiting 5s for grafana to become reachable..."; \
sleep 5; \
fi; \
done;

.PHONY: grafana-export
grafana-export: .venv## Export the remote grafana dashboards and datasources TO YOUR LOCAL MACHINE
Expand All @@ -93,11 +110,16 @@ grafana-export: .venv## Export the remote grafana dashboards and datasources TO
python3 export.py;

.PHONY: grafana-import
grafana-import: grafana/assets .venv ## Imports AND OVERWRITES the remote grafana dashboards and datasources FROM YOUR LOCAL MACHINE
@cd grafana/scripts;\
source ${REPO_BASE_DIR}/.venv/bin/activate;\
pip install -r requirements.txt > /dev/null 2>&1;\
python3 import.py
grafana-import: grafana/assets ensure-grafana-online ## Imports AND OVERWRITES the remote grafana dashboards and datasources FROM YOUR LOCAL MACHINE
@set -o allexport; \
source $(REPO_CONFIG_LOCATION); \
set +o allexport; \
pushd ${REPO_BASE_DIR}/services/monitoring/grafana/terraform && \
terraform init && \
terraform destroy -auto-approve && \
terraform apply -auto-approve; \
popd > /dev/null


.PHONY: config.grafana.dashboards
config.grafana.dashboards: grafana/templates-provisioning/dashboards/simcore/Metrics-dashboard.json.j2 .venv #Configure dashboards for aws or dalco clusters
Expand Down
1 change: 1 addition & 0 deletions services/monitoring/grafana/terraform/.terraform-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.5.1
35 changes: 35 additions & 0 deletions services/monitoring/grafana/terraform/dashboards.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Import subfolders using an external script
data "external" "subfolders" {
program = ["bash", "${path.module}/../../../../scripts/tf_helper_list_subfolders.sh", "${path.module}/../assets/shared/dashboards"]
}

// Local mappings of folder names to their paths
locals {
folder_map = data.external.subfolders.result
}

// Create Grafana folders for each subfolder
resource "grafana_folder" "subfolders" {
for_each = local.folder_map

title = each.key // Use each.key to access each folder's name
}

// Function to list all JSON files within a directory
data "external" "dashboard_files" {
for_each = local.folder_map

program = ["bash", "${path.module}/../../../../scripts/tf_helper_list_json_files_in_folder.sh", "${path.module}/../assets/shared/dashboards/${each.key}"]
}

// Create Grafana dashboards from JSON files
resource "grafana_dashboard" "dashboards" {
for_each = toset(flatten([
for folder_name in keys(local.folder_map) : [
for file in values(data.external.dashboard_files[folder_name].result) : "${folder_name},${file}"
]]
))
# CSV approach
config_json = jsonencode(jsondecode(file(split(",", each.value)[1])).dashboard)
folder = grafana_folder.subfolders[split(",", each.value)[0]].id
}
25 changes: 25 additions & 0 deletions services/monitoring/grafana/terraform/datasources.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

resource "grafana_data_source" "prometheusfederation" {
type = "prometheus"
name = "prometheus-federation"
url = var.prometheus_federation_url
basic_auth_enabled = false
is_default = true
}

resource "grafana_data_source" "prometheuscatchall" {
type = "prometheus"
name = "prometheus-catchall"
url = var.prometheus_catchall_url
basic_auth_enabled = false
is_default = false
uid = "RmZEr52nz"
}

resource "grafana_data_source" "tempo" {
type = "tempo"
name = "tempo"
url = var.tempo_url
basic_auth_enabled = false
is_default = false
}
21 changes: 21 additions & 0 deletions services/monitoring/grafana/terraform/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
terraform {
required_version = "~> 1.5.1"
backend "local" {
path = "terraform.tfstate" # Specify the path for the state file, can be a different path if needed
}
required_providers {
grafana = {
source = "grafana/grafana"
version = "~> 3.13"
}
random = {
source = "hashicorp/random"
version = "~> 3.1"
}
}
}

provider "grafana" {
url = var.grafana_url
auth = var.grafana_auth
}
20 changes: 20 additions & 0 deletions services/monitoring/grafana/terraform/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
variable "grafana_url" {
description = "grafana_url"
sensitive = false
}
variable "grafana_auth" {
description = "Username:Password"
sensitive = true
}
variable "prometheus_federation_url" {
description = "Prometheus Federation URL"
sensitive = false
}
variable "prometheus_catchall_url" {
description = "Prometheus Catchall URL"
sensitive = false
}
variable "tempo_url" {
description = "Tempo URL"
sensitive = false
}
Loading