jaylong255 / mastodon-iac

Infrastructure, documentation and examples on how to deploy an instance of Mastodon

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mastodon IaC

Infrastructure, documentation and examples on how to deploy an instance of Mastodon

Useful Links

Random Examples

How to Boost Mastodon Server Performance with Redis

Mastodon Architecture with Redis

Examples with Terraform

Deploy a Mastodon instance - Example with Terraform and AWS

This one is a few years old. Try to find a reason to ignore it but if you get desperate, I'm sure it has some useful ideas and information that are still relevant.

The GitHub Repo for the TF Module Used in the Above Blog

Again, no one has contributed to this in 6 years. So either not much has changed or everyone is using a different module now.

GitHub Repo for GCP/Terraform

This one may be GOLD. I'm about to try and launch it on my own account.


Folder and Project Structure

The trick here is to organize projects into folders that allow us to have a highly privileged Terraform agent across all projects managed by IaC, while keeping it from being able to self-escalate its own permissions beyond its sandbox and thus throughout the entire GCP account.

# Folder / Project Structure and Service Accounts

πŸ“ Terraform-Managed-Resources (Folder)
β”œβ”€β”€ πŸ“ Terraform-Managed-Projects (Folder)
β”‚   β”œβ”€β”€ πŸ“ My-App (Folder)
β”‚   β”‚   └── πŸš€ My-App (Project)
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ‘€ Resource1 (Service Account)
β”‚   β”‚   β”‚   └── πŸ‘€ Resource2 (Service Account)
β”‚   └── πŸ“ My-App-Dev (Folder)
β”‚   β”‚   β”œβ”€β”€ πŸš€ My-App-Staging (Project)
β”‚   β”‚   β”‚   └── πŸ‘€ Resource1 (Service Account)
β”‚   β”‚   β”œβ”€β”€ πŸš€ My-App-PR-456 (Project)
β”‚   β”‚   β”‚   └── πŸ‘€ Resource1 (Service Account)
β”‚   β”‚   └── πŸš€ My-App-PR-123 (Project)
β”‚   β”‚   β”‚   └── πŸ‘€ Resource1 (Service Account)
β”‚   β”œβ”€β”€ πŸ“ Some-Other-App (Folder)
β”‚   β”‚   └── πŸš€ Some-Other-App (Project)
β”‚   β”‚   β”‚   └── πŸ‘€ Resource1 (Service Account)
β”‚   └── πŸ“ My-App-Dev (Folder)
β”‚       β”œβ”€β”€ πŸš€ Some-Other-App-Staging (Project)
β”‚       β”‚   └── πŸ‘€ Resource1 (Service Account)
β”‚       └── πŸš€ Some-Other-App-PR-678 (Project)
β”‚           └── πŸ‘€ Resource1 (Service Account)
└── πŸš€ Terraform-Agents
    └── πŸ‘€ Terraform (Service Account)

Network

The following module is a versitile and popular solution in the Terraform community for launching network infrastructure on GCP.

terraform-google-modules/network/google

Terraform Network Module

VPC

NAT IP

Cloud Router

Cloud NAT

Firewalls

Firewall IAP

Service Accounts

Monitoring and Backups

Workload Identity User

Monitoring Bucket

Storage Bucket

Keyring

Kubernetes

GKE Cluster

About

Infrastructure, documentation and examples on how to deploy an instance of Mastodon