Реализовать lab5 на оценку 4: async attachments, outbox, worker и variants.

This commit is contained in:
Mikhail Verkovykh
2026-11-19 20:47:08 +03:00
parent 276dbdad8a
commit 92c67c23c0
86 changed files with 10148 additions and 30 deletions
+28
View File
@@ -0,0 +1,28 @@
#!/bin/sh
# s3-gw shares the network namespace of the `s3` container. When s3 restarts (crash,
# `docker restart`, Docker daemon restart) it gets a NEW namespace and this one is left
# with only `lo`: HAProxy keeps running but nothing can reach it. Exit in that case so
# the restart policy starts s3-gw again inside the current namespace of s3.
haproxy -W -db -f /usr/local/etc/haproxy/haproxy.cfg &
pid=$!
trap 'kill -TERM "$pid" 2>/dev/null' TERM INT USR1
orphaned() {
# /proc/net/dev: two header lines (with '|') and one line per interface.
! grep -qv -e '^ *lo:' -e '|' /proc/net/dev
}
while kill -0 "$pid" 2>/dev/null; do
if orphaned; then
echo "s3-gw: network namespace of s3 is gone; exiting so the restart policy re-joins it" >&2
kill -TERM "$pid" 2>/dev/null
wait "$pid"
# Docker does not retry a start that fails because s3 is not running yet:
# give the restart policy of s3 time to bring it back first.
sleep 5
exit 1
fi
sleep 2 &
wait $!
done
wait "$pid"