Blue Green
Some checks failed
Build, Push, and Blue/Green Deploy to Nomad / docker-nomad (push) Failing after 7s

This commit is contained in:
Henrik Jess
2024-12-20 10:35:54 +01:00
parent 459f51808f
commit 1b047a74fd
3 changed files with 53 additions and 10 deletions

View File

@@ -1,16 +1,60 @@
job "lifefaq-blue" {
group "app" {
task "lifefaq" {
region = "global"
datacenters = ["dc1"]
type = "service"
update {
stagger = "60s"
max_parallel = 1
progress_deadline = "6m"
}
group "lifefaq-blue-group" {
count = 1
network {
port "port-app" {
to = 9212 # Internal application port
}
}
# Register the service with Consul
service {
provider = "consul"
name = "lifefaq-blue"
port = "port-app"
# Traefik-specific tags for routing
tags = [
"PORT=${NOMAD_PORT_port-app}"
]
# Define a health check using TCP
check {
name = "tcp_check"
type = "tcp"
interval = "10s"
timeout = "2s"
}
}
task "lifefaq-blue-task" {
driver = "docker"
config {
image = "registry.i80.dk/gitea/lifefaq:latest"
ports = ["port-app"]
}
env {
APP_ENV = "production"
PORT = "${NOMAD_PORT_port-app}"
}
resources {
cpu = 500
memory = 256
cpu = 250
memory = 80
}
}
}
}
}

View File

@@ -14,7 +14,7 @@ job "lifefaq" {
network {
port "port-app" {
to = 9210 # Internal application port
to = 0 # Internal application port
}
}
@@ -47,8 +47,7 @@ job "lifefaq" {
}
env {
APP_ENV = "production"
PORT = "${NOMAD_PORT_port-app}"
APP_ENV = "production" PORT = "${NOMAD_PORT_port-app}"
}
resources {

View File

@@ -14,7 +14,7 @@ RUN pip install --no-cache-dir -r requirements.txt
COPY . .
# Expose the port the FastAPI app runs on (default Uvicorn port)
EXPOSE 9210
EXPOSE 9212
# Command to run the FastAPI application
CMD ["uvicorn", "app.main:app", "--proxy-headers", "--host", "0.0.0.0", "--port", "9210", "--workers", "1"]
CMD ["uvicorn", "app.main:app", "--proxy-headers", "--host", "0.0.0.0", "--port", "9212", "--workers", "1"]