Skip to content

Commit 0175088

Browse files
committed
infra(agg_mode): separate deployments into environments
1 parent b0fdf98 commit 0175088

14 files changed

Lines changed: 734 additions & 0 deletions

File tree

infra/aggregation_mode/terraform/cloudinit/scaleway-cloud-init.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,5 @@ runcmd:
4040
- curl -fsSL https://tailscale.com/install.sh | sh
4141
- tailscale up --ssh --advertise-tags=tag:server --auth-key=${tailscale_auth_key}
4242
- tailscale set --auto-update
43+
- sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
44+
- locale-gen

infra/aggregation_mode/terraform/environments/hoodi/.terraform.lock.hcl

Lines changed: 69 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# AWS Provider Configuration
2+
provider "aws" {
3+
region = var.aws_region
4+
}
5+
6+
# Scaleway Provider Configuration
7+
provider "scaleway" {
8+
}
9+
10+
# Tailscale Provider Configuration
11+
provider "tailscale" {
12+
}
13+
14+
# Postgres Monitor (EC2)
15+
module "postgres_monitor" {
16+
source = "../../modules/ec2"
17+
18+
ec2_instance_name = var.monitor_instance_name
19+
ec2_hostname = var.monitor_hostname
20+
ec2_instance_type = var.monitor_instance_type
21+
ec2_ssh_key_name = var.monitor_ssh_key_name
22+
ec2_ssh_public_key_path = var.ssh_public_key_path_aws
23+
ec2_cloud_init_template_path = var.monitor_cloud_init_template_path
24+
ec2_root_volume_size = var.monitor_root_volume_size
25+
ec2_tailscale_key_expiry = var.tailscale_key_expiry
26+
ec2_tailscale_tags = var.tailscale_tags
27+
28+
ec2_tags = var.common_tags
29+
}
30+
31+
# Postgres Primary (Elastic Metal / Scaleway Bare Metal)
32+
module "postgres_primary" {
33+
source = "../../modules/elastic_metal"
34+
35+
elastic_metal_zone = var.primary_zone
36+
elastic_metal_offer_name = var.primary_offer_name
37+
elastic_metal_subscription_period = var.subscription_period
38+
elastic_metal_server_name = var.primary_server_name
39+
elastic_metal_hostname = var.primary_hostname
40+
elastic_metal_description = var.primary_description
41+
elastic_metal_ssh_key_name = var.primary_ssh_key_name
42+
elastic_metal_ssh_public_key_path = var.ssh_public_key_path_scaleway
43+
elastic_metal_cloud_init_template_path = var.primary_cloud_init_template_path
44+
elastic_metal_os_id = var.os_id
45+
elastic_metal_tailscale_key_expiry = var.tailscale_key_expiry
46+
elastic_metal_tailscale_tags = var.tailscale_tags
47+
elastic_metal_tags = var.primary_tags
48+
}
49+
50+
# Postgres Secondary (Elastic Metal / Scaleway Bare Metal)
51+
module "postgres_secondary" {
52+
source = "../../modules/elastic_metal"
53+
54+
elastic_metal_zone = var.secondary_zone
55+
elastic_metal_offer_name = var.secondary_offer_name
56+
elastic_metal_subscription_period = var.subscription_period
57+
elastic_metal_server_name = var.secondary_server_name
58+
elastic_metal_hostname = var.secondary_hostname
59+
elastic_metal_description = var.secondary_description
60+
elastic_metal_ssh_key_name = var.secondary_ssh_key_name
61+
elastic_metal_ssh_public_key_path = var.ssh_public_key_path_scaleway
62+
elastic_metal_cloud_init_template_path = var.secondary_cloud_init_template_path
63+
elastic_metal_os_id = var.os_id
64+
elastic_metal_tailscale_key_expiry = var.tailscale_key_expiry
65+
elastic_metal_tailscale_tags = var.tailscale_tags
66+
elastic_metal_tags = var.secondary_tags
67+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Postgres Monitor Outputs
2+
output "monitor_hostname" {
3+
description = "Private DNS name of the postgres monitor EC2 instance"
4+
value = module.postgres_monitor.instance_hostname
5+
}
6+
7+
output "monitor_public_ip" {
8+
description = "Public IP address of the postgres monitor EC2 instance"
9+
value = module.postgres_monitor.public_ip
10+
}
11+
12+
# Postgres Primary Outputs
13+
output "primary_server_id" {
14+
description = "ID of the postgres primary bare metal server"
15+
value = module.postgres_primary.server_id
16+
}
17+
18+
output "primary_server_ip" {
19+
description = "IP address of the postgres primary bare metal server"
20+
value = module.postgres_primary.server_ip
21+
}
22+
23+
# Postgres Secondary Outputs
24+
output "secondary_server_id" {
25+
description = "ID of the postgres secondary bare metal server"
26+
value = module.postgres_secondary.server_id
27+
}
28+
29+
output "secondary_server_ip" {
30+
description = "IP address of the postgres secondary bare metal server"
31+
value = module.postgres_secondary.server_ip
32+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
terraform {
2+
required_providers {
3+
aws = {
4+
source = "hashicorp/aws"
5+
version = "~> 5.92"
6+
}
7+
scaleway = {
8+
source = "scaleway/scaleway"
9+
version = "2.64.0"
10+
}
11+
tailscale = {
12+
source = "tailscale/tailscale"
13+
version = "0.24.0"
14+
}
15+
}
16+
17+
required_version = ">= 1.2"
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Provider Configuration
2+
aws_region = "us-east-1"
3+
scaleway_zone = "fr-par-2"
4+
5+
# Common Configuration
6+
ssh_public_key_path_aws = "~/.ssh/aws.pub"
7+
ssh_public_key_path_scaleway = "~/.ssh/scaleway.pem.pub"
8+
9+
# Postgres Monitor Configuration (EC2)
10+
monitor_instance_type = "t2.micro"
11+
12+
# Postgres Primary Configuration (Elastic Metal)
13+
primary_zone = "fr-par-2"
14+
primary_offer_name = "EM-A610R-NVME"
15+
16+
# Postgres Secondary Configuration (Elastic Metal)
17+
secondary_zone = "nl-ams-1"
18+
secondary_offer_name = "EM-A610R-NVME"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Provider Configuration
2+
aws_region = "us-east-1"
3+
scaleway_zone = "fr-par-2"
4+
scaleway_project_id = "your-scaleway-project-id"
5+
tailscale_tailnet = "your-tailnet.ts.net"
6+
7+
# Common Configuration
8+
ssh_public_key_path_aws = "~/.ssh/aws.pub"
9+
ssh_public_key_path_scaleway = "~/.ssh/scaleway.pem.pub"
10+
11+
# Postgres Monitor Configuration (EC2)
12+
monitor_instance_type = "t2.micro"
13+
14+
# Postgres Primary Configuration (Elastic Metal)
15+
primary_zone = "fr-par-2"
16+
primary_offer_name = "EM-A610R-NVME"
17+
18+
# Postgres Secondary Configuration (Elastic Metal)
19+
secondary_zone = "nl-ams-1"
20+
secondary_offer_name = "EM-A610R-NVME"

0 commit comments

Comments
 (0)