Proven on a throwaway server: as the administrator a caller's $(SQLCMDPASSWORD) returned the sa password, and a line beginning ':!!' ran a program in the tools container. The statement now runs as mesh_mssql_reader (CONNECT ANY DATABASE, SELECT ALL USER SECURABLES), with substitution off (-x), after the module's own text on the first line, and a line break is refused. go-sqlcmd v1.10.0 is installed at a pinned digest: the image never had sqlcmd, so every mssql tool failed with spawn sqlcmd ENOENT.
140 lines
3.2 KiB
JSON
140 lines
3.2 KiB
JSON
{
|
|
"module": "mssql",
|
|
"version": "1",
|
|
"provides": [
|
|
{
|
|
"name": "mssql-database",
|
|
"scope": "mesh"
|
|
}
|
|
],
|
|
"capabilities": [
|
|
"container-runtime"
|
|
],
|
|
"emits": [
|
|
"database.provisioned",
|
|
"database.deprovisioned"
|
|
],
|
|
"consumes": [
|
|
"mssql.database.provisioned",
|
|
"mssql.database.deprovisioned"
|
|
],
|
|
"listens": [
|
|
{
|
|
"name": "database",
|
|
"port": 1433,
|
|
"protocol": "tcp",
|
|
"from": "mesh",
|
|
"why": "modules on any machine that were granted a database, and the people who were given its address; the machine port is the assignment's to pin"
|
|
}
|
|
],
|
|
"serves": {
|
|
"mssql-database": {}
|
|
},
|
|
"receives": {
|
|
"mssql-database": "${dir:grants}/mesh.json"
|
|
},
|
|
"grants": {
|
|
"mssql-database": "${dir:grants}"
|
|
},
|
|
"own-secrets": {
|
|
"sa": "${dir:state}/sa.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": "sa-env",
|
|
"type": "file",
|
|
"path": "${dir:state}/sa.env",
|
|
"mode": "0600",
|
|
"content": "ACCEPT_EULA=Y\nMSSQL_SA_PASSWORD=${secret:sa}\n"
|
|
},
|
|
{
|
|
"id": "data",
|
|
"type": "directory",
|
|
"mode": "0700",
|
|
"owner": "10001:0"
|
|
},
|
|
{
|
|
"id": "net",
|
|
"type": "network",
|
|
"name": "mssql"
|
|
},
|
|
{
|
|
"id": "server",
|
|
"type": "container",
|
|
"name": "mssql",
|
|
"image": "mcr.microsoft.com/mssql/server@sha256:4402d880dd4c34bfa7d8705e56a86cd6c88da80a1f6bbbe741f999e76264a090",
|
|
"network": "mssql",
|
|
"env-file": [
|
|
"${dir:state}/sa.env"
|
|
],
|
|
"ports": [
|
|
"1433"
|
|
],
|
|
"volumes": [
|
|
"${dir:data}:/var/opt/mssql"
|
|
],
|
|
"secrets-in-environment": "the image documents only MSSQL_SA_PASSWORD, no _FILE and no configuration field; not convertible without a wrapper entrypoint"
|
|
},
|
|
{
|
|
"id": "runtime",
|
|
"type": "container",
|
|
"name": "mesh-mssql",
|
|
"network": "mssql",
|
|
"volumes": [
|
|
"${dir:mesh-state}/broker:/run/secrets/broker:ro",
|
|
"${dir:grants}:/var/lib/mssql/grants:ro",
|
|
"${dir:state}/sa.secret:/run/secrets/sa:ro",
|
|
"${dir:state}/reader.secret:/run/secrets/reader:ro"
|
|
],
|
|
"env": {
|
|
"MESH_PROVISION_MSSQL": "mssql://sa@mssql:1433/master",
|
|
"MESH_PROVISION_PASSWORD_FILE": "/run/secrets/sa",
|
|
"MESH_BROKER_FILE": "/run/secrets/broker",
|
|
"MESH_RECEIVES": "/var/lib/mssql/grants/mesh.json",
|
|
"MESH_MSSQL_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"
|
|
}
|
|
]
|
|
}
|
|
}
|