[ci skip] Add internal OSM routing services (OSRM foot, bicycle, OTP)
New osm-routing namespace with walking, cycling, and transit routing services for the real-estate-crawler. Internal-only (no public ingress).
This commit is contained in:
parent
5a81ce5774
commit
f04a072beb
3 changed files with 261 additions and 1 deletions
|
|
@ -149,7 +149,7 @@ locals {
|
||||||
"url", "excalidraw", "travel_blog", "dashy", "send", "ytdlp", "wealthfolio", "rybbit", "stirling-pdf",
|
"url", "excalidraw", "travel_blog", "dashy", "send", "ytdlp", "wealthfolio", "rybbit", "stirling-pdf",
|
||||||
"networking-toolbox", "navidrome", "freshrss", "forgejo", "tor-proxy", "real-estate-crawler", "n8n",
|
"networking-toolbox", "navidrome", "freshrss", "forgejo", "tor-proxy", "real-estate-crawler", "n8n",
|
||||||
"changedetection", "linkwarden", "matrix", "homepage", "meshcentral", "diun", "cyberchef", "ntfy", "ollama",
|
"changedetection", "linkwarden", "matrix", "homepage", "meshcentral", "diun", "cyberchef", "ntfy", "ollama",
|
||||||
"servarr", "jsoncrack", "paperless-ngx", "frigate", "audiobookshelf", "tandoor", "ebook2audiobook", "netbox", "speedtest", "resume", "freedify", "mcaptcha", "affine", "plotting-book", "whisper", "grampsweb"
|
"servarr", "jsoncrack", "paperless-ngx", "frigate", "audiobookshelf", "tandoor", "ebook2audiobook", "netbox", "speedtest", "resume", "freedify", "mcaptcha", "affine", "plotting-book", "whisper", "grampsweb", "osm-routing"
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
active_modules = distinct(flatten([
|
active_modules = distinct(flatten([
|
||||||
|
|
@ -905,6 +905,15 @@ module "real-estate-crawler" {
|
||||||
depends_on = [null_resource.core_services]
|
depends_on = [null_resource.core_services]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module "osm_routing" {
|
||||||
|
source = "./osm-routing"
|
||||||
|
for_each = contains(local.active_modules, "osm-routing") ? { osm-routing = true } : {}
|
||||||
|
tls_secret_name = var.tls_secret_name
|
||||||
|
tier = local.tiers.aux
|
||||||
|
|
||||||
|
depends_on = [null_resource.core_services]
|
||||||
|
}
|
||||||
|
|
||||||
module "tor-proxy" {
|
module "tor-proxy" {
|
||||||
source = "./tor-proxy"
|
source = "./tor-proxy"
|
||||||
for_each = contains(local.active_modules, "tor-proxy") ? { tor-proxy = true } : {}
|
for_each = contains(local.active_modules, "tor-proxy") ? { tor-proxy = true } : {}
|
||||||
|
|
|
||||||
227
modules/kubernetes/osm-routing/main.tf
Normal file
227
modules/kubernetes/osm-routing/main.tf
Normal file
|
|
@ -0,0 +1,227 @@
|
||||||
|
variable "tls_secret_name" {}
|
||||||
|
variable "tier" { type = string }
|
||||||
|
|
||||||
|
resource "kubernetes_namespace" "osm-routing" {
|
||||||
|
metadata {
|
||||||
|
name = "osm-routing"
|
||||||
|
labels = {
|
||||||
|
"istio-injection" : "disabled"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# --- OSRM Foot ---
|
||||||
|
resource "kubernetes_deployment" "osrm-foot" {
|
||||||
|
metadata {
|
||||||
|
name = "osrm-foot"
|
||||||
|
namespace = kubernetes_namespace.osm-routing.metadata[0].name
|
||||||
|
labels = {
|
||||||
|
app = "osrm-foot"
|
||||||
|
tier = var.tier
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spec {
|
||||||
|
replicas = 1
|
||||||
|
strategy {
|
||||||
|
type = "Recreate"
|
||||||
|
}
|
||||||
|
selector {
|
||||||
|
match_labels = {
|
||||||
|
app = "osrm-foot"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
template {
|
||||||
|
metadata {
|
||||||
|
labels = {
|
||||||
|
app = "osrm-foot"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spec {
|
||||||
|
container {
|
||||||
|
name = "osrm-foot"
|
||||||
|
image = "ghcr.io/project-osrm/osrm-backend:latest"
|
||||||
|
command = ["osrm-routed", "--algorithm", "MLD", "/data/foot/greater-london-latest.osrm"]
|
||||||
|
port {
|
||||||
|
name = "http"
|
||||||
|
container_port = 5000
|
||||||
|
protocol = "TCP"
|
||||||
|
}
|
||||||
|
volume_mount {
|
||||||
|
name = "osrm-data"
|
||||||
|
mount_path = "/data"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
volume {
|
||||||
|
name = "osrm-data"
|
||||||
|
nfs {
|
||||||
|
server = "10.0.10.15"
|
||||||
|
path = "/mnt/main/osm-routing/osrm-data"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "kubernetes_service" "osrm-foot" {
|
||||||
|
metadata {
|
||||||
|
name = "osrm-foot"
|
||||||
|
namespace = kubernetes_namespace.osm-routing.metadata[0].name
|
||||||
|
labels = {
|
||||||
|
app = "osrm-foot"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spec {
|
||||||
|
selector = {
|
||||||
|
app = "osrm-foot"
|
||||||
|
}
|
||||||
|
port {
|
||||||
|
port = 5000
|
||||||
|
target_port = 5000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# --- OSRM Bicycle ---
|
||||||
|
resource "kubernetes_deployment" "osrm-bicycle" {
|
||||||
|
metadata {
|
||||||
|
name = "osrm-bicycle"
|
||||||
|
namespace = kubernetes_namespace.osm-routing.metadata[0].name
|
||||||
|
labels = {
|
||||||
|
app = "osrm-bicycle"
|
||||||
|
tier = var.tier
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spec {
|
||||||
|
replicas = 1
|
||||||
|
strategy {
|
||||||
|
type = "Recreate"
|
||||||
|
}
|
||||||
|
selector {
|
||||||
|
match_labels = {
|
||||||
|
app = "osrm-bicycle"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
template {
|
||||||
|
metadata {
|
||||||
|
labels = {
|
||||||
|
app = "osrm-bicycle"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spec {
|
||||||
|
container {
|
||||||
|
name = "osrm-bicycle"
|
||||||
|
image = "ghcr.io/project-osrm/osrm-backend:latest"
|
||||||
|
command = ["osrm-routed", "--algorithm", "MLD", "/data/bicycle/greater-london-latest.osrm"]
|
||||||
|
port {
|
||||||
|
name = "http"
|
||||||
|
container_port = 5000
|
||||||
|
protocol = "TCP"
|
||||||
|
}
|
||||||
|
volume_mount {
|
||||||
|
name = "osrm-data"
|
||||||
|
mount_path = "/data"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
volume {
|
||||||
|
name = "osrm-data"
|
||||||
|
nfs {
|
||||||
|
server = "10.0.10.15"
|
||||||
|
path = "/mnt/main/osm-routing/osrm-data"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "kubernetes_service" "osrm-bicycle" {
|
||||||
|
metadata {
|
||||||
|
name = "osrm-bicycle"
|
||||||
|
namespace = kubernetes_namespace.osm-routing.metadata[0].name
|
||||||
|
labels = {
|
||||||
|
app = "osrm-bicycle"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spec {
|
||||||
|
selector = {
|
||||||
|
app = "osrm-bicycle"
|
||||||
|
}
|
||||||
|
port {
|
||||||
|
port = 5000
|
||||||
|
target_port = 5000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# --- OTP (OpenTripPlanner) ---
|
||||||
|
resource "kubernetes_deployment" "otp" {
|
||||||
|
metadata {
|
||||||
|
name = "otp"
|
||||||
|
namespace = kubernetes_namespace.osm-routing.metadata[0].name
|
||||||
|
labels = {
|
||||||
|
app = "otp"
|
||||||
|
tier = var.tier
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spec {
|
||||||
|
replicas = 1
|
||||||
|
strategy {
|
||||||
|
type = "Recreate"
|
||||||
|
}
|
||||||
|
selector {
|
||||||
|
match_labels = {
|
||||||
|
app = "otp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
template {
|
||||||
|
metadata {
|
||||||
|
labels = {
|
||||||
|
app = "otp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spec {
|
||||||
|
container {
|
||||||
|
name = "otp"
|
||||||
|
image = "opentripplanner/opentripplanner:2.6.0"
|
||||||
|
args = ["--build", "--save"]
|
||||||
|
port {
|
||||||
|
name = "http"
|
||||||
|
container_port = 8080
|
||||||
|
protocol = "TCP"
|
||||||
|
}
|
||||||
|
volume_mount {
|
||||||
|
name = "otp-data"
|
||||||
|
mount_path = "/var/opentripplanner"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
volume {
|
||||||
|
name = "otp-data"
|
||||||
|
nfs {
|
||||||
|
server = "10.0.10.15"
|
||||||
|
path = "/mnt/main/osm-routing/otp-data"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "kubernetes_service" "otp" {
|
||||||
|
metadata {
|
||||||
|
name = "otp"
|
||||||
|
namespace = kubernetes_namespace.osm-routing.metadata[0].name
|
||||||
|
labels = {
|
||||||
|
app = "otp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spec {
|
||||||
|
selector = {
|
||||||
|
app = "otp"
|
||||||
|
}
|
||||||
|
port {
|
||||||
|
port = 8080
|
||||||
|
target_port = 8080
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -159,6 +159,18 @@ resource "kubernetes_deployment" "realestate-crawler-api" {
|
||||||
name = "UVICORN_LOG_LEVEL"
|
name = "UVICORN_LOG_LEVEL"
|
||||||
value = "debug"
|
value = "debug"
|
||||||
}
|
}
|
||||||
|
env {
|
||||||
|
name = "OSRM_FOOT_URL"
|
||||||
|
value = "http://osrm-foot.osm-routing.svc.cluster.local:5000"
|
||||||
|
}
|
||||||
|
env {
|
||||||
|
name = "OSRM_BICYCLE_URL"
|
||||||
|
value = "http://osrm-bicycle.osm-routing.svc.cluster.local:5000"
|
||||||
|
}
|
||||||
|
env {
|
||||||
|
name = "OTP_URL"
|
||||||
|
value = "http://otp.osm-routing.svc.cluster.local:8080"
|
||||||
|
}
|
||||||
env {
|
env {
|
||||||
name = "SLACK_WEBHOOK_URL"
|
name = "SLACK_WEBHOOK_URL"
|
||||||
value = var.notification_settings["slack"]
|
value = var.notification_settings["slack"]
|
||||||
|
|
@ -325,6 +337,18 @@ resource "kubernetes_deployment" "realestate-crawler-celery" {
|
||||||
name = "SLACK_WEBHOOK_URL"
|
name = "SLACK_WEBHOOK_URL"
|
||||||
value = lookup(var.notification_settings, "slack", "")
|
value = lookup(var.notification_settings, "slack", "")
|
||||||
}
|
}
|
||||||
|
env {
|
||||||
|
name = "OSRM_FOOT_URL"
|
||||||
|
value = "http://osrm-foot.osm-routing.svc.cluster.local:5000"
|
||||||
|
}
|
||||||
|
env {
|
||||||
|
name = "OSRM_BICYCLE_URL"
|
||||||
|
value = "http://osrm-bicycle.osm-routing.svc.cluster.local:5000"
|
||||||
|
}
|
||||||
|
env {
|
||||||
|
name = "OTP_URL"
|
||||||
|
value = "http://otp.osm-routing.svc.cluster.local:8080"
|
||||||
|
}
|
||||||
volume_mount {
|
volume_mount {
|
||||||
name = "data"
|
name = "data"
|
||||||
mount_path = "/app/data"
|
mount_path = "/app/data"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue