Browse Source

feat: Add planka

pull/3/head
Karan Sharma 11 months ago
parent
commit
8fc61ab637
  1. 9
      floyd/terraform/caddy/conf/Caddyfile-internal.tpl
  2. 12
      floyd/terraform/cloudflare/records.tf
  3. 4
      floyd/terraform/env.sample
  4. 2
      floyd/terraform/firefly/postgres.tf
  5. 2
      floyd/terraform/gitea/image.tf
  6. 14
      floyd/terraform/main.tf
  7. 48
      floyd/terraform/planka/container.tf
  8. 17
      floyd/terraform/planka/image.tf
  9. 5
      floyd/terraform/planka/network.tf
  10. 25
      floyd/terraform/planka/postgres.tf
  11. 13
      floyd/terraform/planka/variables.tf
  12. 8
      floyd/terraform/planka/versions.tf
  13. 2
      floyd/terraform/shynet/postgres.tf
  14. 10
      floyd/terraform/variables.tf

9
floyd/terraform/caddy/conf/Caddyfile-internal.tpl

@ -30,15 +30,10 @@ sync.mrkaran.dev {
metrics /metrics
}
firefly.mrkaran.dev {
reverse_proxy firefly:8080
planka.mrkaran.dev {
reverse_proxy planka:1337
tls {
dns cloudflare "${cloudflare_api_token}"
}
header {
# https://docs.firefly-iii.org/installation/docker#docker-and-reverse-proxies
X-Forwarded-Proto https
}
metrics /metrics
}

12
floyd/terraform/cloudflare/records.tf

@ -125,3 +125,15 @@ resource "cloudflare_record" "wiki" {
value = var.ips["tailscale_floyd"]
}
resource "cloudflare_record" "planka" {
zone_id = cloudflare_zone.mrkaran_dev.id
name = "planka"
type = "A"
ttl = "1"
proxied = "false"
value = var.ips["tailscale_floyd"]
}

4
floyd/terraform/env.sample

@ -11,4 +11,6 @@ TF_VAR_gitea_oauth2_jwt_secret=
TF_VAR_gitea_oauth2_jwt_secret=
TF_VAR_gitea_oauth2_jwt_secret=
TF_VAR_shynet_postgresql_password=
TF_VAR_shynet_django_secret_key=
TF_VAR_shynet_django_secret_key=
TF_VAR_planka_postgresql_password=
TF_VAR_planka_secret_key=

2
floyd/terraform/firefly/postgres.tf

@ -6,7 +6,7 @@ resource "docker_container" "firefly_db" {
volumes {
host_path = "/data/firefly/db"
container_path = "/var/lib/postgres"
container_path = "/var/lib/postgresql/data"
}
env = [

2
floyd/terraform/gitea/image.tf

@ -1,5 +1,5 @@
data "docker_registry_image" "gitea" {
name = "gitea/gitea:1.13.0-rc2"
name = "gitea/gitea:latest"
}
resource "docker_image" "gitea" {

14
floyd/terraform/main.tf

@ -65,8 +65,6 @@ module "monitoring" {
}
}
module "shynet" {
source = "./shynet"
ips = var.ips
@ -78,6 +76,18 @@ module "shynet" {
}
}
module "planka" {
source = "./planka"
ips = var.ips
planka_postgresql_password = var.planka_postgresql_password
planka_secret_key = var.planka_secret_key
caddy_network_internal = module.caddy.caddy_network_internal
providers = {
docker = docker.floyd
}
}
module "syncthing" {
source = "./syncthing"
ips = var.ips

48
floyd/terraform/planka/container.tf

@ -0,0 +1,48 @@
# Referred to https://github.com/plankanban/planka/blob/master/docker-compose.yml
# for config.
resource "docker_container" "planka" {
name = "planka"
image = docker_image.planka.latest
volumes {
host_path = "/data/planka/user-avatars"
container_path = "/app/public/user-avatars"
}
volumes {
host_path = "/data/planka/project-background-images"
container_path = "/app/public/project-background-images"
}
volumes {
host_path = "/data/planka/attachments"
container_path = "/app/public/attachments"
}
ports {
internal = 1337
external = 3080
ip = var.ips["tailscale_floyd"]
protocol = "tcp"
}
networks_advanced {
name = docker_network.planka.name
}
networks_advanced {
name = var.caddy_network_internal
}
env = [
"BASE_URL=https://planka.mrkaran.dev",
"DATABASE_URL=postgresql://planka:${var.planka_postgresql_password}@planka_db/planka",
"SECRET_KEY=${var.planka_secret_key}",
"NODE_ENV=production"
]
restart = "unless-stopped"
destroy_grace_seconds = 30
must_run = true
}

17
floyd/terraform/planka/image.tf

@ -0,0 +1,17 @@
data "docker_registry_image" "planka" {
name = "meltyshev/planka:latest"
}
resource "docker_image" "planka" {
name = data.docker_registry_image.planka.name
pull_triggers = [data.docker_registry_image.planka.sha256_digest]
}
data "docker_registry_image" "postgres" {
name = "postgres:13"
}
resource "docker_image" "postgres" {
name = data.docker_registry_image.postgres.name
pull_triggers = [data.docker_registry_image.postgres.sha256_digest]
}

5
floyd/terraform/planka/network.tf

@ -0,0 +1,5 @@
resource "docker_network" "planka" {
name = "planka"
driver = "bridge"
internal = "false"
}

25
floyd/terraform/planka/postgres.tf

@ -0,0 +1,25 @@
# Referred to https://github.com/plankanban/planka/blob/master/docker-compose.yml
# for config.
resource "docker_container" "planka_db" {
name = "planka_db"
image = docker_image.postgres.latest
volumes {
host_path = "/data/planka/db"
container_path = "/var/lib/postgresql/data"
}
env = [
"POSTGRES_DB=planka",
"POSTGRES_USER=planka",
"POSTGRES_PASSWORD=${var.planka_postgresql_password}",
]
networks_advanced {
name = docker_network.planka.name
}
restart = "unless-stopped"
destroy_grace_seconds = 30
must_run = true
}

13
floyd/terraform/planka/variables.tf

@ -0,0 +1,13 @@
variable "ips" {
type = map
}
variable "planka_postgresql_password" {
type = string
}
variable "planka_secret_key" {
type = string
}
variable "caddy_network_internal" {}

8
floyd/terraform/planka/versions.tf

@ -0,0 +1,8 @@
terraform {
required_providers {
docker = {
source = "terraform-providers/docker"
}
}
required_version = ">= 0.13"
}

2
floyd/terraform/shynet/postgres.tf

@ -6,7 +6,7 @@ resource "docker_container" "shynet_db" {
volumes {
host_path = "/data/shynet/db"
container_path = "/var/lib/postgres"
container_path = "/var/lib/postgresql/data"
}
env = [

10
floyd/terraform/variables.tf

@ -60,3 +60,13 @@ variable "shynet_django_secret_key" {
type = string
description = "Django secret key generated for Shynet"
}
variable "planka_postgresql_password" {
type = string
description = "Password for planka PostgreSQL server"
}
variable "planka_secret_key" {
type = string
description = " secret key generated for planka"
}

Loading…
Cancel
Save