The mesh-route-adapter container goes with its Dockerfile and build bases. The step runs node on the bundle as a run-once process, reading what the mesh contributed and its config where the mesh writes them and writing the proxy's dynamic directory at the path the container used to mount; it still runs again when a route or its config changes.
81 lines
1.6 KiB
JSON
81 lines
1.6 KiB
JSON
{
|
|
"module": "route-adapter",
|
|
"version": "1",
|
|
"slug": "radapt",
|
|
"capabilities": [
|
|
"container-runtime"
|
|
],
|
|
"provides": [
|
|
{
|
|
"name": "route",
|
|
"scope": "mesh"
|
|
}
|
|
],
|
|
"serves": {
|
|
"route": {}
|
|
},
|
|
"receives": {
|
|
"route": "${dir:routes-dir}/mesh.json"
|
|
},
|
|
"accesses": [
|
|
{
|
|
"id": "dynamic",
|
|
"path": "/services/traefik/dynamic",
|
|
"mode": "read-write"
|
|
}
|
|
],
|
|
"resources": [
|
|
{
|
|
"id": "state",
|
|
"type": "directory",
|
|
"mode": "0700",
|
|
"place": "."
|
|
},
|
|
{
|
|
"id": "routes-dir",
|
|
"type": "directory",
|
|
"path": "/var/lib/route-adapter/routes",
|
|
"mode": "0700"
|
|
},
|
|
{
|
|
"id": "config",
|
|
"type": "file",
|
|
"path": "${dir:state}/config.json",
|
|
"merge": "json",
|
|
"mode": "0644",
|
|
"content": "{\n \"dynamic\": \"/services/traefik/dynamic\",\n \"entrypoint\": \"websecure\",\n \"certificate-resolver\": \"le\",\n \"machine\": \"host.docker.internal\"\n}\n"
|
|
},
|
|
{
|
|
"id": "adapt",
|
|
"type": "process",
|
|
"name": "route-adapter",
|
|
"artifact": "code",
|
|
"run": [
|
|
"node",
|
|
"index.js"
|
|
],
|
|
"run-once": true,
|
|
"env": {
|
|
"MESH_RECEIVES": "${dir:routes-dir}/mesh.json",
|
|
"MESH_ROUTE_ADAPTER_CONFIG": "${dir:state}/config.json"
|
|
},
|
|
"restart-on": [
|
|
"received-route",
|
|
"config"
|
|
]
|
|
}
|
|
],
|
|
"build": {
|
|
"artifacts": [
|
|
{
|
|
"name": "code",
|
|
"kind": "bundle",
|
|
"language": "typescript",
|
|
"entrypoints": [
|
|
"index.js"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|