summaryrefslogtreecommitdiff
path: root/jobs/certificates.nomad.hcl
diff options
context:
space:
mode:
authorMathias Magnusson <mathias@magnusson.space>2024-05-11 21:25:49 +0200
committerMathias Magnusson <mathias@magnusson.space>2024-05-11 21:28:46 +0200
commitc2d3ec3c2ab124158e039fddfd22d35c704afd9f (patch)
treee48e6ecbde72556a4973f6d9ad0132acb72ddc6a /jobs/certificates.nomad.hcl
parent2248eaced59e6c89d812bd9fcb7285e6576a193b (diff)
downloadgarm-c2d3ec3c2ab124158e039fddfd22d35c704afd9f.tar.gz
Replace nginx with traefik
Diffstat (limited to 'jobs/certificates.nomad.hcl')
-rw-r--r--jobs/certificates.nomad.hcl99
1 files changed, 0 insertions, 99 deletions
diff --git a/jobs/certificates.nomad.hcl b/jobs/certificates.nomad.hcl
deleted file mode 100644
index 8731227..0000000
--- a/jobs/certificates.nomad.hcl
+++ /dev/null
@@ -1,99 +0,0 @@
-job "certificates" {
- type = "batch"
-
- periodic {
- crons = ["@monthly"]
- }
-
- group "lego" {
- restart {
- attempts = 1
- delay = "1h"
- }
-
- volume "certs" {
- type = "host"
- source = "ca-certificates"
- }
-
- network {
- port "http" {
- # static = 80
- }
- }
-
- service {
- name = "certificates"
- port = "http"
- provider = "nomad"
-
- tags = [
- "nginx.acme-challenge",
- ]
- }
-
- task "lego" {
- driver = "exec"
-
- volume_mount {
- volume = "certs"
- destination = "/lego"
- }
-
- config {
- command = "certs.sh"
- }
-
- template {
- data = <<EOF
-#!/usr/bin/env bash
-
-function cert() {
- # --server "https://acme-staging-v02.api.letsencrypt.org/directory"
- /local/lego \
- --accept-tos \
- --path /lego \
- --email mathias+certs@magnusson.space \
- "$@"
-}
-
-function dns() {
- [ -f "/lego/certificates/$1.key" ] && cmd="renew --no-random-sleep --days 45" || cmd=run
- cert --dns cloudflare $${@/#/-d=} $cmd
-}
-
-function http() {
- [ -f "/lego/certificates/$1.key" ] && cmd="renew --no-random-sleep --days 45" || cmd=run
- cert --http --http.port ":$NOMAD_PORT_http" $${@/#/-d=} $cmd
-}
-
-dns magnusson.space *.magnusson.space
-dns magnusson.wiki *.magnusson.wiki
-dns xn--srskildakommandorrelsegruppen-0pc88c.se *.xn--srskildakommandorrelsegruppen-0pc88c.se
-dns xn--hvd-sna.ing *.xn--hvd-sna.ing
-dns xn--frskr-ira7j.ing *.xn--frskr-ira7j.ing
-dns besiktn.ing *.besiktn.ing
-http dinlugnastund.se www.dinlugnastund.se
-http transfer.zip www.transfer.zip
-CLOUDFLARE_DNS_API_TOKEN=$CTFTAJM_TOKEN dns ctftajm.se *.ctftajm.se
-EOF
- destination = "local/certs.sh"
- }
-
- template {
- data = <<EOF
-{{ with nomadVar "nomad/jobs/certificates" }}
-CLOUDFLARE_DNS_API_TOKEN={{ .cloudflare_dns_api_token }}
-CTFTAJM_TOKEN={{ .cloudflare_dns_api_token_ctftajm }}
-{{ end }}
-EOF
- destination = "local/.env"
- env = true
- }
-
- artifact {
- source = "https://github.com/go-acme/lego/releases/download/v4.13.3/lego_v4.13.3_linux_amd64.tar.gz"
- }
- }
- }
-}