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>
41 lines
2.9 KiB
Bash
Executable File
41 lines
2.9 KiB
Bash
Executable File
#!/bin/sh
|
||
set -eu
|
||
cd "$(dirname "$0")/.."
|
||
psql() { docker compose exec -T postgres psql -U messenger -d messenger -X -c "$1"; }
|
||
value() { docker compose exec -T postgres psql -U messenger -d messenger -X -tA -c "$1"; }
|
||
cli() { docker compose run --rm --no-deps -T s3-cli "$@"; }
|
||
bucket=${S3_BUCKET:-messenger-attachments}
|
||
{
|
||
echo "date: $(date -u +%FT%TZ) commit: $(git rev-parse --short HEAD)"
|
||
echo "\$ docker compose ps --format '{{.Service}} {{.Status}} {{.Ports}}'"
|
||
docker compose ps -a --format '{{.Service}} {{.Status}} {{.Ports}}'
|
||
for table in attachments message_attachments; do
|
||
echo "\$ psql -c '\\d $table'"
|
||
psql "\\d $table"
|
||
done
|
||
echo "\$ psql: столбцы bytea во всей схеме (хеши токенов и отпечатки, не файлы)"
|
||
psql "SELECT table_name, column_name FROM information_schema.columns WHERE table_schema = 'public' AND data_type = 'bytea' ORDER BY 1, 2"
|
||
echo "\$ psql: вложения по статусу и максимальный размер строки attachments"
|
||
psql "SELECT status, count(*), max(pg_column_size(a.*)) AS max_row_bytes FROM attachments a GROUP BY status"
|
||
echo "\$ rc object list --recursive root/$bucket/attachments/ | count"
|
||
cli object list --recursive "root/$bucket/attachments/" --json | grep -c '"key"' || true
|
||
echo "\$ rc object list root/$bucket/ (первые 3 объекта, ключи назначены сервером)"
|
||
cli object list --recursive "root/$bucket/attachments/" | head -3
|
||
row=$(value "SELECT object_key || ' ' || sha256 || ' ' || size_bytes FROM attachments WHERE status = 'ready' ORDER BY created_at DESC LIMIT 1")
|
||
key=${row%% *}
|
||
echo "\$ сверка вне API: sha256 и размер последнего ready-вложения в PostgreSQL против байтов объекта в bucket"
|
||
echo "postgres: ${row#* }"
|
||
echo "s3: $(cli sh -c "rc object show root/$bucket/$key | sha256sum | cut -d' ' -f1") $(cli sh -c "rc object show root/$bucket/$key | wc -c" | tr -d ' ')"
|
||
echo "\$ docker inspect api: ReadonlyRootfs, tmpfs, volumes/bind mounts"
|
||
for id in $(docker compose ps -q api); do
|
||
docker inspect -f '{{.Config.Hostname}} ro={{.HostConfig.ReadonlyRootfs}} tmpfs={{json .HostConfig.Tmpfs}} mounts={{range .Mounts}}{{.Type}}:{{.Destination}} {{end}}' "$id"
|
||
done
|
||
echo "\$ docker inspect s3: volume данных"
|
||
docker inspect -f '{{range .Mounts}}{{.Type}}:{{.Name}}:{{.Destination}} {{end}}' "$(docker compose ps -q s3)"
|
||
echo "\$ секреты сервисов: root-ключи S3 только у s3/s3-init/s3-cli"
|
||
docker compose config --format json | python3 -c 'import json,sys
|
||
for name, service in sorted(json.load(sys.stdin)["services"].items()):
|
||
print(name, sorted(s["source"] for s in service.get("secrets", [])))'
|
||
} > evidence/storage-layout.txt
|
||
cat evidence/storage-layout.txt
|