diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..b45b143 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["hashicorp.terraform", "fredwangwang.vscode-hcl-format"] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..aaf850f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "editor.tabSize": 2, + "editor.insertSpaces": true, + "editor.formatOnSave": true +} diff --git a/2-nomad-config/1-infra.tf b/2-nomad-config/1-infra.tf index 35430e9..3bf8818 100644 --- a/2-nomad-config/1-infra.tf +++ b/2-nomad-config/1-infra.tf @@ -11,7 +11,7 @@ terraform { terraform { required_providers { sops = { - source = "carlpett/sops" + source = "carlpett/sops" version = "~> 0.5" } } @@ -58,11 +58,11 @@ resource "nomad_job" "pgbackup" { resource "nomad_csi_volume_registration" "unraid_database_dump" { #Note: Before chaning the definition of this volume you need to stop the jobs that are using it - depends_on = [data.nomad_plugin.smb] + depends_on = [data.nomad_plugin.smb] plugin_id = "smb" - - volume_id = "unraid_database_dump" - name = "unraid_database_dump" + + volume_id = "unraid_database_dump" + name = "unraid_database_dump" external_id = "unraid_database_dump" @@ -79,4 +79,4 @@ resource "nomad_csi_volume_registration" "unraid_database_dump" { "username" = "nomad" "password" = data.sops_file.secrets.data["unraid.nomad"] } -} \ No newline at end of file +} diff --git a/2-nomad-config/2-services.tf b/2-nomad-config/2-services.tf index eafdf81..813165f 100644 --- a/2-nomad-config/2-services.tf +++ b/2-nomad-config/2-services.tf @@ -13,11 +13,11 @@ resource "nomad_job" "webapp" { resource "nomad_csi_volume_registration" "unraid_transfer" { #Note: Before chaning the definition of this volume you need to stop the jobs that are using it - depends_on = [data.nomad_plugin.smb] + depends_on = [data.nomad_plugin.smb] plugin_id = "smb" - - volume_id = "unraid_transfer" - name = "unraid_transfer" + + volume_id = "unraid_transfer" + name = "unraid_transfer" external_id = "unraid_transfer" @@ -42,11 +42,11 @@ resource "nomad_job" "transfer" { resource "nomad_csi_volume_registration" "unraid_appdata_transferfilebrowser" { #Note: Before chaning the definition of this volume you need to stop the jobs that are using it - depends_on = [data.nomad_plugin.smb] + depends_on = [data.nomad_plugin.smb] plugin_id = "smb" - - volume_id = "unraid_appdata_transferfilebrowser" - name = "unraid_appdata_transferfilebrowser" + + volume_id = "unraid_appdata_transferfilebrowser" + name = "unraid_appdata_transferfilebrowser" external_id = "unraid_appdata_transferfilebrowser" diff --git a/2-nomad-config/csi-smb.nomad.hcl b/2-nomad-config/csi-smb.nomad.hcl index a5e9965..1549977 100644 --- a/2-nomad-config/csi-smb.nomad.hcl +++ b/2-nomad-config/csi-smb.nomad.hcl @@ -1,13 +1,13 @@ job "csi-smb" { - type = "system" + type = "system" group "smb" { task "plugin" { driver = "docker" config { - image = "mcr.microsoft.com/k8s/csi/smb-csi:v1.7.0" - args = [ + image = "mcr.microsoft.com/k8s/csi/smb-csi:v1.7.0" + args = [ "--v=5", "--nodeid=${attr.unique.hostname}", "--endpoint=unix:///csi/csi.sock", @@ -17,9 +17,9 @@ job "csi-smb" { } csi_plugin { - id = "smb" - type = "node" - mount_dir = "/csi" + id = "smb" + type = "node" + mount_dir = "/csi" } resources { @@ -28,4 +28,4 @@ job "csi-smb" { } } } -} \ No newline at end of file +} diff --git a/2-nomad-config/glance.nomad.hcl b/2-nomad-config/glance.nomad.hcl index 8b67804..13e2ee7 100644 --- a/2-nomad-config/glance.nomad.hcl +++ b/2-nomad-config/glance.nomad.hcl @@ -22,7 +22,7 @@ job "glance" { service { name = "home" port = "http" - + tags = [ "traefik.enable=true", "traefik.http.routers.home.middlewares=auth@file", @@ -165,4 +165,4 @@ EOF } } -} \ No newline at end of file +} diff --git a/2-nomad-config/hello-world.nomad.hcl b/2-nomad-config/hello-world.nomad.hcl index e0eb6dc..8dd1c21 100644 --- a/2-nomad-config/hello-world.nomad.hcl +++ b/2-nomad-config/hello-world.nomad.hcl @@ -9,7 +9,7 @@ job "hello-world" { service { name = "hello-world" port = "www" - + tags = [ "traefik.enable=true", "traefik.http.routers.hello-world.middlewares=auth@file", @@ -23,7 +23,7 @@ job "hello-world" { timeout = "2s" } } - + # Tasks are individual units of work that are run by Nomad. task "web" { @@ -58,4 +58,4 @@ job "hello-world" { } } } -} \ No newline at end of file +} diff --git a/2-nomad-config/pgadmin.nomad.hcl b/2-nomad-config/pgadmin.nomad.hcl index 2fbefeb..c315154 100644 --- a/2-nomad-config/pgadmin.nomad.hcl +++ b/2-nomad-config/pgadmin.nomad.hcl @@ -34,13 +34,13 @@ job "pgadmin" { } env = { - PGADMIN_DEFAULT_EMAIL = "othrayte@gmail.com" - PGADMIN_DEFAULT_PASSWORD = "admin" - PGADMIN_CONFIG_WTF_CSRF_ENABLED = "False" - PGADMIN_CONFIG_WTF_CSRF_CHECK_DEFAULT = "False" + PGADMIN_DEFAULT_EMAIL = "othrayte@gmail.com" + PGADMIN_DEFAULT_PASSWORD = "admin" + PGADMIN_CONFIG_WTF_CSRF_ENABLED = "False" + PGADMIN_CONFIG_WTF_CSRF_CHECK_DEFAULT = "False" PGADMIN_CONFIG_ENHANCED_COOKIE_PROTECTION = "False" - PGADMIN_CONFIG_SERVER_MODE = "False" - PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED = "False" + PGADMIN_CONFIG_SERVER_MODE = "False" + PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED = "False" } resources { @@ -66,7 +66,7 @@ job "pgadmin" { } template { - data = < /backup/all_databases.sql"] - volumes = [ "secrets/postgres_password:/run/secrets/postgres_password" ] + args = ["-c", "pg_dumpall -h localhost -U postgres > /backup/all_databases.sql"] + volumes = ["secrets/postgres_password:/run/secrets/postgres_password"] } user = "1000" volume_mount { volume = "unraid_database_dump" - destination = "/backup" + destination = "/backup" read_only = false } @@ -44,12 +44,12 @@ job "pgbackup" { } template { - data = <