Add deployment pipeline, Dockerfile, Nomad spec and tests
Some checks failed
Build and Deploy PunktFri / build-and-deploy (push) Has been cancelled
Some checks failed
Build and Deploy PunktFri / build-and-deploy (push) Has been cancelled
- Dockerfile: python:3.12-slim + gunicorn, dynamic port, BUILD_VERSION args - punktfri.nomad: Traefik routing for punktfri.i80.dk, host volume for SQLite - .gitea/workflows/deploy.yml: build/push to Harbor, deploy to Nomad - Makefile: install/run/test/build targets - tests/test_app.py: 9 pytest tests covering all routes and validation - requirements.txt: add gunicorn - requirements-dev.txt: pytest - app.py: health endpoint returns version/commit info
This commit is contained in:
110
punktfri.nomad
Normal file
110
punktfri.nomad
Normal file
@@ -0,0 +1,110 @@
|
||||
job "punktfri" {
|
||||
region = "global"
|
||||
datacenters = ["dc1"]
|
||||
type = "service"
|
||||
|
||||
update {
|
||||
stagger = "30s"
|
||||
max_parallel = 1
|
||||
canary = 1
|
||||
min_healthy_time = "10s"
|
||||
healthy_deadline = "5m"
|
||||
auto_revert = true
|
||||
auto_promote = true
|
||||
progress_deadline = "10m"
|
||||
}
|
||||
|
||||
group "punktfri" {
|
||||
count = 1
|
||||
|
||||
constraint {
|
||||
attribute = "${node.unique.name}"
|
||||
value = "autobox.i80.dk"
|
||||
}
|
||||
|
||||
network {
|
||||
port "http" {}
|
||||
}
|
||||
|
||||
reschedule {
|
||||
attempts = 5
|
||||
interval = "10m"
|
||||
delay = "30s"
|
||||
delay_function = "exponential"
|
||||
max_delay = "120s"
|
||||
unlimited = false
|
||||
}
|
||||
|
||||
volume "punktfri-data" {
|
||||
type = "host"
|
||||
source = "punktfri-data"
|
||||
read_only = false
|
||||
}
|
||||
|
||||
service {
|
||||
provider = "consul"
|
||||
name = "punktfri"
|
||||
port = "http"
|
||||
|
||||
tags = [
|
||||
"traefik.enable=true",
|
||||
"traefik.http.routers.punktfri.rule=Host(`punktfri.i80.dk`)",
|
||||
"traefik.http.routers.punktfri.tls=true"
|
||||
]
|
||||
|
||||
canary_tags = [
|
||||
"traefik.enable=false"
|
||||
]
|
||||
|
||||
check {
|
||||
name = "http_health_check"
|
||||
type = "http"
|
||||
path = "/health"
|
||||
interval = "10s"
|
||||
timeout = "5s"
|
||||
|
||||
check_restart {
|
||||
limit = 3
|
||||
grace = "10s"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task "web" {
|
||||
driver = "docker"
|
||||
|
||||
volume_mount {
|
||||
volume = "punktfri-data"
|
||||
destination = "/app/instance"
|
||||
read_only = false
|
||||
}
|
||||
|
||||
config {
|
||||
image = "registry.i80.dk/gitea/punktfri:latest"
|
||||
ports = ["http"]
|
||||
force_pull = true
|
||||
}
|
||||
|
||||
restart {
|
||||
attempts = 10
|
||||
interval = "10m"
|
||||
delay = "10s"
|
||||
mode = "fail"
|
||||
}
|
||||
|
||||
env {
|
||||
APP_ENV = "production"
|
||||
PORT = "${NOMAD_PORT_http}"
|
||||
HOST = "0.0.0.0"
|
||||
DATABASE = "/app/instance/punktfri.db"
|
||||
LOG_FILE = "/app/instance/signups.log"
|
||||
TZ = "Europe/Copenhagen"
|
||||
}
|
||||
|
||||
resources {
|
||||
cpu = 200
|
||||
memory = 256
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user