The mesh-catalog container goes with its Dockerfile, build bases, bus credential and mesh-state directory. Its words are the database URL file where the mesh writes it. `pg` is a dependency in its package.json, which the builder now installs and inlines into the bundle (mesh-controller: a TypeScript bundle installs its module's own packages). `prepares: true` needs a container running the module's own artifact, so it becomes what ADR 0198 §3 says it is: prepare/index.js run by node as a run-once process, with the same words and no bus, before the runtime is started with the version that needs it, and again when the database URL changes.
92 lines
1.8 KiB
JSON
92 lines
1.8 KiB
JSON
{
|
|
"module": "mesh-catalog",
|
|
"slug": "catalog",
|
|
"version": "1",
|
|
"capabilities": [
|
|
"container-runtime"
|
|
],
|
|
"claims": [
|
|
{
|
|
"name": "mesh-catalog",
|
|
"scope": "mesh"
|
|
}
|
|
],
|
|
"requires": [
|
|
"postgres-database"
|
|
],
|
|
"contributes": {
|
|
"postgres-database": {
|
|
"name": "mesh_catalog"
|
|
}
|
|
},
|
|
"binds": {
|
|
"postgres-database": "${dir:state}/database.json"
|
|
},
|
|
"secrets": {
|
|
"postgres-database": "${dir:state}/database.secret"
|
|
},
|
|
"consumes": [
|
|
"mesh-build-machine.built",
|
|
"mesh-controller.built-before"
|
|
],
|
|
"emits": [
|
|
"registered",
|
|
"upgraded",
|
|
"rebuild-needed",
|
|
"catching-up"
|
|
],
|
|
"resources": [
|
|
{
|
|
"id": "state",
|
|
"type": "directory",
|
|
"mode": "0700",
|
|
"place": "."
|
|
},
|
|
{
|
|
"id": "database-url",
|
|
"type": "file",
|
|
"path": "${dir:state}/database.url",
|
|
"mode": "0600",
|
|
"content": "postgresql://${bound:postgres-database:as}:${secret:postgres-database}@${bound:postgres-database:at}:${bound:postgres-database:port}/${bound:postgres-database:as}\n"
|
|
},
|
|
{
|
|
"id": "prepare",
|
|
"type": "process",
|
|
"name": "mesh-catalog-prepare",
|
|
"artifact": "code",
|
|
"run": [
|
|
"node",
|
|
"prepare/index.js"
|
|
],
|
|
"run-once": true,
|
|
"env": {
|
|
"DATABASE_URL_FILE": "${dir:state}/database.url"
|
|
},
|
|
"restart-on": [
|
|
"database-url"
|
|
]
|
|
}
|
|
],
|
|
"build": {
|
|
"artifacts": [
|
|
{
|
|
"name": "code",
|
|
"kind": "bundle",
|
|
"language": "typescript",
|
|
"entrypoints": [
|
|
"index.js",
|
|
"tools/index.js",
|
|
"prepare/index.js"
|
|
],
|
|
"loads": [
|
|
"index.js",
|
|
"tools/index.js"
|
|
],
|
|
"env": {
|
|
"DATABASE_URL_FILE": "${dir:state}/database.url"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|