Squashed 'external/toxcore/c-toxcore/' content from commit 67badf69
git-subtree-dir: external/toxcore/c-toxcore git-subtree-split: 67badf69416a74e74f6d7eb51dd96f37282b8455
This commit is contained in:
77
.github/scripts/tox-bootstrapd-docker
vendored
Executable file
77
.github/scripts/tox-bootstrapd-docker
vendored
Executable file
@ -0,0 +1,77 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -exu
|
||||
|
||||
LOCAL="${1:-}"
|
||||
|
||||
readarray -t FILES <<<"$(git ls-files)"
|
||||
|
||||
tar c "${FILES[@]}" | docker build -f other/bootstrap_daemon/docker/Dockerfile -t toxchat/bootstrap-node -
|
||||
docker tag toxchat/bootstrap-node:latest toxchat/bootstrap-node:"$(other/print-version)"
|
||||
|
||||
sudo useradd \
|
||||
--home-dir /var/lib/tox-bootstrapd \
|
||||
--create-home \
|
||||
--system \
|
||||
--shell /sbin/nologin \
|
||||
--comment "Account to run Tox's DHT bootstrap daemon" \
|
||||
--user-group tox-bootstrapd
|
||||
sudo chmod 700 /var/lib/tox-bootstrapd
|
||||
docker run -d --name tox-bootstrapd \
|
||||
--user "$(id -u tox-bootstrapd):$(id -g tox-bootstrapd)" \
|
||||
-v /var/lib/tox-bootstrapd/:/var/lib/tox-bootstrapd/ \
|
||||
--ulimit nofile=32768:32768 \
|
||||
-p 443:443 \
|
||||
-p 3389:3389 \
|
||||
-p 33445:33445 \
|
||||
-p 33445:33445/udp \
|
||||
toxchat/bootstrap-node
|
||||
|
||||
sudo ls -lbh /var/lib/tox-bootstrapd
|
||||
|
||||
if sudo [ ! -f /var/lib/tox-bootstrapd/keys ]; then
|
||||
echo "Error: File /var/lib/tox-bootstrapd/keys doesn't exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$LOCAL" != "local" ]; then
|
||||
COUNTER=0
|
||||
COUNTER_END=120
|
||||
while [ "$COUNTER" -lt "$COUNTER_END" ]; do
|
||||
if docker logs tox-bootstrapd | grep -q "Connected to another bootstrap node successfully"; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
COUNTER=$(($COUNTER + 1))
|
||||
done
|
||||
|
||||
docker logs tox-bootstrapd
|
||||
|
||||
if [ "$COUNTER" = "$COUNTER_END" ]; then
|
||||
echo "Error: Didn't connect to any nodes"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
docker logs tox-bootstrapd
|
||||
fi
|
||||
|
||||
# Wait a bit before testing if the container is still running
|
||||
sleep 30
|
||||
|
||||
docker ps -a
|
||||
|
||||
if [ "$(docker inspect -f {{.State.Running}} tox-bootstrapd)" != "true" ]; then
|
||||
echo "Error: Container is not running"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat /proc/"$(pidof tox-bootstrapd)"/limits
|
||||
if ! grep -P '^Max open files(\s+)32768(\s+)32768(\s+)files' /proc/"$(pidof tox-bootstrapd)"/limits; then
|
||||
echo "Error: ulimit is not set to the expected value"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! other/fun/bootstrap_node_info.py ipv4 localhost 33445; then
|
||||
echo "Error: Unable to get bootstrap node info"
|
||||
exit 1
|
||||
fi
|
Reference in New Issue
Block a user