Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,8 @@ circuit_js

# Reports
docs/dead_links_report.txt

**/.terraform
terraform.tfstate
terraform.tfstate.backup

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#cloud-config
hostname: ${hostname}
fqdn: ${hostname}
manage_etc_hosts: true

users:
- name: app
shell: /bin/bash
ssh_authorized_keys:
- ${ssh_public_key}
- name: admin
shell: /bin/bash
sudo: ALL=(ALL) NOPASSWD:ALL
ssh_authorized_keys:
- ${ssh_public_key}

package_update: true
package_upgrade: true

packages:
- ca-certificates
- curl
- wget
- gnupg
- vim
- git
- zip
- unzip
- openssl
- libssl-dev
- build-essential
- rsyslog
- htop
- rsync
- pkg-config
- locales

write_files:
- path: /etc/environment
content: |
LANG=en_US.UTF-8
LC_ALL=C
LANGUAGE=en_US.UTF-8
LC_TYPE=en_US.UTF-8
LC_CTYPE=en_US.UTF-8

runcmd:
- loginctl enable-linger app
# Tailscale installation https://tailscale.com/kb/1293/cloud-init
- curl -fsSL https://tailscale.com/install.sh | sh
- tailscale up --ssh --advertise-tags=tag:server --auth-key=${tailscale_auth_key}
- tailscale set --auto-update
- sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
- locale-gen
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#cloud-config
hostname: ${hostname}
fqdn: ${hostname}
manage_etc_hosts: true

users:
- name: app
shell: /bin/bash
ssh_authorized_keys:
- ${ssh_public_key}
- name: admin
shell: /bin/bash
sudo: ALL=(ALL) NOPASSWD:ALL
ssh_authorized_keys:
- ${ssh_public_key}

package_update: true
package_upgrade: true

packages:
- ca-certificates
- curl
- wget
- gnupg
- vim
- git
- zip
- unzip
- openssl
- libssl-dev
- build-essential
- rsyslog
- htop
- rsync
- pkg-config
- locales

write_files:
- path: /etc/environment
content: |
LANG=en_US.UTF-8
LC_ALL=C
LANGUAGE=en_US.UTF-8
LC_TYPE=en_US.UTF-8
LC_CTYPE=en_US.UTF-8

runcmd:
- loginctl enable-linger app
# Tailscale installation https://tailscale.com/kb/1293/cloud-init
- curl -fsSL https://tailscale.com/install.sh | sh
- tailscale up --ssh --advertise-tags=tag:server --auth-key=${tailscale_auth_key}
- tailscale set --auto-update
- sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
- locale-gen

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

105 changes: 105 additions & 0 deletions infra/aggregation_mode/terraform/environments/hoodi/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# AWS Provider Configuration
provider "aws" {
region = var.aws_region
}

# Scaleway Provider Configuration
provider "scaleway" {
}

# Tailscale Provider Configuration
provider "tailscale" {
}

# Postgres Monitor (EC2)
module "postgres_monitor" {
source = "../../modules/ec2"

ec2_instance_name = var.postgres_monitor_instance_name
ec2_hostname = var.postgres_monitor_hostname
ec2_instance_type = var.postgres_monitor_instance_type
ec2_ssh_key_name = var.postgres_monitor_ssh_key_name
ec2_ssh_public_key_path = var.ssh_public_key_path_aws
ec2_cloud_init_template_path = var.postgres_monitor_cloud_init_template_path
ec2_root_volume_size = var.postgres_monitor_root_volume_size
ec2_tailscale_key_expiry = var.tailscale_key_expiry
ec2_tailscale_tags = var.tailscale_tags

ec2_tags = var.common_tags
}

# Postgres Primary (Elastic Metal / Scaleway Bare Metal)
module "postgres_primary" {
source = "../../modules/elastic_metal"

elastic_metal_zone = var.postgres_primary_zone
elastic_metal_offer_name = var.postgres_primary_offer_name
elastic_metal_subscription_period = var.subscription_period
elastic_metal_server_name = var.postgres_primary_server_name
elastic_metal_hostname = var.postgres_primary_hostname
elastic_metal_description = var.postgres_primary_description
elastic_metal_ssh_key_name = var.postgres_primary_ssh_key_name
elastic_metal_ssh_public_key_path = var.ssh_public_key_path_scaleway
elastic_metal_cloud_init_template_path = var.postgres_primary_cloud_init_template_path
elastic_metal_os_id = var.os_id
elastic_metal_tailscale_key_expiry = var.tailscale_key_expiry
elastic_metal_tailscale_tags = var.tailscale_tags
elastic_metal_tags = var.postgres_primary_tags
}

# Postgres Secondary (Elastic Metal / Scaleway Bare Metal)
module "postgres_secondary" {
source = "../../modules/elastic_metal"

elastic_metal_zone = var.postgres_secondary_zone
elastic_metal_offer_name = var.postgres_secondary_offer_name
elastic_metal_subscription_period = var.subscription_period
elastic_metal_server_name = var.postgres_secondary_server_name
elastic_metal_hostname = var.postgres_secondary_hostname
elastic_metal_description = var.postgres_secondary_description
elastic_metal_ssh_key_name = var.postgres_secondary_ssh_key_name
elastic_metal_ssh_public_key_path = var.ssh_public_key_path_scaleway
elastic_metal_cloud_init_template_path = var.postgres_secondary_cloud_init_template_path
elastic_metal_os_id = var.os_id
elastic_metal_tailscale_key_expiry = var.tailscale_key_expiry
elastic_metal_tailscale_tags = var.tailscale_tags
elastic_metal_tags = var.postgres_secondary_tags
}

# Gateway Primary (Elastic Metal / Scaleway Bare Metal)
module "gateway_primary" {
source = "../../modules/elastic_metal"

elastic_metal_zone = var.gateway_primary_zone
elastic_metal_offer_name = var.gateway_primary_offer_name
elastic_metal_subscription_period = var.subscription_period
elastic_metal_server_name = var.gateway_primary_server_name
elastic_metal_hostname = var.gateway_primary_hostname
elastic_metal_description = var.gateway_primary_description
elastic_metal_ssh_key_name = var.gateway_primary_ssh_key_name
elastic_metal_ssh_public_key_path = var.ssh_public_key_path_scaleway
elastic_metal_cloud_init_template_path = var.gateway_primary_cloud_init_template_path
elastic_metal_os_id = var.os_id
elastic_metal_tailscale_key_expiry = var.tailscale_key_expiry
elastic_metal_tailscale_tags = var.tailscale_tags
elastic_metal_tags = var.gateway_primary_tags
}

# Gateway Secondary (Elastic Metal / Scaleway Bare Metal)
module "gateway_secondary" {
source = "../../modules/elastic_metal"

elastic_metal_zone = var.gateway_secondary_zone
elastic_metal_offer_name = var.gateway_secondary_offer_name
elastic_metal_subscription_period = var.subscription_period
elastic_metal_server_name = var.gateway_secondary_server_name
elastic_metal_hostname = var.gateway_secondary_hostname
elastic_metal_description = var.gateway_secondary_description
elastic_metal_ssh_key_name = var.gateway_secondary_ssh_key_name
elastic_metal_ssh_public_key_path = var.ssh_public_key_path_scaleway
elastic_metal_cloud_init_template_path = var.gateway_secondary_cloud_init_template_path
elastic_metal_os_id = var.os_id
elastic_metal_tailscale_key_expiry = var.tailscale_key_expiry
elastic_metal_tailscale_tags = var.tailscale_tags
elastic_metal_tags = var.gateway_secondary_tags
}
79 changes: 79 additions & 0 deletions infra/aggregation_mode/terraform/environments/hoodi/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Postgres Monitor Outputs
output "postgres_monitor_name" {
description = "Name of the postgres monitor EC2 instance"
value = var.postgres_monitor_instance_name
}

output "postgres_monitor_hostname" {
description = "Private DNS name of the postgres monitor EC2 instance"
value = module.postgres_monitor.instance_hostname
}

output "postgres_monitor_public_ip" {
description = "Public IP address of the postgres monitor EC2 instance"
value = module.postgres_monitor.public_ip
}

# Postgres Primary Outputs
output "postgres_primary_server_name" {
description = "Name of the postgres primary bare metal server"
value = var.postgres_primary_server_name
}

output "postgres_primary_server_id" {
description = "ID of the postgres primary bare metal server"
value = module.postgres_primary.server_id
}

output "postgres_primary_server_ip" {
description = "IP address of the postgres primary bare metal server"
value = module.postgres_primary.server_ip
}

# Postgres Secondary Outputs
output "postgres_secondary_server_name" {
description = "Name of the postgres secondary bare metal server"
value = var.postgres_secondary_server_name
}

output "postgres_secondary_server_id" {
description = "ID of the postgres secondary bare metal server"
value = module.postgres_secondary.server_id
}

output "postgres_secondary_server_ip" {
description = "IP address of the postgres secondary bare metal server"
value = module.postgres_secondary.server_ip
}

# Gateway Primary Outputs
output "gateway_primary_server_name" {
description = "Name of the gateway primary bare metal server"
value = var.gateway_primary_server_name
}

output "gateway_primary_server_id" {
description = "ID of the gateway primary bare metal server"
value = module.gateway_primary.server_id
}

output "gateway_primary_server_ip" {
description = "IP address of the gateway primary bare metal server"
value = module.gateway_primary.server_ip
}

# Gateway Secondary Outputs
output "gateway_secondary_server_name" {
description = "Name of the gateway secondary bare metal server"
value = var.gateway_secondary_server_name
}

output "gateway_secondary_server_id" {
description = "ID of the gateway secondary bare metal server"
value = module.gateway_secondary.server_id
}

output "gateway_secondary_server_ip" {
description = "IP address of the gateway secondary bare metal server"
value = module.gateway_secondary.server_ip
}
18 changes: 18 additions & 0 deletions infra/aggregation_mode/terraform/environments/hoodi/terraform.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.92"
}
scaleway = {
source = "scaleway/scaleway"
version = "2.64.0"
}
tailscale = {
source = "tailscale/tailscale"
version = "0.24.0"
}
}

required_version = ">= 1.2"
}
Loading