The verb wrapped the caller's text in BEGIN READ ONLY ... ROLLBACK as the superuser, so 'COMMIT; ...' left the transaction and, proven on a throwaway server, COPY TO PROGRAM ran a shell command on the database host. The statement now runs as mesh_store_reader: pg_read_all_data, no other grant, read-only transactions by role and session, its password an own-secret the mesh mints. Without that password the call is refused. -q drops the command tags that came back as rows keyed by BEGIN.
145 lines
3.2 KiB
JSON
145 lines
3.2 KiB
JSON
{
|
|
"module": "postgres",
|
|
"version": "1",
|
|
"provides": [
|
|
{
|
|
"name": "postgres-database",
|
|
"scope": "mesh"
|
|
}
|
|
],
|
|
"claims": [
|
|
{
|
|
"name": "mesh-store",
|
|
"scope": "mesh",
|
|
"serves": [
|
|
"databases",
|
|
"query"
|
|
]
|
|
}
|
|
],
|
|
"capabilities": [
|
|
"container-runtime"
|
|
],
|
|
"emits": [
|
|
"database.provisioned",
|
|
"database.deprovisioned"
|
|
],
|
|
"consumes": [
|
|
"postgres.database.provisioned",
|
|
"postgres.database.deprovisioned"
|
|
],
|
|
"listens": [
|
|
{
|
|
"name": "database",
|
|
"port": 5432,
|
|
"protocol": "tcp",
|
|
"from": "mesh",
|
|
"why": "modules on any machine that were granted a database"
|
|
}
|
|
],
|
|
"guards": [
|
|
5432
|
|
],
|
|
"serves": {
|
|
"postgres-database": {
|
|
"port": 5432
|
|
}
|
|
},
|
|
"receives": {
|
|
"postgres-database": "${dir:grants}/mesh.json"
|
|
},
|
|
"grants": {
|
|
"postgres-database": "${dir:grants}"
|
|
},
|
|
"own-secrets": {
|
|
"superuser": "${dir:state}/superuser.secret",
|
|
"broker": "${dir:mesh-state}/broker",
|
|
"reader": "${dir:state}/reader.secret"
|
|
},
|
|
"resources": [
|
|
{
|
|
"id": "mesh-state",
|
|
"type": "directory",
|
|
"mode": "0700",
|
|
"place": "mesh"
|
|
},
|
|
{
|
|
"id": "state",
|
|
"type": "directory",
|
|
"mode": "0700",
|
|
"place": "."
|
|
},
|
|
{
|
|
"id": "grants",
|
|
"type": "directory",
|
|
"mode": "0700"
|
|
},
|
|
{
|
|
"id": "store-data",
|
|
"type": "directory",
|
|
"path": "/var/lib/mesh-store",
|
|
"mode": "0700",
|
|
"owner": "999:70"
|
|
},
|
|
{
|
|
"id": "server",
|
|
"type": "container",
|
|
"name": "postgres",
|
|
"image": "pgvector/pgvector@sha256:cf134a767f474095eeba57e0117be8e568e011a63f33fbf252f14c9b760f8e6f",
|
|
"env": {
|
|
"POSTGRES_PASSWORD_FILE": "/run/secrets/superuser",
|
|
"PGDATA": "/var/lib/postgresql/data/pgdata"
|
|
},
|
|
"ports": [
|
|
"5432:5432"
|
|
],
|
|
"volumes": [
|
|
"/var/lib/mesh-store:/var/lib/postgresql/data",
|
|
"${dir:state}/superuser.secret:/run/secrets/superuser:ro"
|
|
]
|
|
},
|
|
{
|
|
"id": "runtime",
|
|
"type": "container",
|
|
"name": "mesh-postgres",
|
|
"network": "host",
|
|
"volumes": [
|
|
"${dir:mesh-state}/broker:/run/secrets/broker:ro",
|
|
"${dir:grants}:${dir:grants}:ro",
|
|
"${dir:state}/superuser.secret:/run/secrets/superuser:ro",
|
|
"${dir:state}/reader.secret:/run/secrets/reader:ro"
|
|
],
|
|
"env": {
|
|
"MESH_PROVISION_POSTGRES": "postgres://postgres@127.0.0.1:${port:5432}/postgres?sslmode=disable",
|
|
"MESH_PROVISION_POSTGRES_PORT": "${seat:mesh-store:5432}",
|
|
"MESH_PROVISION_PASSWORD_FILE": "/run/secrets/superuser",
|
|
"MESH_BROKER_FILE": "/run/secrets/broker",
|
|
"MESH_RECEIVES": "${dir:grants}/mesh.json",
|
|
"MESH_POSTGRES_READER_PASSWORD_FILE": "/run/secrets/reader"
|
|
},
|
|
"artifact": "runtime"
|
|
}
|
|
],
|
|
"build": {
|
|
"on": [
|
|
{
|
|
"arg": "BUILD_BASE",
|
|
"module": "mesh-tools",
|
|
"artifact": "build"
|
|
},
|
|
{
|
|
"arg": "RUNTIME_BASE",
|
|
"module": "mesh-tools",
|
|
"artifact": "runtime"
|
|
}
|
|
],
|
|
"artifacts": [
|
|
{
|
|
"name": "runtime",
|
|
"kind": "image",
|
|
"from": "Dockerfile"
|
|
}
|
|
]
|
|
}
|
|
}
|