The task. A managed node on which the Hub writes the configuration, checks it, puts it into effect, reads state and runs commands — today over two transports with two kinds of access, though one would do.
What it is made of:
The parts have different scopes. Node level; the scheme covers everything except installing the engine, which needs a shell. The monitor port must be reachable by the Hub, and the key must be stored where the Hub uses it.
How they interact. The whole scheme is in the order of actions, because writing neither checks nor puts into effect: read, write, check, reload, and on failure restore what was read. The Hub performs exactly this sequence today, only the write goes over SSH — so the scheme is about changing the transport. The trade-off is real: there are fewer access paths, but one key reaches both the configuration and any node command.
Order:
| Step | Call | Why |
|---|---|---|
| read | GET /configFile?op=read | see divergence from what the Hub wrote |
| write | POST /configFile with op=commit | put the files in place |
| check | POST /command with test config | syntax before reloading |
| reload | POST /command with reload | put into effect |
| roll back | POST /configFile with what was read | if the reload failed |
# write a file, check and reload — all with the key curl -s -X POST -H 'X-API-Key: KEY' 'http://127.0.0.1:8080/configFile' -F op=commit -F format=json -F file.1.name=/etc/pmta/config -F file.1.op=write -F file.1.content='@/tmp/config.new' curl -s -H 'X-API-Key: KEY' 'http://127.0.0.1:8080/command' -F command='test config' -F format=json curl -s -H 'X-API-Key: KEY' 'http://127.0.0.1:8080/command' -F command='reload' -F format=json
curl -s -H 'X-API-Key: KEY' 'http://127.0.0.1:8080/configFile?format=json-text&op=read&filename=/etc/pmta/config' | head -5