Browse Source

chore: remove joplin server

master
Karan Sharma 4 months ago
parent
commit
7dd351f9ac
  1. 8
      terraform/main.tf
  2. 105
      terraform/modules/joplin/conf/joplin.nomad
  3. 8
      terraform/modules/joplin/job.tf
  4. 9
      terraform/modules/joplin/providers.tf
  5. 3
      terraform/modules/joplin/variables.tf

8
terraform/main.tf

@ -45,14 +45,6 @@ module "shynet" {
}
}
module "joplin" {
source = "./modules/joplin"
joplin_postgresql_password = var.joplin_postgresql_password
providers = {
nomad = nomad
}
}
module "restic" {
source = "./modules/restic"
restic_b2_account_id = var.restic_b2_account_id

105
terraform/modules/joplin/conf/joplin.nomad

@ -1,105 +0,0 @@
job "joplin" {
datacenters = ["hydra"]
type = "service"
group "app" {
count = 1
network {
port "http" {
to = 22300
host_network = "tailscale"
}
port "db" {
to = 5432
host_network = "tailscale"
}
}
restart {
attempts = 2
interval = "2m"
delay = "30s"
mode = "fail"
}
task "web" {
driver = "docker"
service {
name = "joplin-web"
tags = ["joplin", "web"]
port = "http"
}
config {
image = "joplin/server:latest"
ports = ["http"]
}
env {
APP_BASE_URL = "https://joplin.mrkaran.dev"
DB_CLIENT = "pg"
POSTGRES_DATABASE = "joplin"
POSTGRES_USER = "joplin"
POSTGRES_PASSWORD = "${joplin_postgresql_password}"
}
template {
data = <<EOH
{{- with service "joplin-db" }}
{{- with index . 0 }}
POSTGRES_HOST="{{.Address}}"
POSTGRES_PORT="{{.Port}}"
{{- end }}
{{ end }}
EOH
destination = "secrets/file.env"
env = true
change_mode = "restart"
}
resources {
cpu = 200
memory = 100
}
}
task "db" {
driver = "docker"
service {
name = "joplin-db"
tags = ["joplin", "db"]
port = "db"
}
config {
image = "postgres:13"
# Bind the data directory to preserve config.
mount {
type = "bind"
target = "/var/lib/postgresql/data"
source = "/data/joplin/db/"
readonly = false
}
ports = ["db"]
}
env {
POSTGRES_DB = "joplin"
POSTGRES_USER = "joplin"
POSTGRES_PASSWORD = "${joplin_postgresql_password}"
}
# resources {
# cpu = 200
# memory = 200
# }
}
}
}

8
terraform/modules/joplin/job.tf

@ -1,8 +0,0 @@
resource "nomad_job" "app" {
jobspec = templatefile("${path.module}/conf/joplin.nomad", {
joplin_postgresql_password = var.joplin_postgresql_password
})
hcl2 {
enabled = true
}
}

9
terraform/modules/joplin/providers.tf

@ -1,9 +0,0 @@
terraform {
required_providers {
nomad = {
source = "hashicorp/nomad"
version = "1.4.14"
}
}
required_version = ">= 0.14"
}

3
terraform/modules/joplin/variables.tf

@ -1,3 +0,0 @@
variable "joplin_postgresql_password" {
type = string
}
Loading…
Cancel
Save