Deploy job was fixed. Workflow was fixed.
This commit is contained in:
parent
605c0d68bd
commit
1ae14536e6
4 changed files with 41 additions and 29 deletions
|
|
@ -35,7 +35,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
run: |
|
run: |
|
||||||
apk add --no-cache git
|
apk add --no-cache git gettext
|
||||||
git init -q .
|
git init -q .
|
||||||
git remote add origin ${{ github.server_url }}/${{ github.repository }}.git
|
git remote add origin ${{ github.server_url }}/${{ github.repository }}.git
|
||||||
git fetch --depth 1 origin ${{ github.sha }}
|
git fetch --depth 1 origin ${{ github.sha }}
|
||||||
|
|
@ -89,8 +89,11 @@ jobs:
|
||||||
--entrypoint /bin/nomad \
|
--entrypoint /bin/nomad \
|
||||||
hashicorp/nomad:1.9 job run /tmp/job.hcl
|
hashicorp/nomad:1.9 job run /tmp/job.hcl
|
||||||
|
|
||||||
|
# render ${IMAGE_TAG} via envsubst, then cp into the nomad container
|
||||||
|
IMAGE_TAG="${{ github.sha }}" envsubst < deploy/nomad/contract-check.nomad.hcl > /tmp/job.hcl
|
||||||
|
|
||||||
docker cp .ci-tls/ca.crt nomad-deploy:/tmp/ca.crt
|
docker cp .ci-tls/ca.crt nomad-deploy:/tmp/ca.crt
|
||||||
docker cp deploy/nomad/contract-check.nomad.hcl nomad-deploy:/tmp/job.hcl
|
docker cp /tmp/job.hcl nomad-deploy:/tmp/job.hcl
|
||||||
|
|
||||||
docker start -a nomad-deploy
|
docker start -a nomad-deploy
|
||||||
rc=$?
|
rc=$?
|
||||||
|
|
|
||||||
8
Makefile
8
Makefile
|
|
@ -306,16 +306,16 @@ shell-bot: ## Open shell inside bot container
|
||||||
# CLI env (NOMAD_ADDR/CACERT/TOKEN) is sourced from /root/.nomadrc on the VPS.
|
# CLI env (NOMAD_ADDR/CACERT/TOKEN) is sourced from /root/.nomadrc on the VPS.
|
||||||
# ─────────────────────────────────────────────────────────────────────────────
|
# ─────────────────────────────────────────────────────────────────────────────
|
||||||
NOMAD_JOB := deploy/nomad/contract-check.nomad.hcl
|
NOMAD_JOB := deploy/nomad/contract-check.nomad.hcl
|
||||||
NOMAD_RUN := bash -c '. /root/.nomadrc 2>/dev/null; IMAGE_TAG=$${IMAGE_TAG:-manual} nomad "$$@"' --
|
NOMAD_RUN := bash -c '. /root/.nomadrc 2>/dev/null; IMAGE_TAG=$${IMAGE_TAG:-manual} envsubst < $(NOMAD_JOB) | nomad "$$@"' --
|
||||||
|
|
||||||
nomad-validate: ## Validate the Nomad job file
|
nomad-validate: ## Validate the Nomad job file
|
||||||
@$(NOMAD_RUN) job validate $(NOMAD_JOB)
|
@$(NOMAD_RUN) job validate -
|
||||||
|
|
||||||
nomad-plan: ## Dry-run diff of the next deployment
|
nomad-plan: ## Dry-run diff of the next deployment
|
||||||
@$(NOMAD_RUN) job plan $(NOMAD_JOB)
|
@$(NOMAD_RUN) job plan -
|
||||||
|
|
||||||
nomad-deploy: ## Deploy to Nomad (usage: IMAGE_TAG=<git-sha> make nomad-deploy)
|
nomad-deploy: ## Deploy to Nomad (usage: IMAGE_TAG=<git-sha> make nomad-deploy)
|
||||||
@$(NOMAD_RUN) job run $(NOMAD_JOB)
|
@$(NOMAD_RUN) job run -
|
||||||
|
|
||||||
nomad-status: ## Job status: groups, allocations, deployments
|
nomad-status: ## Job status: groups, allocations, deployments
|
||||||
@$(NOMAD_RUN) job status contract-check
|
@$(NOMAD_RUN) job status contract-check
|
||||||
|
|
|
||||||
|
|
@ -273,13 +273,20 @@ ssh -L 4646:127.0.0.1:4646 <vps>
|
||||||
|
|
||||||
## 8. Everyday operations
|
## 8. Everyday operations
|
||||||
|
|
||||||
First submission (the job file requires IMAGE_TAG — it is rendered by the
|
First submission (the job file uses `${IMAGE_TAG}` — rendered by `envsubst`
|
||||||
CLI at submit time; CI exports it automatically):
|
at submit time; CI does this automatically):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
IMAGE_TAG=<git-sha> nomad job validate deploy/nomad/contract-check.nomad.hcl
|
IMAGE_TAG=<git-sha> envsubst < deploy/nomad/contract-check.nomad.hcl | nomad job validate -
|
||||||
IMAGE_TAG=<git-sha> nomad job plan deploy/nomad/contract-check.nomad.hcl
|
IMAGE_TAG=<git-sha> envsubst < deploy/nomad/contract-check.nomad.hcl | nomad job plan -
|
||||||
IMAGE_TAG=<git-sha> nomad job run deploy/nomad/contract-check.nomad.hcl
|
IMAGE_TAG=<git-sha> envsubst < deploy/nomad/contract-check.nomad.hcl | nomad job run -
|
||||||
|
```
|
||||||
|
|
||||||
|
Or via Makefile (handles envsubst + nomad env automatically):
|
||||||
|
```bash
|
||||||
|
IMAGE_TAG=<git-sha> make nomad-validate
|
||||||
|
IMAGE_TAG=<git-sha> make nomad-plan
|
||||||
|
IMAGE_TAG=<git-sha> make nomad-deploy
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,13 @@
|
||||||
# (15432/17379/5672/9000). The nginx edge cascade is unchanged.
|
# (15432/17379/5672/9000). The nginx edge cascade is unchanged.
|
||||||
#
|
#
|
||||||
# Secrets flow (nothing sensitive lives in this file):
|
# Secrets flow (nothing sensitive lives in this file):
|
||||||
# - registry creds + all app secrets → Nomad Variables at
|
# - app secrets + connection strings → Nomad Variables at
|
||||||
# nomad/jobs/contract-check (see deploy/nomad/README.md §5), rendered
|
# nomad/jobs/contract-check (see deploy/nomad/README.md §5), rendered
|
||||||
# agent-side into env / auth files by `template` blocks;
|
# agent-side into env by `template` blocks;
|
||||||
# - image tag is injected CLI-side at submit time:
|
# - image tag + APP_VERSION use ${IMAGE_TAG}, rendered by `envsubst` at
|
||||||
# IMAGE_TAG=<git-sha> nomad job run deploy/nomad/contract-check.nomad.hcl
|
# submit time:
|
||||||
|
# IMAGE_TAG=<git-sha> envsubst < deploy/nomad/contract-check.nomad.hcl | nomad job run -
|
||||||
|
# - registry auth: host-level `docker login` on the VPS (README §5).
|
||||||
#
|
#
|
||||||
# First deploy: verify with `nomad job validate` + `nomad job plan`, then
|
# First deploy: verify with `nomad job validate` + `nomad job plan`, then
|
||||||
# cutover workers one by one (README / docs/DEPLOY.md §15).
|
# cutover workers one by one (README / docs/DEPLOY.md §15).
|
||||||
|
|
@ -81,7 +83,7 @@ job "contract-check" {
|
||||||
driver = "docker"
|
driver = "docker"
|
||||||
|
|
||||||
config {
|
config {
|
||||||
image = "p2gnl.mu-dungeon.xyz/admin-git/contract-check-api:{{ mustEnv \"IMAGE_TAG\" }}"
|
image = "p2gnl.mu-dungeon.xyz/admin-git/contract-check-api:${IMAGE_TAG}"
|
||||||
args = ["alembic", "upgrade", "head"]
|
args = ["alembic", "upgrade", "head"]
|
||||||
|
|
||||||
# registry auth: host-level `docker login` on the VPS (README §5)
|
# registry auth: host-level `docker login` on the VPS (README §5)
|
||||||
|
|
@ -108,7 +110,7 @@ job "contract-check" {
|
||||||
driver = "docker"
|
driver = "docker"
|
||||||
|
|
||||||
config {
|
config {
|
||||||
image = "p2gnl.mu-dungeon.xyz/admin-git/contract-check-api:{{ mustEnv \"IMAGE_TAG\" }}"
|
image = "p2gnl.mu-dungeon.xyz/admin-git/contract-check-api:${IMAGE_TAG}"
|
||||||
ports = ["http"]
|
ports = ["http"]
|
||||||
|
|
||||||
# registry auth: host-level `docker login` on the VPS (README §5)
|
# registry auth: host-level `docker login` on the VPS (README §5)
|
||||||
|
|
@ -118,7 +120,7 @@ job "contract-check" {
|
||||||
ENV = "prod"
|
ENV = "prod"
|
||||||
LOG_LEVEL = "INFO"
|
LOG_LEVEL = "INFO"
|
||||||
LOG_FORMAT = "json"
|
LOG_FORMAT = "json"
|
||||||
APP_VERSION = "{{ env \"IMAGE_TAG\" }}"
|
APP_VERSION = "${IMAGE_TAG}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# All connection strings + app secrets, agent-rendered from Nomad
|
# All connection strings + app secrets, agent-rendered from Nomad
|
||||||
|
|
@ -182,7 +184,7 @@ job "contract-check" {
|
||||||
driver = "docker"
|
driver = "docker"
|
||||||
|
|
||||||
config {
|
config {
|
||||||
image = "p2gnl.mu-dungeon.xyz/admin-git/contract-check-worker-extract:{{ mustEnv \"IMAGE_TAG\" }}"
|
image = "p2gnl.mu-dungeon.xyz/admin-git/contract-check-worker-extract:${IMAGE_TAG}"
|
||||||
|
|
||||||
# registry auth: host-level `docker login` on the VPS (README §5)
|
# registry auth: host-level `docker login` on the VPS (README §5)
|
||||||
}
|
}
|
||||||
|
|
@ -191,7 +193,7 @@ job "contract-check" {
|
||||||
ENV = "prod"
|
ENV = "prod"
|
||||||
LOG_LEVEL = "INFO"
|
LOG_LEVEL = "INFO"
|
||||||
LOG_FORMAT = "json"
|
LOG_FORMAT = "json"
|
||||||
APP_VERSION = "{{ env \"IMAGE_TAG\" }}"
|
APP_VERSION = "${IMAGE_TAG}"
|
||||||
}
|
}
|
||||||
|
|
||||||
template {
|
template {
|
||||||
|
|
@ -241,7 +243,7 @@ job "contract-check" {
|
||||||
driver = "docker"
|
driver = "docker"
|
||||||
|
|
||||||
config {
|
config {
|
||||||
image = "p2gnl.mu-dungeon.xyz/admin-git/contract-check-worker-analyze:{{ mustEnv \"IMAGE_TAG\" }}"
|
image = "p2gnl.mu-dungeon.xyz/admin-git/contract-check-worker-analyze:${IMAGE_TAG}"
|
||||||
|
|
||||||
# registry auth: host-level `docker login` on the VPS (README §5)
|
# registry auth: host-level `docker login` on the VPS (README §5)
|
||||||
}
|
}
|
||||||
|
|
@ -250,7 +252,7 @@ job "contract-check" {
|
||||||
ENV = "prod"
|
ENV = "prod"
|
||||||
LOG_LEVEL = "INFO"
|
LOG_LEVEL = "INFO"
|
||||||
LOG_FORMAT = "json"
|
LOG_FORMAT = "json"
|
||||||
APP_VERSION = "{{ env \"IMAGE_TAG\" }}"
|
APP_VERSION = "${IMAGE_TAG}"
|
||||||
}
|
}
|
||||||
|
|
||||||
template {
|
template {
|
||||||
|
|
@ -300,7 +302,7 @@ job "contract-check" {
|
||||||
driver = "docker"
|
driver = "docker"
|
||||||
|
|
||||||
config {
|
config {
|
||||||
image = "p2gnl.mu-dungeon.xyz/admin-git/contract-check-worker-prescreen:{{ mustEnv \"IMAGE_TAG\" }}"
|
image = "p2gnl.mu-dungeon.xyz/admin-git/contract-check-worker-prescreen:${IMAGE_TAG}"
|
||||||
|
|
||||||
# registry auth: host-level `docker login` on the VPS (README §5)
|
# registry auth: host-level `docker login` on the VPS (README §5)
|
||||||
}
|
}
|
||||||
|
|
@ -309,7 +311,7 @@ job "contract-check" {
|
||||||
ENV = "prod"
|
ENV = "prod"
|
||||||
LOG_LEVEL = "INFO"
|
LOG_LEVEL = "INFO"
|
||||||
LOG_FORMAT = "json"
|
LOG_FORMAT = "json"
|
||||||
APP_VERSION = "{{ env \"IMAGE_TAG\" }}"
|
APP_VERSION = "${IMAGE_TAG}"
|
||||||
}
|
}
|
||||||
|
|
||||||
template {
|
template {
|
||||||
|
|
@ -358,7 +360,7 @@ job "contract-check" {
|
||||||
driver = "docker"
|
driver = "docker"
|
||||||
|
|
||||||
config {
|
config {
|
||||||
image = "p2gnl.mu-dungeon.xyz/admin-git/contract-check-worker-billing:{{ mustEnv \"IMAGE_TAG\" }}"
|
image = "p2gnl.mu-dungeon.xyz/admin-git/contract-check-worker-billing:${IMAGE_TAG}"
|
||||||
|
|
||||||
# registry auth: host-level `docker login` on the VPS (README §5)
|
# registry auth: host-level `docker login` on the VPS (README §5)
|
||||||
}
|
}
|
||||||
|
|
@ -367,7 +369,7 @@ job "contract-check" {
|
||||||
ENV = "prod"
|
ENV = "prod"
|
||||||
LOG_LEVEL = "INFO"
|
LOG_LEVEL = "INFO"
|
||||||
LOG_FORMAT = "json"
|
LOG_FORMAT = "json"
|
||||||
APP_VERSION = "{{ env \"IMAGE_TAG\" }}"
|
APP_VERSION = "${IMAGE_TAG}"
|
||||||
}
|
}
|
||||||
|
|
||||||
template {
|
template {
|
||||||
|
|
@ -410,7 +412,7 @@ job "contract-check" {
|
||||||
driver = "docker"
|
driver = "docker"
|
||||||
|
|
||||||
config {
|
config {
|
||||||
image = "p2gnl.mu-dungeon.xyz/admin-git/contract-check-worker-notify:{{ mustEnv \"IMAGE_TAG\" }}"
|
image = "p2gnl.mu-dungeon.xyz/admin-git/contract-check-worker-notify:${IMAGE_TAG}"
|
||||||
|
|
||||||
# registry auth: host-level `docker login` on the VPS (README §5)
|
# registry auth: host-level `docker login` on the VPS (README §5)
|
||||||
}
|
}
|
||||||
|
|
@ -419,7 +421,7 @@ job "contract-check" {
|
||||||
ENV = "prod"
|
ENV = "prod"
|
||||||
LOG_LEVEL = "INFO"
|
LOG_LEVEL = "INFO"
|
||||||
LOG_FORMAT = "json"
|
LOG_FORMAT = "json"
|
||||||
APP_VERSION = "{{ env \"IMAGE_TAG\" }}"
|
APP_VERSION = "${IMAGE_TAG}"
|
||||||
}
|
}
|
||||||
|
|
||||||
template {
|
template {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue