diff options
Diffstat (limited to 'cluster/staging/app/plume/deploy/plume.hcl')
-rw-r--r-- | cluster/staging/app/plume/deploy/plume.hcl | 139 |
1 files changed, 139 insertions, 0 deletions
diff --git a/cluster/staging/app/plume/deploy/plume.hcl b/cluster/staging/app/plume/deploy/plume.hcl new file mode 100644 index 0000000..483828d --- /dev/null +++ b/cluster/staging/app/plume/deploy/plume.hcl @@ -0,0 +1,139 @@ +job "plume-blog" { + datacenters = ["neptune"] + type = "service" + + constraint { + attribute = "${attr.cpu.arch}" + value = "amd64" + } + + group "plume" { + count = 1 + + network { + port "web_port" { } + } + + task "restore-db" { + lifecycle { + hook = "prestart" + sidecar = false + } + + driver = "docker" + config { + image = "litestream/litestream:0.3.7" + args = [ + "restore", "-config", "/etc/litestream.yml", "/ephemeral/plume.db" + ] + volumes = [ + "../alloc/data:/ephemeral", + "secrets/litestream.yml:/etc/litestream.yml" + ] + } + user = "0" + + template { + data = file("../config/litestream.yml") + destination = "secrets/litestream.yml" + } + + resources { + memory = 100 + memory_max = 1000 + cpu = 1000 + } + } + + task "plume" { + constraint { + attribute = "${attr.unique.hostname}" + operator = "=" + value = "carcajou" + } + + driver = "docker" + config { + image = "lxpz/devplume:v3" + network_mode = "host" + ports = [ "web_port" ] + command = "sh" + args = [ "-c", "plm search init; plm search refill; plume" ] + volumes = [ + "/mnt/ssd/plume/search_index:/app/search_index", + "../alloc/data:/ephemeral" + ] + } + user = "0" + + template { + data = file("../config/app.env") + destination = "secrets/app.env" + env = true + } + + resources { + memory = 200 + memory_max = 800 + cpu = 100 + } + + service { + name = "plume" + tags = [ + "plume", + "tricot plume.staging.deuxfleurs.org", + "d53-cname plume.staging.deuxfleurs.org", + ] + port = "web_port" + address_mode = "host" + check { + type = "http" + protocol = "http" + port = "web_port" + path = "/" + interval = "60s" + timeout = "5s" + check_restart { + limit = 3 + grace = "600s" + ignore_warnings = false + } + } + } + restart { + interval = "30m" + attempts = 20 + delay = "15s" + mode = "delay" + } + } + + task "replicate-db" { + driver = "docker" + config { + image = "litestream/litestream:0.3.7" + args = [ + "replicate", "-config", "/etc/litestream.yml" + ] + volumes = [ + "../alloc/data:/ephemeral", + "secrets/litestream.yml:/etc/litestream.yml" + ] + } + user = "0" + + template { + data = file("../config/litestream.yml") + destination = "secrets/litestream.yml" + } + + resources { + memory = 200 + memory_max = 1000 + cpu = 100 + } + } + } +} + |