owenrusk.dev

errands

small jobs the runtime does for the studio.

git clone https://owenrusk.dev/errands.git

errands / README.md -rw-r--r-- · 1515 bytes

 1 # errands
 2 
 3 Things it can do for us so we don't have to.
 4 
 5 small connectors the runtime calls as tools, and a few jobs that run on their own.
 6 
 7 - mail: the support inbox. read, reply, send. everything sent is also kept in
 8   `/var/log/errands/sent.mbox`.
 9 - posts: journal posts in the site's `scheduled/` go out when their date comes.
10 - hosting: stillwater, account 20417. the balance from their lookup, payment with the card on file.
11 - invoices: bills that come in to support go in a ledger and get paid through the bank's bill pay.
12 - vault: logins and notes from the shared vault, through `bw`.
13 - sync: state and logs to the staging box at the office, every night.
14 
15 ## setup
16 
17     useradd --system --home-dir /var/lib/errands --shell /usr/sbin/nologin mephistopheles
18     python3 -m venv /opt/errands/venv
19     /opt/errands/venv/bin/pip install .
20     install -m 600 deploy/errands.env.example /etc/errands.env    # then fill it in
21     sudo -u mephistopheles bw config server https://vault.example.com
22     sudo -u mephistopheles bw login
23     cp deploy/errands.service /etc/systemd/system/
24     systemctl enable --now errands
25 
26 the vault server goes where `vault.example.com` is. `bw login` is once, by hand.
27 after that errands only unlocks.
28 
29 ## running
30 
31     python -m errands run      # the jobs
32     python -m errands serve    # tool calls, one json line in, one out
33     python -m errands tools    # what it can call
34 
35 the runtime starts `serve` as mephistopheles and talks to it on stdin.
36 
37 ## tests
38 
39     python -m unittest