mesh/merge-gate out of date: judged against trunk e22326240833, the trunk is now 482232e8c51c; judged again on a recheck or when it is merged
mesh/repo-check out of date: judged against trunk e22326240833, the trunk is now 482232e8c51c; judged again on a recheck or when it is merged
mesh/delivery superseded: a newer head of the same pull request
ADR 0359 decided one module holds the operator's mail accounts. This is its first stage: an imap adapter that keeps IDLE on the inbox and polls the other folders read-only, indexes each message in its own database, keeps each attachment once by its SHA-256 in its bucket, and says every added, changed or removed message as a metadata-only event. Bodies and attachments are served only by its tools, to callers the trusted setting grants names. Its health waits for the account's own secret until it is given at the desk (issue 710).
180 lines
4.4 KiB
JSON
180 lines
4.4 KiB
JSON
{
|
|
"module": "mesh-mail",
|
|
"version": "1",
|
|
"slug": "mail",
|
|
"requires": [
|
|
"postgres-database",
|
|
"s3-bucket"
|
|
],
|
|
"contributes": {
|
|
"postgres-database": {
|
|
"name": "mail"
|
|
}
|
|
},
|
|
"binds": {
|
|
"postgres-database": "${dir:state}/database.json",
|
|
"s3-bucket": "${dir:state}/store-binding.json"
|
|
},
|
|
"secrets": {
|
|
"postgres-database": "${dir:state}/database.secret",
|
|
"s3-bucket": "${dir:state}/store.secret"
|
|
},
|
|
"own-secrets": {
|
|
"mail-credential-*": {
|
|
"path": "${dir:state}/mail-credential-*.secret",
|
|
"issued-by": "outside"
|
|
}
|
|
},
|
|
"tools": [
|
|
"mail_accounts",
|
|
"mail_search",
|
|
"mail_read",
|
|
"mail_health"
|
|
],
|
|
"emits": [
|
|
"mail.mesh.message.added",
|
|
"mail.mesh.message.changed",
|
|
"mail.mesh.message.removed"
|
|
],
|
|
"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": "store",
|
|
"type": "file",
|
|
"path": "${dir:state}/store.json",
|
|
"mode": "0600",
|
|
"content": "{\n \"scheme\": \"${bound:s3-bucket:scheme}\",\n \"at\": \"${bound:s3-bucket:at}\",\n \"port\": \"${bound:s3-bucket:port}\",\n \"bucket\": \"${bound:s3-bucket:bucket}\",\n \"region\": \"${bound:s3-bucket:region}\",\n \"key\": \"${bound:s3-bucket:as}\",\n \"secret\": \"${secret:s3-bucket}\"\n}\n"
|
|
},
|
|
{
|
|
"id": "accounts",
|
|
"trusted": true,
|
|
"type": "file",
|
|
"path": "${dir:state}/accounts.json",
|
|
"mode": "0600",
|
|
"merge": "json",
|
|
"takes-settings": [
|
|
"accounts"
|
|
],
|
|
"content": "{\n \"accounts\": {}\n}\n"
|
|
},
|
|
{
|
|
"id": "grants",
|
|
"trusted": true,
|
|
"type": "file",
|
|
"path": "${dir:state}/grants.json",
|
|
"mode": "0600",
|
|
"merge": "json",
|
|
"takes-settings": [
|
|
"grants"
|
|
],
|
|
"content": "{\n \"grants\": {}\n}\n"
|
|
},
|
|
{
|
|
"id": "prepare",
|
|
"type": "process",
|
|
"name": "mesh-mail-prepare",
|
|
"artifact": "tools",
|
|
"run": [
|
|
"./mesh-mail",
|
|
"prepare"
|
|
],
|
|
"run-once": true,
|
|
"env": {
|
|
"DATABASE_URL_FILE": "${dir:state}/database.url"
|
|
},
|
|
"restart-on": [
|
|
"database-url"
|
|
]
|
|
},
|
|
{
|
|
"id": "keep",
|
|
"type": "process",
|
|
"name": "mesh-mail-keep",
|
|
"artifact": "tools",
|
|
"run": [
|
|
"./mesh-mail",
|
|
"keep"
|
|
],
|
|
"env": {
|
|
"DATABASE_URL_FILE": "${dir:state}/database.url",
|
|
"MESH_MAIL_ACCOUNTS": "${dir:state}/accounts.json",
|
|
"MESH_MAIL_SECRETS": "${dir:state}",
|
|
"MESH_MAIL_STORE": "${dir:state}/store.json"
|
|
},
|
|
"restart-on": [
|
|
"database-url",
|
|
"store",
|
|
"accounts"
|
|
],
|
|
"health": {
|
|
"kind": "unit"
|
|
}
|
|
},
|
|
{
|
|
"id": "watch",
|
|
"type": "process",
|
|
"name": "mesh-mail-watch",
|
|
"artifact": "tools",
|
|
"run": [
|
|
"./mesh-mail",
|
|
"watch"
|
|
],
|
|
"user": "${machine:account}",
|
|
"env": {
|
|
"DATABASE_URL_FILE": "${dir:state}/database.url",
|
|
"MESH_MAIL_ACCOUNTS": "${dir:state}/accounts.json",
|
|
"MESH_MAIL_SECRETS": "${dir:state}",
|
|
"MESH_MAIL_STATUS": "${dir:state}/health.json"
|
|
},
|
|
"restart-on": [
|
|
"database-url",
|
|
"accounts"
|
|
],
|
|
"health": {
|
|
"kind": "tool",
|
|
"tool": "mail_health",
|
|
"needs": "postgres-database",
|
|
"interval": "60s",
|
|
"timeout": "10s",
|
|
"looks": 2,
|
|
"grace": "180s"
|
|
}
|
|
}
|
|
],
|
|
"build": {
|
|
"artifacts": [
|
|
{
|
|
"name": "tools",
|
|
"kind": "bundle",
|
|
"language": "go",
|
|
"system": "arch",
|
|
"from": "cmd/mesh-mail",
|
|
"binary": "mesh-mail",
|
|
"loads": [
|
|
"mesh-mail"
|
|
],
|
|
"env": {
|
|
"DATABASE_URL_FILE": "${dir:state}/database.url",
|
|
"MESH_MAIL_ACCOUNTS": "${dir:state}/accounts.json",
|
|
"MESH_MAIL_GRANTS": "${dir:state}/grants.json",
|
|
"MESH_MAIL_SECRETS": "${dir:state}",
|
|
"MESH_MAIL_STORE": "${dir:state}/store.json",
|
|
"MESH_MAIL_STATUS": "${dir:state}/health.json"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|