Appendix B: Final Exam
Goal: You solve 14 tasks from across the book in 120 minutes – measuring a new page, visitors, goals, API and SQL, shields, two planted mishaps, backup and mail – and grade yourself. · Duration: 120 min · Prerequisite: Days 0–10
Rules
- Time: 120 minutes, set a timer. Each task has a weight in percent, 100 % in total.
- There is no certificate. Your own bar: from 70 % on, you know the craft.
- Allowed: the wiki of the CE repo, plausible.io/docs,
--helpand your own files under~/plausibleas templates (besuch.js,speicher.js, Caddyfile). Not allowed: this course during the exam. - You play on the stack as it is after Day 10. The working folder is
~/plausible/anhang-b. - All visits use
besuch.jsand the Chrome user agent from Day 3, test IPs from198.51.100.0/24. You narrow down time ranges with the start time from the preparation. - Tasks 10 and 12 have a preparation step that you only run once you get there. The tasks build on each other; stick to the order.
- The solutions are at the end. Read them only after the time is up.
Preparation
# on argo
mkdir -p ~/plausible/anhang-b
date -u '+%F %T' > ~/plausible/anhang-b/start
curl -s -o /dev/null -w '%{http_code}\n' https://plausible.lab/api/health
cd ~/plausible/ce
cmp -s <(grep '^SECRET_KEY_BASE=' .env) \
<(grep '^SECRET_KEY_BASE=' ~/plausible/tag08/env) && echo gleich || echo VERSCHIEDENExpected (gleich means “same”,
VERSCHIEDEN means “different”):
200
gleich
If it says VERSCHIEDEN, finish Round 8 from Day 10
first.
Task 1: Inventory (5 %)
Show with one command each: the image Plausible runs with, the state of all parts, the script identifier of the site and, in one line, the number of goals, IP rules and hostname rules.
Task 2: An event by hand (6 %)
Send a pageview for https://itdrills.com/pruefung/hand/
with curl via your own domain, as visitor
198.51.100.1. Prove that it was not dropped and that it is
in ClickHouse. Also show that the same request is dropped as
Googlebot.
Task 3: A new page (8 %)
In the demo site, create the pages /pruefung/ (title
Pruefung, link Weiter to
/pruefung/kauf/) and /pruefung/kauf/ (title
Kauf, button #exam that reports
Signup with plan: 'exam') – both with the
snippet via your own domain. (“Pruefung” means exam, “Weiter” next,
“Kauf” purchase.) Prove with a visit from 198.51.100.12
that /pruefung/ is counted.
Task 4: Pageviews and visitors (8 %)
Generate three pageviews of /pruefung/: two from
198.51.100.10 (the first one via
utm_source=pruefung), one from 198.51.100.11.
With SQL, show for these three pageviews only the number of pageviews
and visitors, and the visitors per source.
Task 5: The goal with a property (8 %)
198.51.100.12 goes from /pruefung/ via the
link to the purchase page and clicks #exam. Prove the event
including its property in ClickHouse, and query visitors and events for
the goal Signup with plan = exam
through the Stats API.
Task 6: The funnel (8 %)
How many visitors since the start of the exam reached which step of
the sequence /pruefung/ → /pruefung/kauf/ →
Signup within one hour? With SQL, one result per level.
Task 7: The API (6 %)
Through the Stats API, query today’s visitors per page – only pages
whose path contains /pruefung/, sorted descending by
visitors, and by path on a tie.
Task 8: The monitoring (8 %)
The monitoring comes from 198.51.100.99 and should no
longer count – dropped on arrival, not just hidden in the dashboard.
Prove: .99 is dropped, 198.51.100.98 is
counted.
Task 9: What the visitor keeps (5 %)
Prove for /pruefung/ that a visit stores nothing in the
browser, and that events_v2 has no column for IP address or
user agent.
Task 10: The proxy mishap (8 %)
Preparation (run it only now):
# on argo
cd ~/plausible/proxy
sed -i '/handle \/api\/event {/,/^\t}$/d' Caddyfile
docker exec caddy caddy reload --config /etc/caddy/Caddyfile 2>/dev/null“I tidied up the Caddyfile.” Since then no visit arrives, even though
pages and script load. Find the cause, fix it and prove with a request
from 198.51.100.13 that events reach Plausible again.
Task 11: The backup (8 %)
Back up PostgreSQL to
~/plausible/anhang-b/plausible_db.dump, ClickHouse as
pruefung.zip into the backup path from Day 8 and the
.env to ~/plausible/anhang-b/env. Prove that
the dump contains all tables, that ClickHouse created the backup and
that only you can read the keys.
Task 12: The vanished goal (8 %)
Preparation (run it only now):
# on argo
cd ~/plausible/ce
docker compose exec -T plausible_db psql -U postgres -d plausible_db \
-qc "delete from goals where event_name = 'Signup'"The reporting returns an error for the signup query. Find the cause and restore the goals from your backup from Task 11 – without creating them again in the UI. Prove it with the query from Task 5.
Task 13: The mail (4 %)
Trigger “forgot password” for [email protected] and show in
Mailpit the number of mails as well as recipient and subject of the
newest one.
Task 14: Short questions (10 %)
2 % each, one answer in one sentence:
- Why does
202from/api/eventnot prove that a visit was counted? - What distinguishes a shield from a filter in the dashboard?
- Why does a changed
.envnot take effect afterdocker compose restart? - Which part of a Plausible backup cannot be regenerated, and why?
- Why is
git switchto the old version not a safe way back after an upgrade?
Solutions
Read them only after the time is up.
Solution 1
# on argo
cd ~/plausible/ce
docker compose ps --format '{{.Image}}' plausible
curl -s https://plausible.lab/api/health; echo
docker compose exec -T plausible_db psql -U postgres -d plausible_db \
-tAc "select id from tracker_script_configuration"
docker compose exec -T plausible_db psql -U postgres -d plausible_db -tAc "
select (select count(*) from goals), (select count(*) from shield_rules_ip),
(select count(*) from shield_rules_hostname)"Expected:
ghcr.io/plausible/community-edition:v3.2.1
{"sessions":"ok","postgres":"ok","clickhouse":"ok","sites_cache":"ok"}
pa--JsuJYgBCST1JOUHGfKkS
7|1|2
Your script identifier is a different one (Day 1). Seven goals: four automatic ones and three from Day 5; one IP block and two hostname allowlist entries from Day 7.
Solution 2
# on argo
UA="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)"
UA="$UA Chrome/140.0.0.0 Safari/537.36"
D='{"name":"pageview","url":"https://itdrills.com/pruefung/hand/",
"domain":"itdrills.com"}'
curl -s -i -H "User-Agent: $UA" -H 'X-Forwarded-For: 198.51.100.1' \
-H 'Content-Type: application/json' https://itdrills.com/api/event -d "$D" \
| grep -ciE 'dropped'
curl -s -i -H 'User-Agent: Googlebot/2.1 (+http://www.google.com/bot.html)' \
-H 'Content-Type: application/json' https://itdrills.com/api/event -d "$D" \
| grep -iE '^HTTP|dropped'
sleep 5
cd ~/plausible/ce
docker compose exec -T plausible_events_db clickhouse-client -d plausible_events_db \
--query "select name, hostname, pathname from events_v2
where pathname = '/pruefung/hand/'
and timestamp >= '$(cat ~/plausible/anhang-b/start)' format TSV"Expected:
0
HTTP/2 202
x-plausible-dropped: 1
pageview itdrills.com /pruefung/hand/
202 both times; only the header reveals what was dropped
(Day 2). Through Caddy, X-Forwarded-For arrives because
trusted_proxies trusts the VM itself (Day 4).
Solution 3
# on argo
mkdir -p ~/plausible/site/pruefung/kauf
cd ~/plausible/site/pruefung
sed -n '/script.js/,/<\/script>/p' ~/plausible/site/index.html \
> ~/plausible/anhang-b/snippet
cat > index.html <<'EOF'
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><title>Pruefung</title>
</head>
<body><h1>Pruefung</h1><p><a href="/pruefung/kauf/">Weiter</a></p></body></html>
EOF
cat > kauf/index.html <<'EOF'
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><title>Kauf</title>
</head>
<body><h1>Kauf</h1>
<button id="exam" onclick="plausible('Signup', {props: {plan: 'exam'}})">Buy</button>
</body></html>
EOF
sed -i "/<\/title>/r $HOME/plausible/anhang-b/snippet" index.html kauf/index.html
grep -c 'src="/js/script.js"' index.html kauf/index.html
cd ~/plausible/pw
UA="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)"
UA="$UA Chrome/140.0.0.0 Safari/537.36"
docker run --rm --network host --user "$(id -u):$(id -g)" -e HOME=/tmp -e ECHT=1 \
-e UA="$UA" -e IP=198.51.100.12 -v ~/plausible/pw:/pw -w /pw \
mcr.microsoft.com/playwright:v1.65.0-noble \
node besuch.js https://itdrills.com/pruefung/ | tail -1Expected (gezählt means “counted”):
index.html:1
kauf/index.html:1
<- 202 gezählt
The snippet comes from a working page (Day 10, Round 1).
ECHT=1 and the Chrome user agent are required, otherwise
the script stays silent or the server drops the visit (Day 3).
Solution 4
# on argo
cd ~/plausible/pw
UA="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)"
UA="$UA Chrome/140.0.0.0 Safari/537.36"
I=mcr.microsoft.com/playwright:v1.65.0-noble
T=$(date -u '+%F %T')
docker run --rm --network host --user "$(id -u):$(id -g)" -e HOME=/tmp -e ECHT=1 \
-e UA="$UA" -e IP=198.51.100.10 -v ~/plausible/pw:/pw -w /pw $I \
node besuch.js 'https://itdrills.com/pruefung/?utm_source=pruefung' >/dev/null
for ip in 198.51.100.10 198.51.100.11; do
docker run --rm --network host --user "$(id -u):$(id -g)" -e HOME=/tmp -e ECHT=1 \
-e UA="$UA" -e IP=$ip -v ~/plausible/pw:/pw -w /pw $I \
node besuch.js https://itdrills.com/pruefung/ >/dev/null
done
sleep 5
cd ~/plausible/ce
docker compose exec -T plausible_events_db clickhouse-client -d plausible_events_db \
--query "select count(), uniqExact(user_id) from events_v2
where name = 'pageview' and pathname = '/pruefung/' and timestamp >= '$T'"
docker compose exec -T plausible_events_db clickhouse-client -d plausible_events_db \
--query "select if(source = '', 'Direct / None', source) as q, uniqExact(user_id)
from events_v2 where name = 'pageview' and pathname = '/pruefung/'
and timestamp >= '$T' group by q order by q format TSV"Expected:
3 2
Direct / None 1
pruefung 1
Same IP, same user agent, same day – one visitor (Day 2). The second
pageview from .10 comes without UTM but still counts
towards the source pruefung: the source belongs to the
session, not to the pageview (Day 3).
Solution 5
# on argo
cd ~/plausible/pw
UA="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)"
UA="$UA Chrome/140.0.0.0 Safari/537.36"
docker run --rm --network host --user "$(id -u):$(id -g)" -e HOME=/tmp -e ECHT=1 \
-e UA="$UA" -e IP=198.51.100.12 -v ~/plausible/pw:/pw -w /pw \
mcr.microsoft.com/playwright:v1.65.0-noble node besuch.js \
https://itdrills.com/pruefung/ 'klick:text=Weiter' 'klick:#exam' \
| grep Signup | cut -c1-34
sleep 5
cd ~/plausible/ce
docker compose exec -T plausible_events_db clickhouse-client -d plausible_events_db \
--query "select name, pathname, meta.key, meta.value from events_v2
where name = 'Signup'
and timestamp >= '$(cat ~/plausible/anhang-b/start)' format TSV"
K=$(cat ~/plausible/api-key)
Q='{"site_id":"itdrills.com","date_range":"day","metrics":["visitors","events"],
"filters":[["is","event:goal",["Signup"]],["is","event:props:plan",["exam"]]]}'
curl -s -H "Authorization: Bearer $K" -H 'Content-Type: application/json' \
https://plausible.lab/api/v2/query -d "$Q" | jq -c '.results'Expected:
-> {"n":"Signup","v":33,"u":"https
Signup /pruefung/kauf/ ['plan'] ['exam']
[{"metrics":[1,1],"dimensions":[]}]
No new goal needed: Signup has existed since Day 5, and
the property plan is allowed. The API combines multiple
filters with AND (Day 6).
Solution 6
# on argo
cd ~/plausible/ce
docker compose exec -T plausible_events_db clickhouse-client -d plausible_events_db \
--query "select level, count() as besucher from (
select user_id, windowFunnel(3600)(timestamp,
name = 'pageview' and pathname = '/pruefung/',
name = 'pageview' and pathname = '/pruefung/kauf/',
name = 'Signup') as level
from events_v2 where timestamp >= '$(cat ~/plausible/anhang-b/start)'
group by user_id)
group by level order by level format TSV"Expected:
0 1
1 2
3 1
Level 0 is the hand-made visitor from Task 2
(/pruefung/hand/), level 1 the two from Task 4, level 3 is
.12 with the whole path. Level 2 stays empty and therefore
does not appear (Day 6).
Solution 7
# on argo
K=$(cat ~/plausible/api-key)
Q='{"site_id":"itdrills.com","date_range":"day","metrics":["visitors"],
"dimensions":["event:page"],"filters":[["contains","event:page",["/pruefung/"]]],
"order_by":[["visitors","desc"],["event:page","asc"]]}'
curl -s -H "Authorization: Bearer $K" -H 'Content-Type: application/json' \
https://plausible.lab/api/v2/query -d "$Q" \
| jq -r '.results[] | "\(.metrics[0])\t\(.dimensions[0])"'Expected:
3 /pruefung/
1 /pruefung/hand/
1 /pruefung/kauf/
contains is one of the filter operators alongside
is, is_not and matches;
order_by takes several sort orders one after another.
Solution 8
In the browser: Site settings →
Shields → IP addresses → Add
IP address, IP 198.51.100.99, Description
Monitoring, Add IP address.
# on argo
sleep 35
cd ~/plausible/pw
UA="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)"
UA="$UA Chrome/140.0.0.0 Safari/537.36"
for ip in 198.51.100.99 198.51.100.98; do
printf '%s ' $ip
docker run --rm --network host --user "$(id -u):$(id -g)" -e HOME=/tmp -e ECHT=1 \
-e UA="$UA" -e IP=$ip -v ~/plausible/pw:/pw -w /pw \
mcr.microsoft.com/playwright:v1.65.0-noble \
node besuch.js https://itdrills.com/pruefung/ | tail -1
done
cd ~/plausible/ce
docker compose exec -T plausible_db psql -U postgres -d plausible_db \
-tAc "select inet, description, action from shield_rules_ip order by inet"Expected (verworfen means “dropped”,
gezählt means “counted”):
198.51.100.99 <- 202 verworfen
198.51.100.98 <- 202 gezählt
198.51.100.99|Monitoring|deny
203.0.113.50|Büro|deny
Plausible reloads shield rules every 30 seconds – hence
sleep 35 (Day 7). A filter in the dashboard would have
stored the events and only hidden them.
Solution 9
# on argo
cd ~/plausible/pw
UA="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)"
UA="$UA Chrome/140.0.0.0 Safari/537.36"
docker run --rm --network host --user "$(id -u):$(id -g)" -e HOME=/tmp -e UA="$UA" \
-v ~/plausible/pw:/pw -w /pw mcr.microsoft.com/playwright:v1.65.0-noble \
node speicher.js https://itdrills.com/pruefung/
cd ~/plausible/ce
docker compose exec -T plausible_events_db clickhouse-client -d plausible_events_db \
--query "select count() from system.columns where database = 'plausible_events_db'
and table = 'events_v2' and (name ilike '%ip%' or name ilike '%agent%'
or name ilike '%addr%')"Expected:
cookies: []
localStorage: []
sessionStorage: []
0
Solution 10
# on argo
UA="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)"
UA="$UA Chrome/140.0.0.0 Safari/537.36"
D='{"name":"pageview","url":"https://itdrills.com/pruefung/","domain":"itdrills.com"}'
curl -s -o /dev/null -w '%{http_code}\n' https://itdrills.com/js/script.js
curl -s -i -H "User-Agent: $UA" -H 'Content-Type: application/json' \
https://itdrills.com/api/event -d "$D" | grep -iE '^HTTP|^server'
grep -c 'handle /api/event' ~/plausible/proxy/CaddyfileExpected:
200
HTTP/2 404
server: nginx/1.30.7
0
The script loads, but /api/event ends up at nginx
instead of Plausible: the handle /api/event block is
missing, so the request falls through to the general handle
of the demo site. The server header reveals who answers
(Day 0, Challenge). Put the block back in front of the general
handle:
# on argo
cd ~/plausible/proxy
R='\thandle /api/event {\n\t\treverse_proxy 127.0.0.1:8000 {\n'
R="$R"'\t\t\theader_up Host plausible.lab\n\t\t}\n\t}'
sed -i "/^\thandle {\$/i\\$R" Caddyfile
docker exec caddy caddy validate --config /etc/caddy/Caddyfile 2>&1 | tail -1
docker exec caddy caddy reload --config /etc/caddy/Caddyfile 2>/dev/null; echo "rc=$?"
UA="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)"
UA="$UA Chrome/140.0.0.0 Safari/537.36"
D='{"name":"pageview","url":"https://itdrills.com/pruefung/","domain":"itdrills.com"}'
curl -s -i -H "User-Agent: $UA" -H 'X-Forwarded-For: 198.51.100.13' \
-H 'Content-Type: application/json' https://itdrills.com/api/event -d "$D" \
| grep -iE '^HTTP|^server|dropped'Expected:
Valid configuration
rc=0
HTTP/2 202
server: Cowboy
Cowboy is Plausible’s web server, and there is no
x-plausible-dropped – the event has arrived. Order matters:
handle blocks with a path belong in front of the general
handle (Day 4).
Solution 11
# on argo
cd ~/plausible/ce
docker compose exec -T plausible_db pg_dump -U postgres -Fc plausible_db \
> ~/plausible/anhang-b/plausible_db.dump
docker compose exec -T plausible_db pg_restore --list \
< ~/plausible/anhang-b/plausible_db.dump | grep -c 'TABLE DATA'
docker compose exec -T plausible_events_db clickhouse-client --query \
"BACKUP DATABASE plausible_events_db TO File('/backups/pruefung.zip')" \
| awk '{print $2}'
install -m 600 .env ~/plausible/anhang-b/env
stat -c '%a %n' ~/plausible/anhang-b/envExpected:
50
BACKUP_CREATED
600 /home/ubuntu/plausible/anhang-b/env
The backup path /backups/ has been allowed since Day 8
and is mounted on ~/plausible/tag08/clickhouse. Grading: 3
% each for the two databases, 2 % for the .env.
Solution 12
# on argo
K=$(cat ~/plausible/api-key)
Q='{"site_id":"itdrills.com","date_range":"day","metrics":["visitors","events"],
"filters":[["is","event:goal",["Signup"]],["is","event:props:plan",["exam"]]]}'
curl -s -H "Authorization: Bearer $K" -H 'Content-Type: application/json' \
https://plausible.lab/api/v2/query -d "$Q"; echo
cd ~/plausible/ce
docker compose exec -T plausible_db psql -U postgres -d plausible_db \
-tAc "select display_name from goals order by id"Expected:
{"error":"Invalid filters. The goal `Signup` is not configured for this site. Find out
how to configure goals here: https://plausible.io/docs/stats-api#filtering-by-goals"}
404
Outbound Link: Click
File Download
Form: Submission
Buchseiten
Scroll 75% on /books/sops/
The goal Signup is missing – the events are still in
ClickHouse, but without a goal there is no conversion. Bring the goals
back from the dump: first empty the table, then restore only its
data.
# on argo
cd ~/plausible/ce
docker compose exec -T plausible_db psql -U postgres -d plausible_db \
-qc "delete from goals"
docker compose exec -T plausible_db pg_restore -U postgres -d plausible_db \
--data-only -t goals < ~/plausible/anhang-b/plausible_db.dump
docker compose exec -T plausible_db psql -U postgres -d plausible_db \
-tAc "select count(*) from goals"
K=$(cat ~/plausible/api-key)
Q='{"site_id":"itdrills.com","date_range":"day","metrics":["visitors","events"],
"filters":[["is","event:goal",["Signup"]],["is","event:props:plan",["exam"]]]}'
curl -s -H "Authorization: Bearer $K" -H 'Content-Type: application/json' \
https://plausible.lab/api/v2/query -d "$Q" | jq -c '.results'Expected:
7
[{"metrics":[1,1],"dimensions":[]}]
--data-only -t goals restores only this one table from
the custom format (Day 8, Drill 2). The goals get their old IDs back.
Goals work retroactively – the conversion from earlier is back
immediately (Day 5).
Solution 13
# on argo
J=$(mktemp)
T=$(curl -s -c "$J" https://plausible.lab/password/request-reset \
| sed -n 's/.*name="_csrf_token"[^>]*value="\([^"]*\)".*/\1/p' | head -1)
curl -s -b "$J" -o /dev/null -w 'POST %{http_code}\n' \
https://plausible.lab/password/request-reset \
--data-urlencode "_csrf_token=$T" --data-urlencode '[email protected]'
sleep 3
curl -s http://127.0.0.1:8025/api/v1/messages \
| jq -r '.total, (.messages[0] | "\(.To[0].Address): \(.Subject)")'
rm -f "$J"Expected:
POST 200
2
[email protected]: Plausible password reset
The first mail comes from Day 9, as does the approach with CSRF token and cookie – without both, Plausible rejects the form.
Solution 14
202only means “accepted”: dropped events get the same response (withx-plausible-dropped: 1), and during a ClickHouse outage accepted events in the buffer are lost.- A shield drops events before they are stored, a filter only hides stored events.
restartrestarts the existing container with its old environment; onlydocker compose up -drecreates it with the new.env.- The
.envwithSECRET_KEY_BASEandTOTP_VAULT_KEY: API keys are stored as a hash with the one, 2FA secrets encrypted with the other. - Migrations only run forwards – the old version then runs untested on the new schema; the only clean way back is the backup from before the upgrade.
Scoring
| Task | Topic | Weight | Day |
|---|---|---|---|
| 1 | Inventory | 5 % | 1, 5, 7 |
| 2 | Event by hand, dropped | 6 % | 2, 4 |
| 3 | Snippet via your own domain | 8 % | 3, 4 |
| 4 | Visitors, source | 8 % | 2, 3 |
| 5 | Custom event with property | 8 % | 5, 6 |
| 6 | Funnel with SQL | 8 % | 6 |
| 7 | Stats API | 6 % | 6 |
| 8 | IP shield | 8 % | 7 |
| 9 | Proving privacy | 5 % | 7 |
| 10 | Proxy mishap | 8 % | 4, 10 |
| 11 | Backup | 8 % | 8 |
| 12 | Restoring one table | 8 % | 5, 8 |
| 13 | Mail via Mailpit | 4 % | 9 |
| 14 | Short questions | 10 % | all |
Full points only with a proof command. From 70 %: you can run Plausible yourself, back up numbers with evidence and fix mishaps. 50–69 %: repeat the days of the tasks you missed. Below 50 %: work through Days 2 to 5 and Day 8 again.
Cleanup
The exam leaves behind an IP block, two pages, events, a mail and a backup. Everything goes, so that the lab is back to its state after Day 10. Remove the block in the browser (Shields → IP addresses → Remove) or with SQL; after a deletion via SQL, Plausible only reloads the rules after a restart (Day 7). The restart also flushes the buffer before the events are deleted.
# on argo
cd ~/plausible/ce
docker compose exec -T plausible_db psql -U postgres -d plausible_db \
-qc "delete from shield_rules_ip where inet = '198.51.100.99'"
docker compose restart plausible 2>&1 | tail -1
until curl -sf -o /dev/null https://plausible.lab/api/health; do sleep 2; done
T=$(cat ~/plausible/anhang-b/start)
docker compose exec -T plausible_events_db clickhouse-client -d plausible_events_db \
--query "delete from events_v2 where timestamp >= '$T'"
docker compose exec -T plausible_events_db clickhouse-client -d plausible_events_db \
--query "delete from sessions_v2 where start >= '$T'"
M=$(curl -s http://127.0.0.1:8025/api/v1/messages | jq -r '.messages[0].ID')
curl -s -X DELETE http://127.0.0.1:8025/api/v1/messages -d "{\"IDs\":[\"$M\"]}"; echo
rm -rf ~/plausible/site/pruefung
sudo rm ~/plausible/tag08/clickhouse/pruefung.zip
rm -rf ~/plausible/anhang-bExpected:
Container ce-plausible-1 Started
ok
In ClickHouse, delete from is a lightweight delete: the
rows are invisible immediately and physically disappear at the next
merge. In production, only delete like this with a backup and a precise
condition.
Checkpoint
# on argo
curl -s -o /dev/null -w '%{http_code}\n' https://plausible.lab/api/health
grep -c 'handle /api/event' ~/plausible/proxy/Caddyfile
cd ~/plausible/ce
docker compose exec -T plausible_db psql -U postgres -d plausible_db -tAc "
select (select count(*) from goals), (select count(*) from shield_rules_ip),
(select count(*) from shield_rules_hostname)"
docker compose exec -T plausible_events_db clickhouse-client -d plausible_events_db \
--query "select count() from events_v2 where pathname like '/pruefung/%'"
curl -s http://127.0.0.1:8025/api/v1/messages | jq '.total'
sudo ls ~/plausible/tag08/clickhouse
ls ~/plausibleExpected:
200
1
7|1|2
0
1
events.zip
api-key
ce
itdrills-export.zip
proxy
pw
site
tag05-start
tag08
tag09-vorher.txt