chore(forgejo): remove consul service mesh to allow support for dind
All checks were successful
Lint / lint (push) Successful in 1m47s
Terraform Plan and Apply / cicd (push) Successful in 2m23s

This commit is contained in:
Ben Martin 2025-03-07 02:28:05 +00:00
parent b2978cb4ef
commit 70d58aede0
Signed by: ben
GPG key ID: 859A655FCD290E4A

View file

@ -6,9 +6,10 @@ job "forgejo" {
port "forgejo" { port "forgejo" {
to = 3000 to = 3000
} }
port "envoy_metrics" { port "websocket" {
to = 9102 to = 2375
} }
port "cache_server" {}
} }
task "forgejo" { task "forgejo" {
@ -17,6 +18,8 @@ job "forgejo" {
config { config {
image = "codeberg.org/forgejo/forgejo:10.0.1" image = "codeberg.org/forgejo/forgejo:10.0.1"
ports = ["forgejo"]
volumes = [ volumes = [
"/etc/timezone:/etc/timezone:ro", "/etc/timezone:/etc/timezone:ro",
"/etc/localtime:/etc/localtime:ro" "/etc/localtime:/etc/localtime:ro"
@ -37,49 +40,16 @@ job "forgejo" {
USER_UID = "1000" USER_UID = "1000"
USER_GID = "1000" USER_GID = "1000"
} }
}
volume "data" { service {
type = "csi" port = "forgejo"
read_only = false provider = "consul"
source = "martinibar_prod_forgejo_data" tags = [
attachment_mode = "file-system" "traefik.enable=true",
access_mode = "single-node-writer"
}
service { "traefik.http.routers.forgejo.entrypoints=websecure",
port = "3000" "traefik.http.routers.forgejo.rule=Host(`git.brmartin.co.uk`)"
provider = "consul" ]
meta {
envoy_metrics_port = "${NOMAD_HOST_PORT_envoy_metrics}"
}
connect {
sidecar_service {
proxy {
expose {
path {
path = "/metrics"
protocol = "http"
local_path_port = 9102
listener_port = "envoy_metrics"
}
}
transparent_proxy {}
}
}
}
}
}
group "runner" {
network {
mode = "bridge"
port "cache_server" {}
port "envoy_metrics" {
to = 9102
} }
} }
@ -94,7 +64,7 @@ job "forgejo" {
} }
volume_mount { volume_mount {
volume = "data" volume = "runner_data"
destination = "/data" destination = "/data"
} }
@ -121,16 +91,16 @@ job "forgejo" {
cache: cache:
enabled: true enabled: true
dir: "{{ env "NOMAD_TASK_DIR" }}/cache" dir: "{{ env "NOMAD_TASK_DIR" }}/cache"
host: "forgejo-runner.virtual.consul" host: "127.0.0.1"
port: {{ env "NOMAD_PORT_cache_server" }} port: {{ env "NOMAD_PORT_cache_server" }}
container: container:
network: "host" network: "host"
enable_ipv6: false enable_ipv6: false
privileged: true privileged: true
options: "" options: "-v /var/run/docker.sock:/var/run/docker.sock"
workdir_parent: workdir_parent:
valid_volumes: [] valid_volumes: ["/var/run/docker.sock"]
docker_host: "automount" docker_host: ""
force_pull: false force_pull: false
host: host:
workdir_parent: workdir_parent:
@ -140,60 +110,14 @@ job "forgejo" {
} }
env { env {
DOCKER_HOST = "tcp://forgejo-docker-in-docker.virtual.consul:2375" DOCKER_HOST = "tcp://127.0.0.1:2375"
}
}
volume "data" {
type = "csi"
read_only = false
source = "martinibar_prod_forgejo-runner_data"
attachment_mode = "file-system"
access_mode = "single-node-writer"
}
service {
port = "cache_server"
provider = "consul"
meta {
envoy_metrics_port = "${NOMAD_HOST_PORT_envoy_metrics}"
} }
connect { service {
sidecar_service { port = "cache_server"
proxy { provider = "consul"
expose {
path {
path = "/metrics"
protocol = "http"
local_path_port = 9102
listener_port = "envoy_metrics"
}
}
transparent_proxy {}
}
}
} }
} }
}
group "docker-in-docker" {
network {
mode = "bridge"
port "websocket" {
to = 2375
}
port "envoy_metrics" {
to = 9102
}
}
ephemeral_disk {
migrate = true
size = 10000
}
task "docker-in-docker" { task "docker-in-docker" {
driver = "docker" driver = "docker"
@ -203,7 +127,7 @@ job "forgejo" {
privileged = true privileged = true
command = "dockerd" command = "dockerd"
args = ["-H=tcp://127.0.0.1:2375", "--tls=false"] args = ["-H=tcp://0.0.0.0:2375", "-H=unix:///var/run/docker.sock", "--tls=false", "--default-address-pool=base=10.255.0.0/24,size=29"]
mount { mount {
type = "bind" type = "bind"
@ -217,66 +141,32 @@ job "forgejo" {
memory = 512 memory = 512
memory_max = 4096 memory_max = 4096
} }
}
service { service {
port = "2375" port = "websocket"
provider = "consul" provider = "consul"
meta {
envoy_metrics_port = "${NOMAD_HOST_PORT_envoy_metrics}"
}
connect {
sidecar_service {
proxy {
expose {
path {
path = "/metrics"
protocol = "http"
local_path_port = 9102
listener_port = "envoy_metrics"
}
}
transparent_proxy {}
}
}
}
}
}
group "forgejo-ingress-group" {
network {
mode = "bridge"
port "inbound" {
to = 8080
} }
} }
service { volume "data" {
port = "inbound" type = "csi"
tags = [ read_only = false
"traefik.enable=true", source = "martinibar_prod_forgejo_data"
attachment_mode = "file-system"
access_mode = "single-node-writer"
}
"traefik.http.routers.forgejo.entrypoints=websecure", volume "runner_data" {
"traefik.http.routers.forgejo.rule=Host(`git.brmartin.co.uk`)" type = "csi"
] read_only = false
source = "martinibar_prod_forgejo-runner_data"
attachment_mode = "file-system"
access_mode = "single-node-writer"
}
connect { ephemeral_disk {
gateway { migrate = true
ingress { size = 10000
listener {
port = 8080
protocol = "http"
service {
name = "forgejo-forgejo"
hosts = ["*"]
}
}
}
}
}
} }
} }
} }