Skip to content

Commit 7706544

Browse files
committed
infra(terraform): add metrics server
1 parent 3672812 commit 7706544

File tree

5 files changed

+147
-0
lines changed

5 files changed

+147
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#cloud-config
2+
hostname: ${hostname}
3+
fqdn: ${hostname}
4+
manage_etc_hosts: true
5+
6+
users:
7+
- name: app
8+
shell: /bin/bash
9+
ssh_authorized_keys:
10+
- ${ssh_public_key}
11+
- name: admin
12+
shell: /bin/bash
13+
sudo: ALL=(ALL) NOPASSWD:ALL
14+
ssh_authorized_keys:
15+
- ${ssh_public_key}
16+
17+
package_update: true
18+
package_upgrade: true
19+
20+
packages:
21+
- ca-certificates
22+
- curl
23+
- wget
24+
- gnupg
25+
- vim
26+
- git
27+
- zip
28+
- unzip
29+
- openssl
30+
- libssl-dev
31+
- build-essential
32+
- rsyslog
33+
- htop
34+
- rsync
35+
- pkg-config
36+
- locales
37+
- ufw
38+
39+
write_files:
40+
- path: /etc/environment
41+
content: |
42+
LANG=en_US.UTF-8
43+
LC_ALL=C
44+
LANGUAGE=en_US.UTF-8
45+
LC_TYPE=en_US.UTF-8
46+
LC_CTYPE=en_US.UTF-8
47+
48+
runcmd:
49+
- loginctl enable-linger app
50+
# Tailscale installation https://tailscale.com/kb/1293/cloud-init
51+
- curl -fsSL https://tailscale.com/install.sh | sh
52+
- tailscale up --ssh --advertise-tags=tag:server --auth-key=${tailscale_auth_key}
53+
- tailscale set --auto-update
54+
- sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
55+
- locale-gen
56+
- ufw enable

infra/aggregation_mode/terraform/environments/hoodi/main.tf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,22 @@ module "gateway_secondary" {
103103
elastic_metal_tailscale_tags = var.tailscale_tags
104104
elastic_metal_tags = var.gateway_secondary_tags
105105
}
106+
107+
# Metrics Server (Elastic Metal / Scaleway Bare Metal)
108+
module "metrics" {
109+
source = "../../modules/elastic_metal"
110+
111+
elastic_metal_zone = var.metrics_server_zone
112+
elastic_metal_offer_name = var.metrics_server_offer_name
113+
elastic_metal_subscription_period = var.subscription_period
114+
elastic_metal_server_name = var.metrics_server_name
115+
elastic_metal_hostname = var.metrics_server_hostname
116+
elastic_metal_description = var.metrics_server_description
117+
elastic_metal_ssh_key_name = var.metrics_server_ssh_key_name
118+
elastic_metal_ssh_public_key_path = var.ssh_public_key_path_scaleway
119+
elastic_metal_cloud_init_template_path = var.metrics_server_cloud_init_template_path
120+
elastic_metal_os_id = var.os_id
121+
elastic_metal_tailscale_key_expiry = var.tailscale_key_expiry
122+
elastic_metal_tailscale_tags = var.tailscale_tags
123+
elastic_metal_tags = var.metrics_server_tags
124+
}

infra/aggregation_mode/terraform/environments/hoodi/outputs.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,19 @@ output "gateway_secondary_server_ip" {
7777
description = "IP address of the gateway secondary bare metal server"
7878
value = module.gateway_secondary.server_ip
7979
}
80+
81+
# Metrics Server Outputs
82+
output "metrics_server_name" {
83+
description = "Name of the metrics bare metal server"
84+
value = var.metrics_server_name
85+
}
86+
87+
output "metrics_server_id" {
88+
description = "ID of the metrics bare metal server"
89+
value = module.metrics.server_id
90+
}
91+
92+
output "metrics_server_ip" {
93+
description = "IP address of the metrics bare metal server"
94+
value = module.metrics.server_ip
95+
}

infra/aggregation_mode/terraform/environments/hoodi/terraform.tfvars

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,15 @@ gateway_secondary_description = "Gateway server 2 for hoodi"
6767
gateway_secondary_ssh_key_name = "agg-mode-hoodi-gateway-2-key"
6868
gateway_secondary_cloud_init_template_path = "../../cloudinit/scaleway-cloud-init.yaml"
6969
gateway_secondary_tags = ["gateway", "gateway-2", "hoodi"]
70+
71+
# ============================================
72+
# Metrics Configuration (Elastic Metal)
73+
# ============================================
74+
metrics_server_zone = "fr-par-2"
75+
metrics_server_offer_name = "EM-A610R-NVME"
76+
metrics_server_name = "agg-mode-hoodi-metrics"
77+
metrics_server_hostname = "agg-mode-hoodi-metrics"
78+
metrics_server_description = "Metrics server for hoodi"
79+
metrics_server_ssh_key_name = "agg-mode-hoodi-metrics-key"
80+
metrics_server_cloud_init_template_path = "../../cloudinit/cloud-init.yaml"
81+
metrics_server_tags = ["metrics", "hoodi"]

infra/aggregation_mode/terraform/environments/hoodi/variables.tf

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,3 +266,47 @@ variable "gateway_secondary_tags" {
266266
description = "Tags for gateway secondary"
267267
type = list(string)
268268
}
269+
270+
# ============================================
271+
# Metrics Configuration (Elastic Metal)
272+
# ============================================
273+
274+
variable "metrics_server_zone" {
275+
description = "Scaleway zone for metrics server"
276+
type = string
277+
}
278+
279+
variable "metrics_server_offer_name" {
280+
description = "Bare metal offer name for metrics server"
281+
type = string
282+
}
283+
284+
variable "metrics_server_name" {
285+
description = "Server name for metrics server"
286+
type = string
287+
}
288+
289+
variable "metrics_server_hostname" {
290+
description = "Hostname for metrics server"
291+
type = string
292+
}
293+
294+
variable "metrics_server_description" {
295+
description = "Description for metrics server"
296+
type = string
297+
}
298+
299+
variable "metrics_server_ssh_key_name" {
300+
description = "SSH key name for metrics server"
301+
type = string
302+
}
303+
304+
variable "metrics_server_cloud_init_template_path" {
305+
description = "Path to cloud-init template for metrics server"
306+
type = string
307+
}
308+
309+
variable "metrics_server_tags" {
310+
description = "Tags for metrics server"
311+
type = list(string)
312+
}

0 commit comments

Comments
 (0)