Last active
February 4, 2023 15:53
-
-
Save Neutrollized/f6f9db79ef456931d9d5461dc7691076 to your computer and use it in GitHub Desktop.
Medium: Migrating off of Pivotal Cloud Foundry? Consider HashiCorp Nomad!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
locals { | |
membrane_version = "5.0.1" | |
} | |
job "membrane-proxy" { | |
datacenters = ["gcp-test"] | |
priority = 80 | |
group "membrane" { | |
network { | |
port "proxy" { static = 2000 } | |
} | |
task "proxy" { | |
driver = "java" | |
env { | |
MEMBRANE_HOME = "${NOMAD_TASK_DIR}/membrane-service-proxy-${local.membrane_version}" | |
} | |
# zip files (zip, tgz, bz2, xz) are automatically unzipped prior to task starting | |
artifact { | |
source = "https://github.com/membrane/service-proxy/releases/download/v${local.membrane_version}/membrane-service-proxy-${local.membrane_version}.zip" | |
destination = "local" | |
} | |
template { | |
destination = "${NOMAD_TASK_DIR}/proxies.xml" | |
change_mode = "restart" | |
data = <<EOF | |
<spring:beans xmlns="http://membrane-soa.org/proxies/1/" | |
xmlns:spring="http://www.springframework.org/schema/beans" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd http://membrane-soa.org/proxies/1/ http://membrane-soa.org/schemas/proxies-1.xsd"> | |
<serviceProxy port="{{ env "NOMAD_PORT_proxy" }}"> | |
{{- range nomadService "spring-backend" -}} | |
<target host="{{ .Address }}" port="{{ .Port}}"/> | |
{{- end -}} | |
</serviceProxy> | |
</router> | |
</spring:beans> | |
EOF | |
} | |
config { | |
class = "com.predic8.membrane.core.Starter" | |
class_path = "${MEMBRANE_HOME}/conf:${MEMBRANE_HOME}/starter.jar" | |
args = ["-c", "${NOMAD_TASK_DIR}/proxies.xml"] | |
} | |
service { | |
name = "membrane-proxy" | |
provider = "nomad" | |
port = "proxy" | |
tags = ["membrane-service-proxy", "${local.membrane_version}"] | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment