mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Test tox-bootstrapd Docker container on Travis
This commit is contained in:
parent
418a304c0e
commit
57115f0e75
|
@ -24,6 +24,11 @@ matrix:
|
||||||
sudo: required
|
sudo: required
|
||||||
install: other/travis/phase $JOB $ENV install stage1
|
install: other/travis/phase $JOB $ENV install stage1
|
||||||
script: other/travis/phase $JOB $ENV script stage1
|
script: other/travis/phase $JOB $ENV script stage1
|
||||||
|
- stage: "Stage 1"
|
||||||
|
env: JOB=tox-bootstrapd-docker ENV=linux
|
||||||
|
services:
|
||||||
|
- docker
|
||||||
|
sudo: required
|
||||||
- stage: "Stage 2"
|
- stage: "Stage 2"
|
||||||
env: JOB=toxcore ENV=freebsd
|
env: JOB=toxcore ENV=freebsd
|
||||||
dist: trusty
|
dist: trusty
|
||||||
|
|
63
other/travis/tox-bootstrapd-docker-linux-script
Executable file
63
other/travis/tox-bootstrapd-docker-linux-script
Executable file
|
@ -0,0 +1,63 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Copy source code to other/bootstrap_daemon/docker/c-toxcore
|
||||||
|
OLD_PWD=$PWD
|
||||||
|
cd /tmp
|
||||||
|
cp -a $OLD_PWD c-toxcore
|
||||||
|
mv c-toxcore $OLD_PWD/other/bootstrap_daemon/docker
|
||||||
|
cd $OLD_PWD
|
||||||
|
ls -lbh other/bootstrap_daemon/docker
|
||||||
|
ls -lbh other/bootstrap_daemon/docker/c-toxcore
|
||||||
|
|
||||||
|
cd other/bootstrap_daemon
|
||||||
|
|
||||||
|
# Make Docker container use our current source code instead of master branch
|
||||||
|
sed -i "s|WORKDIR /tmp/tox|WORKDIR /tmp/tox\nADD /c-toxcore ./c-toxcore/|g" docker/Dockerfile
|
||||||
|
sed -i '/git clone/d' docker/Dockerfile
|
||||||
|
|
||||||
|
cat docker/Dockerfile
|
||||||
|
|
||||||
|
sudo docker build -t tox-bootstrapd docker/
|
||||||
|
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
|
||||||
|
sudo docker run -d --name tox-bootstrapd -v /var/lib/tox-bootstrapd/:/var/lib/tox-bootstrapd/ -p 443:443 -p 3389:3389 -p 33445:33445 -p 33445:33445/udp tox-bootstrapd
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
COUNTER=0
|
||||||
|
COUNTER_END=120
|
||||||
|
while [ $COUNTER -lt $COUNTER_END ]; do
|
||||||
|
if sudo docker logs tox-bootstrapd | grep -q "Connected to another bootstrap node successfully" ; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
COUNTER=$(($COUNTER+1))
|
||||||
|
done
|
||||||
|
|
||||||
|
sudo docker logs tox-bootstrapd
|
||||||
|
|
||||||
|
if [ "$COUNTER" = "$COUNTER_END" ]; then
|
||||||
|
echo "Error: Didn't connect to any nodes"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Wait a bit befrore testing if the container is still running
|
||||||
|
sleep 30
|
||||||
|
|
||||||
|
sudo docker ps -a
|
||||||
|
|
||||||
|
if [ "`sudo docker inspect -f {{.State.Running}} tox-bootstrapd`" != "true" ]; then
|
||||||
|
echo "Error: Container is not running"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! python3 ../fun/bootstrap_node_info.py ipv4 localhost 33445 ; then
|
||||||
|
echo "Error: Unable to get bootstrap node info"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user