source: Klonkt/deploy/HOSTING.md@ 917b22a

main
Last change on this file since 917b22a was 917b22a, checked in by roboburr <roboburr@…>, 5 weeks ago

De journalctl-glob hoort er wel in (deploy/HOSTING.md)

Ik had hem eruit gehaald omdat IK hem niet kon verifieren: op de host zit mijn
account niet in adm, dus ik zie het systeemjournaal niet en kreeg "Failed to add
filter for units: No data available".

Dat was de verkeerde conclusie. De lezer van dit draaiboek is root en kan het
gewoon draaien; een commando schrappen vanwege mijn eigen rechten schuift mijn
beperking door naar de gebruiker, en haalt juist de uitweg weg die iemand nodig
kan hebben.

Alsnog getoetst, elders: de handleiding zegt -u, --unit=UNIT|PATTERN en vergelijkt
het patroon met de units die IN HET JOURNAAL voorkomen. Een prefix-glob matcht
aantoonbaar meerdere units. En een patroon dat niets matcht geeft precies die
melding -- het was dus geen syntaxfout maar een lege uitkomst binnen mijn beperkte
beeld.

Die nuance staat er nu bij, want hij is bruikbaar: "Failed to add filter" leest
als een storing terwijl het meestal betekent dat er geen waarschuwingen waren.

  • Property mode set to 100644
File size: 8.6 KB
Line 
1# Running Klonkt for other people
2
3A runbook for someone who has a VPS and is about to host Klonkt instances for
4people who are not themselves.
5
6This is **not** an install guide. For that:
7
8| | |
9|---|---|
10| [DEPLOY.md](DEPLOY.md) | one Klonkt, from bare VPS to running |
11| [MULTI-INSTANCE.md](MULTI-INSTANCE.md) | the split layout, `klonkt@<slug>` units |
12
13Those tell you how. This one tells you what changes the moment the data on your
14disk stops being yours.
15
16---
17
18## 0. The question to answer first
19
20**Are you hosting for yourself, or for other people?**
21
22If it is only you, stop reading and use the two guides above. Everything below is
23about the second case, and the difference is not technical. One Klonkt is one
24person, so the moment there is a second instance there is a second person, and
25you are now holding their conversations, their contacts, and their identity.
26
27Read §5 before you accept your first user, not after.
28
29---
30
31## 1. Day one
32
33Follow [MULTI-INSTANCE.md](MULTI-INSTANCE.md) for the layout, then:
34
35```bash
36sudo bash /opt/klonkt/scripts/klonkt-add-instance.sh <slug> <domain>
37```
38
39Leave the port out and a free one is chosen. Then check it came up:
40
41```bash
42systemctl status klonkt@<slug>
43```
44
45Before you tell anyone it is ready, do these three:
46
471. **Test the backup, do not just install it.** Run `deploy/backup.sh` once by
48 hand and then actually unpack the tarball somewhere and look inside. A backup
49 you have never restored is a hope, not a backup.
502. **Check the disk.** Media grows quietly; databases do not. `df -h` now, and
51 know what number worries you.
523. **Update once on purpose**, while nobody is depending on it, so the first time
53 you run `klonkt-update` is not also the first time you find out what it does.
54
55---
56
57## 2. The weekly rhythm
58
59Nothing here takes long. Skipping it is how small problems become 3am problems.
60
61```bash
62systemctl list-units 'klonkt@*' # still running?
63df -h # disk
64journalctl -u 'klonkt@*' --since '7 days ago' -p warning --no-pager
65```
66
67If that last one answers `Failed to add filter for units: No data available`,
68nothing matched — which is usually the good news (no warnings in the window), not
69a broken command. Widen the window before you go looking for a fault.
70
71`-u` matches against the units that actually appear in the journal, so an
72instance that logged nothing at all is simply absent. Run it as root: an
73unprivileged account sees only its own messages and will get the same empty
74answer for the wrong reason.
75
76The log line worth reading properly is anything about federation: a rejected
77signature, a delivery that keeps retrying. Those are usually the other side's
78problem, but they are also how you find out that one of your users has been
79invisible to half the fediverse for a week.
80
81---
82
83## 3. Updating, and getting back
84
85```bash
86klonkt-update
87```
88
89One command updates the shared code and restarts **every** instance on the
90machine. That is the point of the shared layout, and it is also the risk: a bad
91release takes all of your users down at once, not one.
92
93So before you update:
94
95- **know what you are on.** `git -C /opt/klonkt rev-parse --abbrev-ref HEAD`.
96 `stable` is what you want unless you have decided otherwise on purpose.
97- **do it when you are awake.** Not before you leave the house.
98
99`klonkt-update` prints the previous commit and the command to go back. It looks
100like this:
101
102```bash
103runuser -u klonkt -- git -C /opt/klonkt checkout -qf -B stable <previous-sha>
104systemctl restart 'klonkt@*'
105```
106
107The glob only matches units systemd already has loaded. An instance that was
108stopped will be skipped, so check with `systemctl list-units 'klonkt@*'
109--all` afterwards rather than assuming.
110
111That only works if the checkout has history. Older installs were cloned shallow
112and could not roll back at all; the updater now deepens once, on its first run
113after this change. If you are not sure:
114
115```bash
116git -C /opt/klonkt rev-parse --is-shallow-repository # want: false
117```
118
119`true` means you cannot roll back yet. Run
120`sudo bash /opt/klonkt/scripts/klonkt-refresh-updater.sh` and then
121`klonkt-update` once.
122
123**Roll back is not atomic.** All instances share one checkout, so during the
124switch the code is briefly half-old. For a handful of instances this is seconds
125and nobody notices. It is still the reason to keep a maintenance page in mind if
126you ever grow.
127
128---
129
130## 4. When it breaks
131
132**An instance will not start.**
133
134```bash
135journalctl -u klonkt@<slug> -n 50 --no-pager
136```
137
138Nine times out of ten it is the `.env`: a missing `SESSION_SECRET`, or a path
139that points at a directory that no longer exists. The app refuses to boot rather
140than come up half-configured, which is deliberate.
141
142**One instance is broken, the rest are fine.** Do not run `klonkt-update` hoping
143it helps — it restarts everyone to fix one. Restart the single unit.
144
145**Everything is broken after an update.** Roll back (§3) first, ask why second.
146
147**Disk full.** Media, then logs. `journalctl --vacuum-size=200M` buys you room
148immediately; the media is a conversation with the user, not a delete decision you
149make alone.
150
151---
152
153## 5. What you are actually holding
154
155This is the section people skip. Do not.
156
157Each instance's data directory contains that person's database: their posts,
158their private messages, who they follow, and — if they are a ward or a guardian —
159their guardianship relationships. It also contains **the private key of their
160fediverse actor**.
161
162That last one is not a privacy nuance. Whoever has that key can post as that
163person, follow as that person, and send messages as that person, and the rest of
164the fediverse has no way to tell. You have it because you have the machine. There
165is no configuration that takes it away.
166
167So:
168
169- **Say so.** Tell the people you host, in plain words, that you can technically
170 read and impersonate. It is better coming from you than discovered later.
171- **Do not build tooling that makes it easy.** Never export or display actor keys
172 from an admin panel. It prevents nothing, but a tool that offers it invites it.
173- **Guardianship data deserves more care than the rest.** A ward is often a
174 minor, and a 🛟 help request is a distress signal. That a guardianship exists
175 may be visible to you for support. What is in it is not yours to read.
176
177### The legal shape
178
179Under the GDPR you are a **processor**: you handle personal data on behalf of
180someone else, who is the controller. That relationship needs a written agreement
181(Art. 28). This is true even if you host for free, and even for one friend.
182
183If you also use the data for your own purposes — statistics across instances,
184moderating what people post, backups you keep for your own reasons — you are no
185longer only a processor, and the bar is higher.
186
187The single-user design helps you here more than you would expect. A request to
188see or delete everything about one person is *one instance*, not a query across
189shared tables. You can answer it honestly, and prove it.
190
191---
192
193## 6. Letting someone leave
194
195A hoster who cannot be left is not a hoster. Klonkt has a portable content
196archive; see [../docs/EXPORT-FORMAT.md](../docs/EXPORT-FORMAT.md).
197
198```bash
199cd /opt/klonkt
200node scripts/export-archive.mjs <slug> --out /tmp/<slug>-archive.zip
201```
202
203It contains their posts, their media, and the replies underneath as a read-only
204record. No credentials, no keys. Hand it over and it can be imported into another
205Klonkt.
206
207Two things to know before you hand it over:
208
209- If the site has **paid posts**, the archive contains their full text. Treat the
210 file like the content itself.
211- The **ActivityPub ids survive** only if the new home has the same domain.
212 Moving to a different domain means new ids, and the boosts and replies that
213 point at the old ones do not follow. That is a property of the fediverse, not
214 of the export.
215
216Then remove the instance ([MULTI-INSTANCE.md](MULTI-INSTANCE.md) §Removing an
217instance) — and only after they confirm the archive opens.
218
219---
220
221## 7. Things not to do
222
223- **Do not host for people you would not tell about §5.** If you would rather
224 they did not know what you can see, you should not be holding it.
225- **Do not update to fix one instance.** It restarts all of them.
226- **Do not put security updates behind anything.** If you ever charge for
227 hosting, charge for the convenience — scheduled, all at once, with a way back
228 — never for the update itself. An unpatched fediverse server is a problem for
229 everyone it talks to, not only for you.
230- **Do not keep backups you have never restored.** See §1.
231- **Do not delete someone's instance the same day they ask.** Export first,
232 confirm they can open it, then remove.
Note: See TracBrowser for help on using the repository browser.