diff options
-rw-r--r-- | .travis.yml | 5 | ||||
-rwxr-xr-x | other/travis/tox-bootstrapd-docker-linux-script | 63 |
2 files changed, 68 insertions, 0 deletions
diff --git a/.travis.yml b/.travis.yml index f214de39..47b16c31 100644 --- a/.travis.yml +++ b/.travis.yml | |||
@@ -24,6 +24,11 @@ matrix: | |||
24 | sudo: required | 24 | sudo: required |
25 | install: other/travis/phase $JOB $ENV install stage1 | 25 | install: other/travis/phase $JOB $ENV install stage1 |
26 | script: other/travis/phase $JOB $ENV script stage1 | 26 | script: other/travis/phase $JOB $ENV script stage1 |
27 | - stage: "Stage 1" | ||
28 | env: JOB=tox-bootstrapd-docker ENV=linux | ||
29 | services: | ||
30 | - docker | ||
31 | sudo: required | ||
27 | - stage: "Stage 2" | 32 | - stage: "Stage 2" |
28 | env: JOB=toxcore ENV=freebsd | 33 | env: JOB=toxcore ENV=freebsd |
29 | dist: trusty | 34 | dist: trusty |
diff --git a/other/travis/tox-bootstrapd-docker-linux-script b/other/travis/tox-bootstrapd-docker-linux-script new file mode 100755 index 00000000..bb3b5422 --- /dev/null +++ b/other/travis/tox-bootstrapd-docker-linux-script | |||
@@ -0,0 +1,63 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # Copy source code to other/bootstrap_daemon/docker/c-toxcore | ||
4 | OLD_PWD=$PWD | ||
5 | cd /tmp | ||
6 | cp -a $OLD_PWD c-toxcore | ||
7 | mv c-toxcore $OLD_PWD/other/bootstrap_daemon/docker | ||
8 | cd $OLD_PWD | ||
9 | ls -lbh other/bootstrap_daemon/docker | ||
10 | ls -lbh other/bootstrap_daemon/docker/c-toxcore | ||
11 | |||
12 | cd other/bootstrap_daemon | ||
13 | |||
14 | # Make Docker container use our current source code instead of master branch | ||
15 | sed -i "s|WORKDIR /tmp/tox|WORKDIR /tmp/tox\nADD /c-toxcore ./c-toxcore/|g" docker/Dockerfile | ||
16 | sed -i '/git clone/d' docker/Dockerfile | ||
17 | |||
18 | cat docker/Dockerfile | ||
19 | |||
20 | sudo docker build -t tox-bootstrapd docker/ | ||
21 | 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 | ||
22 | sudo chmod 700 /var/lib/tox-bootstrapd | ||
23 | 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 | ||
24 | |||
25 | sudo ls -lbh /var/lib/tox-bootstrapd | ||
26 | |||
27 | if sudo [ ! -f /var/lib/tox-bootstrapd/keys ]; then | ||
28 | echo "Error: File /var/lib/tox-bootstrapd/keys doesn't exist" | ||
29 | exit 1 | ||
30 | fi | ||
31 | |||
32 | COUNTER=0 | ||
33 | COUNTER_END=120 | ||
34 | while [ $COUNTER -lt $COUNTER_END ]; do | ||
35 | if sudo docker logs tox-bootstrapd | grep -q "Connected to another bootstrap node successfully" ; then | ||
36 | break | ||
37 | fi | ||
38 | sleep 1 | ||
39 | COUNTER=$(($COUNTER+1)) | ||
40 | done | ||
41 | |||
42 | sudo docker logs tox-bootstrapd | ||
43 | |||
44 | if [ "$COUNTER" = "$COUNTER_END" ]; then | ||
45 | echo "Error: Didn't connect to any nodes" | ||
46 | exit 1 | ||
47 | fi | ||
48 | |||
49 | # Wait a bit befrore testing if the container is still running | ||
50 | sleep 30 | ||
51 | |||
52 | sudo docker ps -a | ||
53 | |||
54 | if [ "`sudo docker inspect -f {{.State.Running}} tox-bootstrapd`" != "true" ]; then | ||
55 | echo "Error: Container is not running" | ||
56 | exit 1 | ||
57 | fi | ||
58 | |||
59 | if ! python3 ../fun/bootstrap_node_info.py ipv4 localhost 33445 ; then | ||
60 | echo "Error: Unable to get bootstrap node info" | ||
61 | exit 1 | ||
62 | fi | ||
63 | |||