forked from sipcapture/homer5-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
67 lines (62 loc) · 3.26 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
sudo: required
services:
- docker
env:
DOCKER_COMPOSE_VERSION: 1.6.2
before_install:
# Install a later docker
- sudo apt-get update -y
- sudo apt-get install -y apt-transport-https ca-certificates apparmor
- sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
- sudo su -c "echo 'deb https://apt.dockerproject.org/repo ubuntu-trusty main' > /etc/apt/sources.list.d/docker.list"
- sudo apt-get update -y
- sudo apt-cache policy docker-engine
- >
sudo apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install -y docker-engine
- sudo service docker stop || true
- sudo service docker start
# Setup docker-compose
- sudo rm /usr/local/bin/docker-compose
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
- chmod +x docker-compose
- sudo mv docker-compose /usr/local/bin
# Setup HEPGEN.js.
- docker pull node:latest
- git clone https://github.com/sipcapture/hepgen.js.git
- docker run --name hepgen --workdir=/hepgen.js/ -v $(pwd)/hepgen.js:/hepgen.js --entrypoint=/bin/bash -td node -c 'while true; do sleep 60; done;'
- docker exec -it hepgen npm install
# Find docker bridge IP
- >
docker0ip=`ifconfig | grep -i -A1 docker0 | grep -i inet | awk '{print $2}' | sed -e "s/addr\://"`
# Setup Hep to send to the proper location (the docker bridge)
- docker exec -it hepgen sed -i -e "s/127.0.0.1/$docker0ip/" /hepgen.js/config/default.js
script:
- docker-compose build
- docker-compose up -d
# Wait for containers to be bootstrapped.
- >
while [[ true ]]; do
echo "waiting for containers to be bootstrapped with data structures...";
sleep 2;
docker exec -it homer-webapp ls /homer-semaphore/.bootstrapped &> /dev/null;
look_exit=$?;
if [[ "$look_exit" = "0" ]]; then echo "found semaphore"; break; fi;
done;
# Now you can run HEPGEN.js
- docker exec -it hepgen node hepgen.js
# Show all the tables
- docker exec -it mysql mysql -u root -p'secret' -s -e "show tables from homer_data"
# Select all the data
- docker exec -it mysql mysql -u root -p'secret' -s -e "SELECT * FROM homer_data.sip_capture_call_$(date '+%Y%m%d')\G"
# Check that there's something in the database, we select the count of calls from HEPGEN.js, and verify there's 3 calls counted
# - docker exec -it mysql mysql -u root -p'secret' -s -e "SELECT COUNT(*) FROM homer_data.sip_capture_call_$(date '+%Y%m%d')" | tail -n 1 | grep -Pi "^3"
# Work-around
# let's check that it asks for proxy auth. I don't know why and I'd like to understand this, but, the bottom line is data is making it to the database
- docker exec -it mysql mysql -u root -p'secret' -s -e "SELECT * FROM homer_data.sip_capture_call_$(date '+%Y%m%d')\G" | grep -i "proxy auth"
# Check that there's a web connection on local host, returning a 200 OK
- >
curl -s -o /dev/null -w "%{http_code}" localhost | grep -iP "^200$"
# Run the rotation cron, and make sure it exits without any output.
# - docker exec -it homer-cron bash -c "/opt/homer_rotate"
# - >
# cron_result=$(docker exec -it homer-cron bash -c "/opt/homer_rotate") && echo $cron_result | grep -i "^$"