forked from mtusi2026/mtusi2026lab2
Bring the application, own tests, Dockerfile, toolchain, compose stack,
HAProxy, k6 and RustFS configuration, migrations, hooks, evidence and
scenario scripts and the CI job from the lab 4 solution commit d2744bc,
merge the lab 4 Makefile targets into the lab 5 skeleton Makefile
without touching its targets, and append the lab 4 solution variables
to the skeleton .env.example. The package and the application follow
the contract version 1.5.0, and the image and the throwaway test
containers are tagged lab5 so they do not collide with a lab 4 stand on
the same host.
This is the starting point of the lab 5 cycle: lint, own tests and the
offline skeleton check pass before any lab 5 change.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
25 lines
1.6 KiB
Bash
Executable File
25 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
cd "$(dirname "$0")/.."
|
|
cli() { docker compose exec -T valkey sh -c "REDISCLI_AUTH=\"\$(sed -n 's/^requirepass //p' /run/secrets/valkey.conf)\" valkey-cli $1"; }
|
|
psql() { docker compose exec -T postgres psql -U messenger -d messenger -tA -c "$1"; }
|
|
echo "date: $(date -u +%FT%TZ) commit: $(git rev-parse --short HEAD)"
|
|
echo "\$ valkey-cli config get appendonly appendfsync maxmemory maxmemory-policy"
|
|
cli "config get appendonly" ; cli "config get appendfsync"; cli "config get maxmemory"; cli "config get maxmemory-policy"
|
|
echo "\$ valkey-cli info persistence | grep aof_enabled,aof_last_write_status"
|
|
cli "info persistence" | grep -E '^aof_enabled|^aof_last_write_status'
|
|
echo "\$ valkey-cli dbsize; info stats | grep keyspace"
|
|
cli dbsize
|
|
cli "info stats" | grep -E '^keyspace_(hits|misses)'
|
|
key=$(cli "--scan --pattern session:* --count 1000" | head -1)
|
|
hash=${key#session:}
|
|
echo "\$ сравнение срока ключа кэша и срока сессии для одного ключа (значение и токен не печатаются)"
|
|
echo "valkey pexpiretime, ms: $(cli "pexpiretime $key")"
|
|
echo "postgres expires_at, ms: $(psql "SELECT (extract(epoch FROM expires_at) * 1000)::bigint FROM sessions WHERE token_hash = decode('$hash', 'hex')")"
|
|
echo "\$ количество отметок отзыва и закэшированных сессий"
|
|
revoked=0; cached=0
|
|
for k in $(cli "--scan --pattern session:* --count 1000"); do
|
|
if [ "$(cli "get $k")" = "-" ]; then revoked=$((revoked + 1)); else cached=$((cached + 1)); fi
|
|
done
|
|
echo "tombstones: $revoked, cached sessions: $cached"
|