summaryrefslogtreecommitdiff
path: root/.travis/tox-bootstrapd-docker
diff options
context:
space:
mode:
Diffstat (limited to '.travis/tox-bootstrapd-docker')
-rwxr-xr-x.travis/tox-bootstrapd-docker47
1 files changed, 21 insertions, 26 deletions
diff --git a/.travis/tox-bootstrapd-docker b/.travis/tox-bootstrapd-docker
index 5dc39628..bd192f07 100755
--- a/.travis/tox-bootstrapd-docker
+++ b/.travis/tox-bootstrapd-docker
@@ -2,28 +2,23 @@
2 2
3set -exu 3set -exu
4 4
5# Copy source code to other/bootstrap_daemon/docker/c-toxcore 5tar c $(git ls-files) | docker build -f other/bootstrap_daemon/docker/Dockerfile -t toxchat/bootstrap-node -
6OLD_PWD=$PWD 6sudo useradd \
7cd /tmp 7 --home-dir /var/lib/tox-bootstrapd \
8cp -a $OLD_PWD c-toxcore 8 --create-home \
9mv c-toxcore $OLD_PWD/other/bootstrap_daemon/docker 9 --system \
10cd $OLD_PWD 10 --shell /sbin/nologin \
11ls -lbh other/bootstrap_daemon/docker 11 --comment "Account to run Tox's DHT bootstrap daemon" \
12ls -lbh other/bootstrap_daemon/docker/c-toxcore 12 --user-group tox-bootstrapd
13
14cd other/bootstrap_daemon
15
16# Make Docker container use our current source code instead of master branch
17sed -i "s|WORKDIR /tmp/tox|WORKDIR /tmp/tox\nADD /c-toxcore ./c-toxcore/|g" docker/Dockerfile
18sed -i 's|git clone|echo \\\#git clone|g' docker/Dockerfile
19sed -i 's|git checkout|echo \\\#git checkout|g' docker/Dockerfile
20
21cat docker/Dockerfile
22
23sudo docker build -t tox-bootstrapd docker/
24sudo 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
25sudo chmod 700 /var/lib/tox-bootstrapd 13sudo chmod 700 /var/lib/tox-bootstrapd
26sudo docker run -d --name 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 tox-bootstrapd 14docker run -d --name tox-bootstrapd \
15 -v /var/lib/tox-bootstrapd/:/var/lib/tox-bootstrapd/ \
16 --ulimit nofile=32768:32768 \
17 -p 443:443 \
18 -p 3389:3389 \
19 -p 33445:33445 \
20 -p 33445:33445/udp \
21 toxchat/bootstrap-node
27 22
28sudo ls -lbh /var/lib/tox-bootstrapd 23sudo ls -lbh /var/lib/tox-bootstrapd
29 24
@@ -35,14 +30,14 @@ fi
35COUNTER=0 30COUNTER=0
36COUNTER_END=120 31COUNTER_END=120
37while [ $COUNTER -lt $COUNTER_END ]; do 32while [ $COUNTER -lt $COUNTER_END ]; do
38 if sudo docker logs tox-bootstrapd | grep -q "Connected to another bootstrap node successfully" ; then 33 if docker logs tox-bootstrapd | grep -q "Connected to another bootstrap node successfully" ; then
39 break 34 break
40 fi 35 fi
41 sleep 1 36 sleep 1
42 COUNTER=$(($COUNTER+1)) 37 COUNTER=$(($COUNTER+1))
43done 38done
44 39
45sudo docker logs tox-bootstrapd 40docker logs tox-bootstrapd
46 41
47if [ "$COUNTER" = "$COUNTER_END" ]; then 42if [ "$COUNTER" = "$COUNTER_END" ]; then
48 echo "Error: Didn't connect to any nodes" 43 echo "Error: Didn't connect to any nodes"
@@ -52,9 +47,9 @@ fi
52# Wait a bit befrore testing if the container is still running 47# Wait a bit befrore testing if the container is still running
53sleep 30 48sleep 30
54 49
55sudo docker ps -a 50docker ps -a
56 51
57if [ "`sudo docker inspect -f {{.State.Running}} tox-bootstrapd`" != "true" ]; then 52if [ "`docker inspect -f {{.State.Running}} tox-bootstrapd`" != "true" ]; then
58 echo "Error: Container is not running" 53 echo "Error: Container is not running"
59 exit 1 54 exit 1
60fi 55fi
@@ -65,7 +60,7 @@ if ! cat /proc/$(pidof tox-bootstrapd)/limits | grep -P '^Max open files(\s+)327
65 exit 1 60 exit 1
66fi 61fi
67 62
68if ! python3 ../fun/bootstrap_node_info.py ipv4 localhost 33445 ; then 63if ! other/fun/bootstrap_node_info.py ipv4 localhost 33445 ; then
69 echo "Error: Unable to get bootstrap node info" 64 echo "Error: Unable to get bootstrap node info"
70 exit 1 65 exit 1
71fi 66fi