From 480c3ac20dcfaea1e54610c756a7ace2c3fb7671 Mon Sep 17 00:00:00 2001 From: Arsen Musayelyan Date: Thu, 4 May 2023 15:10:09 -0700 Subject: [PATCH] Add nomad template --- .woodpecker.yml | 11 +++++++- template.nomad | 71 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 template.nomad diff --git a/.woodpecker.yml b/.woodpecker.yml index 6721f43..1e2fe01 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -9,4 +9,13 @@ pipeline: tag: latest when: branch: public - event: push \ No newline at end of file + event: push + + deploy: + image: loq9/drone-nomad + settings: + addr: http://192.168.100.62:4646 + template: template.nomad + environment: + - PLUGIN_WATCH_DEPLOYMENT=true + - PLUGIN_WATCH_DEPLOYMENT_TIMEOUT=10m \ No newline at end of file diff --git a/template.nomad b/template.nomad new file mode 100644 index 0000000..59d451c --- /dev/null +++ b/template.nomad @@ -0,0 +1,71 @@ +job "lure-web" { + region = "global" + datacenters = ["dc1"] + type = "service" + + group "lure-web" { + network { + port "api" { + to = 8080 + } + + port "http" { + to = 3000 + } + } + + task "lure-api-server" { + driver = "docker" + + env { + LURE_API_GITHUB_SECRET = "${LURE_API_GITHUB_SECRET}" + + // Hack to force Nomad to re-deploy the service + // instead of ignoring it + COMMIT_SHA = "${DRONE_COMMIT_SHA}" + } + + config { + image = "arsen6331/lure-api-server:latest" + ports = ["api"] + } + + service { + name = "lure-api-server" + port = "api" + tags = [ + "traefik.enable=true", + "traefik.http.routers.lure-api-server.rule=Host(`api.lure.elara.ws`)", + "traefik.http.routers.lure-api-server.tls.certresolver=letsencrypt" + ] + + check { + type = "tcp" + port = "api" + interval = "30s" + timeout = "2s" + } + } + } + + task "lure-web" { + driver = "docker" + + config { + image = "elara6331/lure-web:latest" + ports = ["http"] + } + + + service { + name = "lure-web" + port = "http" + tags = [ + "traefik.enable=true", + "traefik.http.routers.lure-web.rule=Host(`lure.elara.ws`)", + "traefik.http.routers.lure-web.tls.certresolver=letsencrypt", + ] + } + } + } +}