diff --git a/nomad/activepub/service.nomad b/nomad/activepub/service.nomad new file mode 100644 index 0000000..9348ae8 --- /dev/null +++ b/nomad/activepub/service.nomad @@ -0,0 +1,84 @@ +job "activepub" { + type = "service" + datacenters = ["dc1"] + + group "service" { + network { + port "web" { to = 8000 } + } + + service { + name = "pub" + port = "web" + } + + volume "storage" { + type = "csi" + source = "activepub" + read_only = false + attachment_mode = "file-system" + access_mode = "single-node-writer" + } + update { + max_parallel = 0 + } + + task "image" { + driver = "docker" + + config { + image = "registry.lab.bltavares.com/bltavares/microblogpub:latest" + ports = ["web"] + } + + kill_signal = "SIGKILL" + + service { + check { + name = "alive" + type = "http" + path = "/" + port = "web" + interval = "5m" + timeout = "10s" + } + + check_restart { + limit = 3 + grace = "90s" + ignore_warnings = false + } + } + + volume_mount { + volume = "storage" + destination = "/app/data" + } + + resources { + cpu = 100 + memory = 800 + } + } + + task "ingress" { + driver = "docker" + + config { + image = "registry.lab.bltavares.com/cloudflare/cloudflared:latest" + args = [ + "tunnel", "--no-autoupdate", + "run", + "--token", file("../../secrets/activitypub/tunnel.token"), + "--url", "${NOMAD_ADDR_web}", + "activitypub", + ] + } + + resources { + cpu = 10 + memory = 50 + } + } + } +} \ No newline at end of file diff --git a/nomad/activepub/volume.nomad b/nomad/activepub/volume.nomad new file mode 100644 index 0000000..f04f6ab --- /dev/null +++ b/nomad/activepub/volume.nomad @@ -0,0 +1,17 @@ +id = "activepub" +name = "activepub" +type = "csi" +plugin_id = "nfs" + +capacity_max = "10G" + +capability { + access_mode = "single-node-writer" + attachment_mode = "file-system" +} + +parameters { + uid = "1000" + gid = "1000" + mode = "770" +} diff --git a/secrets/activitypub/tunnel.token b/secrets/activitypub/tunnel.token new file mode 100644 index 0000000..47a7138 Binary files /dev/null and b/secrets/activitypub/tunnel.token differ