diff --git a/.gitea/workflows/nomad-blue.hcl b/.gitea/workflows/nomad-blue.hcl index 262f547..0bb60b1 100644 --- a/.gitea/workflows/nomad-blue.hcl +++ b/.gitea/workflows/nomad-blue.hcl @@ -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 } } } -} \ No newline at end of file +} diff --git a/.gitea/workflows/nomad-job.hcl b/.gitea/workflows/nomad-job.hcl index e37f6c1..ffc3b45 100644 --- a/.gitea/workflows/nomad-job.hcl +++ b/.gitea/workflows/nomad-job.hcl @@ -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 { diff --git a/Dockerfile b/Dockerfile index 0f27692..6e7a4b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] \ No newline at end of file +CMD ["uvicorn", "app.main:app", "--proxy-headers", "--host", "0.0.0.0", "--port", "9212", "--workers", "1"] \ No newline at end of file