example-deployable-app/README.md

1.8 KiB

Example Dockerised, Terraformed application deployment onto docker on bare metal

We're gonna run Quassel on bare metal in the most low-effort and high-reward enterprisey way possible. Why? Because we can.

Pre-requisites

We're gonna need some tools:

  • OpenTofu, the replacement for Terraform since Hashicorp changed the licence terms: https://opentofu.org/docs/intro/install/.
    • As Tofu is a drop in replacement for Terraform, you can use Terraform if you prefer, and I'll refer to them interchangeably.

What have we got going on in here?

The main players:

  • database.tf - Configures our Quassel instances Postgres
  • quassel.tf - Configures our Quassel instance itself

The bit-actors:

  • docker.tf - Configures the Docker Provider for Tofu
  • inputs.tf - Where inputs to this deployment are defined and may have defaults set
  • outputs.tf - Where outputs from this deployment are defined, which will be output when we run tofu apply or tofu outputs
  • terraform.tf - Telling Terraform/ToFu what packages we need to run this deployment
  • .terraform.lock.hcl - Lock file for Terraform/ToFu, this is here to ensure that we're all using the same versions of the same packages
  • terraform.tfvars - Where we may set the variables defined in inputs.tf

What happens when we run this?

When we run tofu apply:

  • Tofu will create a Docker network for our Quassel instance
  • Tofu will create a Postgres instance for our Quassel instance
  • Tofu will compile our Quassel instance image from the Dockerfile in the quassel directory
  • Tofu will create a Quassel instance using that image
  • Tofu will output the IP address of the Quassel instance and postgres instance

How do we run this?

Did you give tofu apply a go yet?

What we're gonna end up with:

DIAGRAM GOES HERE