├── .gitignore
├── .travis.yml
├── Makefile
├── README.md
├── bootstrap-data
├── Dockerfile
└── bootstrap.sh
├── charts
├── README.md
└── hepop-elastic
│ ├── Chart.yaml
│ └── templates
│ ├── heplify-server-claim0-persistentvolumeclaim.yaml
│ ├── heplify-server-config.yaml
│ ├── heplify-server-deployment.yaml
│ ├── heplify-server-service.yaml
│ ├── telegraf-claim0-persistentvolumeclaim.yaml
│ ├── telegraf-config.yaml
│ ├── telegraf-deployment.yaml
│ └── telegraf-service.yaml
├── cron-k8s
├── Dockerfile
└── run.sh
├── cron
├── Dockerfile
├── configuration.php
├── preferences.php
├── rotation.ini
├── run.sh
└── vhost.conf
├── docker-compose.yml
├── everything
├── Dockerfile
├── data
│ ├── configuration.php
│ ├── kamailio.cfg
│ ├── preferences.php
│ └── vhost.conf
└── run.sh
├── hepgen
└── Dockerfile
├── heplify-server
├── hom5-hep-elastic
│ ├── README.md
│ ├── caddy
│ │ └── Caddyfile
│ ├── conf
│ │ ├── homer_dashboard.json
│ │ ├── retention.policy
│ │ └── telegraf.conf
│ ├── docker-compose-ext.yml
│ └── docker-compose.yml
├── hom5-hep-influx
│ ├── README.md
│ ├── caddy
│ │ └── Caddyfile
│ ├── conf
│ │ ├── homer_dashboard.json
│ │ ├── retention.policy
│ │ └── telegraf.conf
│ ├── docker-compose.yml
│ └── influx
│ │ └── .ignore
├── hom5-hep-prom-graf
│ ├── Dockerfile
│ ├── README.md
│ ├── alertmanager
│ │ └── config.yml
│ ├── caddy
│ │ └── Caddyfile
│ ├── docker-compose.yml
│ ├── grafana
│ │ └── provisioning
│ │ │ ├── dashboards
│ │ │ ├── Host_Overview.json
│ │ │ ├── QOS_Horaclifix.json
│ │ │ ├── QOS_RTCP.json
│ │ │ ├── QOS_XRTP.json
│ │ │ ├── SIP_Calls&Registers.json
│ │ │ ├── SIP_Error_Rates.json
│ │ │ ├── SIP_KPI's.json
│ │ │ ├── SIP_Methods&Responses.json
│ │ │ ├── SIP_Overview.json
│ │ │ └── dashboard.yml
│ │ │ └── datasources
│ │ │ └── datasource.yml
│ └── prometheus
│ │ ├── alert.rules
│ │ └── prometheus.yml
├── hom7-elastic
│ ├── README.md
│ ├── caddy
│ │ └── Caddyfile
│ ├── conf
│ │ ├── kibana-import.json
│ │ └── telegraf.conf
│ └── docker-compose.yml
├── hom7-hep-elastic
│ ├── README.md
│ ├── caddy
│ │ └── Caddyfile
│ ├── conf
│ │ ├── homer_dashboard.json
│ │ ├── init-user-db.sh
│ │ └── telegraf.conf
│ └── docker-compose.yml
├── hom7-hep-influx
│ ├── README.md
│ ├── caddy
│ │ └── Caddyfile
│ ├── conf
│ │ ├── homer_dashboard.json
│ │ ├── init-user-db.sh
│ │ ├── retention.policy
│ │ └── telegraf.conf
│ ├── docker-compose.yml
│ └── influx
│ │ ├── .holdme
│ │ └── .ignore
├── hom7-hep-prom-graf
│ ├── Dockerfile
│ ├── README.md
│ ├── alertmanager
│ │ └── config.yml
│ ├── caddy
│ │ └── Caddyfile
│ ├── docker-compose.yml
│ ├── grafana
│ │ └── provisioning
│ │ │ ├── dashboards
│ │ │ ├── Host_Overview.json
│ │ │ ├── QOS_Horaclifix.json
│ │ │ ├── QOS_RTCP.json
│ │ │ ├── QOS_XRTP.json
│ │ │ ├── SIP_Calls&Registers.json
│ │ │ ├── SIP_Error_Rates.json
│ │ │ ├── SIP_KPI's.json
│ │ │ ├── SIP_Methods&Responses.json
│ │ │ ├── SIP_Overview.json
│ │ │ └── dashboard.yml
│ │ │ └── datasources
│ │ │ └── datasource.yml
│ └── prometheus
│ │ ├── alert.rules
│ │ └── prometheus.yml
└── hom7-loudml-influx
│ ├── README.md
│ ├── caddy
│ └── Caddyfile
│ ├── conf
│ ├── config.yml
│ ├── diffs.tick
│ ├── homer_dashboard.json
│ ├── init-user-db.sh
│ ├── kapacitor.conf
│ ├── retention.policy
│ └── telegraf.conf
│ └── docker-compose.yml
├── hepop
├── hom7-elastic-only
│ ├── README.md
│ ├── caddy
│ │ └── Caddyfile
│ ├── conf
│ │ ├── kibana-import.json
│ │ ├── marija.toml
│ │ ├── myconfig.js
│ │ └── telegraf.conf
│ └── docker-compose.yml
├── hom7-hep-influx
│ ├── README.md
│ ├── caddy
│ │ └── Caddyfile
│ ├── conf
│ │ ├── homer_dashboard.json
│ │ ├── init-user-db.sh
│ │ ├── retention.policy
│ │ └── telegraf.conf
│ └── docker-compose.yml
├── hom7-json-influx
│ ├── README.md
│ ├── caddy
│ │ └── Caddyfile
│ ├── conf
│ │ ├── homer_dashboard.json
│ │ ├── init-user-db.sh
│ │ ├── kibana_homer_janus.json
│ │ ├── retention.policy
│ │ └── telegraf.conf
│ └── docker-compose.yml
├── hom7-loudml-influx
│ ├── README.md
│ ├── caddy
│ │ └── Caddyfile
│ ├── conf
│ │ ├── config.yml
│ │ ├── diffs.tick
│ │ ├── homer_dashboard.json
│ │ ├── init-user-db.sh
│ │ ├── kapacitor.conf
│ │ ├── retention.policy
│ │ └── telegraf.conf
│ └── docker-compose.yml
└── readme.md
├── homer.env
├── k8s-docker-compose.yml
├── k8s
├── README.md
├── README_volumes.md
├── deploy.yaml
├── hepgen.yaml
├── persistent.yaml
├── raw-kompose
│ ├── bootstrap-claim0-persistentvolumeclaim.yaml
│ ├── bootstrap-deployment.yaml
│ ├── bootstrap-service.yaml
│ ├── cron-deployment.yaml
│ ├── cron-service.yaml
│ ├── docker-compose.yaml
│ ├── homer-data-dashboard-persistentvolumeclaim.yaml
│ ├── homer-data-mysql-persistentvolumeclaim.yaml
│ ├── homer-data-semaphore-persistentvolumeclaim.yaml
│ ├── kamailio-deployment.yaml
│ ├── kamailio-service.yaml
│ ├── mysql-claim0-persistentvolumeclaim.yaml
│ ├── mysql-deployment.yaml
│ ├── mysql-service.yaml
│ ├── webapp-claim0-persistentvolumeclaim.yaml
│ ├── webapp-deployment.yaml
│ └── webapp-service.yaml
└── service.yaml
├── kamailio
├── Dockerfile
├── kamailio.cfg
└── run.sh
├── mysql
└── run.sh
├── opensips-everything
├── Dockerfile
├── Makefile
├── README.md
├── data
│ ├── configuration.php
│ ├── homer-es-template.json
│ ├── opensips-es.m4
│ ├── opensips.cfg
│ ├── opensips.m4
│ ├── preferences.php
│ └── vhost.conf
└── run.sh
├── opensips
├── Dockerfile
├── opensips.cfg
└── run.sh
└── webapp
├── Dockerfile
├── configuration.php
├── preferences.php
├── run.sh
└── vhost.conf
/.gitignore:
--------------------------------------------------------------------------------
1 | RELEASE.md
2 | notes*
3 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | sudo: required
2 | services:
3 | - docker
4 | env:
5 | DOCKER_COMPOSE_VERSION: 1.6.2
6 |
7 | before_install:
8 | # Install a later docker
9 | - sudo apt-get update -y
10 | - sudo timedatectl set-timezone UTC
11 | - sudo apt-get install -y apt-transport-https ca-certificates apparmor libfaketime
12 | - sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
13 | - sudo su -c "echo 'deb https://apt.dockerproject.org/repo ubuntu-trusty main' > /etc/apt/sources.list.d/docker.list"
14 | - sudo apt-get update -y
15 | - sudo apt-cache policy docker-engine
16 | - >
17 | sudo apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install -y docker-engine
18 | - sudo service docker stop || true
19 | - sudo service docker start
20 | # Setup docker-compose
21 | - sudo rm /usr/local/bin/docker-compose
22 | - curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
23 | - chmod +x docker-compose
24 | - sudo mv docker-compose /usr/local/bin
25 | # Setup HEPGEN.js.
26 | - docker pull node:latest
27 | - git clone https://github.com/sipcapture/hepgen.js.git
28 | - 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;'
29 | - docker exec -it hepgen npm install
30 | # Find docker bridge IP
31 | - >
32 | docker0ip=`ifconfig | grep -i -A1 docker0 | grep -i inet | awk '{print $2}' | sed -e "s/addr\://"`
33 |
34 | # Setup Hep to send to the proper location (the docker bridge)
35 | - docker exec -it hepgen sed -i -e "s/127.0.0.1/$docker0ip/" /hepgen.js/config/default.js
36 |
37 | script:
38 | - docker-compose build
39 | - docker-compose up -d
40 | # Wait for containers to be bootstrapped.
41 | - >
42 | export tries=0;
43 | export max_tries=60;
44 | while [[ true ]]; do
45 | tries=$((tries + 1));
46 | echo "waiting for containers to be bootstrapped with data structures... [$tries]";
47 | sleep 2;
48 | docker exec -it homer-webapp ls /homer-semaphore/.bootstrapped &> /dev/null;
49 | look_exit=$?;
50 | if [[ "$look_exit" = "0" ]]; then echo "found semaphore"; break; fi;
51 | if [[ "$tries" -ge "$max_tries" ]]; then echo "no semaphore found in time"; exit 1; break; fi;
52 | done;
53 |
54 | # Now you can run HEPGEN.js
55 | - docker exec -it hepgen node hepgen.js
56 | # Show all the tables
57 | - docker exec -it mysql mysql -u root -p'secret' -s -e "show tables from homer_data"
58 | # Select all the data
59 | - docker exec -it mysql mysql -u root -p'secret' -s -e "SELECT * FROM homer_data.sip_capture_call_$(date '+%Y%m%d')\G"
60 | # Check that there's something in the database, we select the count of calls from HEPGEN.js, and verify there's 3 calls counted
61 | # - 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"
62 | # Work-around
63 | # 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
64 | - 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"
65 | # Check that there's a web connection on local host, returning a 200 OK
66 | - >
67 | curl -s -o /dev/null -w "%{http_code}" localhost | grep -iP "^200$"
68 |
69 | # Let's try to test cron, let's set the system time.
70 | - sudo date --set="$(date -d '+4 days' +'%d %b %Y 03:29:50')"
71 | # Show host date...
72 | - date
73 | # Show cron's date inside the container...
74 | - docker exec -it homer-cron date
75 |
76 | # Create a grep pattern.
77 | - target_pattern=sip_capture_call_$(date +'%Y%m%d')
78 |
79 | # Wait up to two minutes looking for the tables.
80 | - >
81 | export tries=0;
82 | export max_tries=60;
83 | while [[ true ]]; do
84 | tries=$((tries + 1));
85 | echo "waiting for cron to run... [$tries]";
86 | sleep 2;
87 | # Now see that today's table is there, which would indicate that the cron job ran.
88 | docker exec -it mysql mysql -u root -p'secret' -s -e "show tables from homer_data" | grep sip_capture_call_$(date +'%Y%m%d')
89 | look_exit=$?;
90 | if [[ "$look_exit" = "0" ]]; then echo "found table created by cron"; break; fi;
91 | if [[ "$tries" -ge "$max_tries" ]]; then echo "no table created by cron in time"; exit 1; break; fi;
92 | done;
93 |
94 | # Show all the tables (for debugging purposes)
95 | - docker exec -it mysql mysql -u root -p'secret' -s -e "show tables from homer_data"
96 | # And look at the cron logs and the docker logs
97 | - docker logs homer-cron
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | build:
2 | docker build --tag="sipcapture/homer-docker:latest" ./everything
3 |
4 | run:
5 | docker run -dt --name homer5 -p 80:80 -p 9060:9060/udp sipcapture/homer-docker:latest
6 |
7 | run-container:
8 | docker run -tid --name homer5 -p 80:80 -p 9060:9060/udp sipcapture/homer-docker
9 |
10 | test:
11 | curl localhost
12 |
13 | .PHONY: install build run test clean
14 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | # OBSOLETE
5 | For the latest `homer` containers please use: https://github.com/sipcapture/homer7-docker
6 |
7 | # HOMER Docker Containers
8 | http://sipcapture.org
9 |
10 | This repository provides ready-to-run [HOMER](https://github.com/sipcapture/homer/tree/homer) recipes using `Docker` and [docker-compose](https://docs.docker.com/compose/install/)
11 |
12 | ### Choosing a Capture Server & Backend
13 | HOMER is all about options and easy integrations. Choose your preferred flavour to proceed:
14 |
15 | * [HOMER 7](https://github.com/sipcapture/homer/tree/homer7) _development_
16 | * [HEPlify-Server](https://github.com/sipcapture/homer-docker/tree/master/heplify-server)
17 | * [HEPlify + Prometheus ](https://github.com/sipcapture/homer-docker/tree/master/heplify-server/hom7-hep-prom-graf)
18 | * [HEPlify + InfluxDB ](https://github.com/sipcapture/homer-docker/tree/master/heplify-server/hom7-hep-influx)
19 | * [HEPlify + InfluxDB + LoudML](https://github.com/sipcapture/homer-docker/tree/master/heplify-server/hom7-hep-influx)
20 | * [HEPlify + Elastic ](https://github.com/sipcapture/homer-docker/tree/master/heplify-server/hom7-hep-elastic)
21 | * [HEPlify + Elastic Headless](https://github.com/sipcapture/homer-docker/tree/master/heplify-server/hom7-elastic)
22 |
23 | * [HEPop Server](https://github.com/sipcapture/homer-docker/tree/master/hepop)
24 | * [HEPop + InfluxDB](https://github.com/sipcapture/homer-docker/tree/master/hepop/hom7-hep-influx)
25 | * [HEPop + InfluxDB + LoudML](https://github.com/sipcapture/homer-docker/tree/master/hepop/hom7-loudml-influx)
26 | * [HEPop + InfluxDB + JSON](https://github.com/sipcapture/homer-docker/tree/master/hepop/hom7-json-influx) for Janus/Mediasoup
27 | * [HEPop + Elasticsearch + JSON](https://github.com/sipcapture/homer-docker/tree/master/hepop/hom7-elastic-only) for Janus/Mediasoup
28 |
29 |
30 | * [HOMER 5](https://github.com/sipcapture/homer/tree/homer5) _legacy_
31 | * [HEPlify-Server](https://github.com/sipcapture/homer-docker/tree/master/heplify-server)
32 | * [HEPlify-S + Prometheus ](https://github.com/sipcapture/homer-docker/tree/master/heplify-server/hom5-hep-prom-graf)
33 | * [HEPlify-S + InfluxDB ](https://github.com/sipcapture/homer-docker/tree/master/heplify-server/hom5-hep-influx)
34 | * [HEPlify-S + Elasticsearch ](https://github.com/sipcapture/homer-docker/tree/master/heplify-server/hom5-hep-elastic)
35 |
36 | * [OpenSIPS + sipcapture](https://github.com/sipcapture/homer-docker/tree/master/opensips-everything)
37 | * [Kamailio + sipcapture](https://github.com/sipcapture/homer-docker/tree/master/kamailio)
38 |
39 | ### Running Containers
40 |
41 | To start your own bundle or choice, just run the following command inside the selected directory:
42 |
43 | ```bash
44 | $ docker-compose up -d
45 | ```
46 |
47 | #### Data Mapping
48 |
49 | The `docker-compose` scheme will map container data into local directory volumes. Check and extend the provided examples accordingly.
50 |
51 |
52 | ----
53 |
54 | #### Made by Humans
55 | This Open-Source project is made possible by actual Humans without corporate sponsors, angels or patreons.
56 | If you use this software in production, please consider supporting its development with contributions or [donations](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=donation%40sipcapture%2eorg&lc=US&item_name=SIPCAPTURE&no_note=0¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest)
57 |
58 | [](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=donation%40sipcapture%2eorg&lc=US&item_name=SIPCAPTURE&no_note=0¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest)
59 |
--------------------------------------------------------------------------------
/bootstrap-data/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM mysql:5.6
2 | MAINTAINER @qxip (twitter)
3 | RUN apt-get update && apt-get install -y git
4 | RUN git clone https://github.com/sipcapture/homer-api.git /homer-api && cd /homer-api && cd /
5 | ADD bootstrap.sh /bootstrap.sh
6 |
--------------------------------------------------------------------------------
/bootstrap-data/bootstrap.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # ----------------------------------------------------
3 | # HOMER 5 Docker (http://sipcapture.org)
4 | # ----------------------------------------------------
5 | # -- Bootstrap script for Homer's database
6 | # ----------------------------------------------------
7 | # Reads from environment variables to set:
8 | # MYSQL_ROOT_PASSWORD MySQL root password.
9 | # DB_PASS MySQL password (homer_password)
10 | # DB_USER MySQL user (homer_user)
11 | # DB_HOST MySQL host (127.0.0.1 [docker0 bridge])
12 | # KAMAILIO_HEP_PORT Kamailio HEP Socket port (9060)
13 | # ----------------------------------------------------
14 |
15 | # For reference...
16 | # Previously for: MySQL Reconfiguring defaults
17 | #
18 | # PATH_MYSQL_CONFIG=/etc/mysql/my.cnf
19 | # perl -p -i -e "s/sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES/sql_mode=NO_ENGINE_SUBSTITUTION/" $PATH_MYSQL_CONFIG
20 | # sed '/\[mysqld\]/a max_connections = 1024\' -i $PATH_MYSQL_CONFIG
21 |
22 | # MYSQL SETUP
23 | SQL_LOCATION=/homer-api/sql/mysql
24 | DATADIR=/var/lib/mysql
25 |
26 | # ------- First thing we'll do is wait until mysql is up....
27 |
28 | echo "Checking if mysql is alive..."
29 | export MYSQL_PWD=$MYSQL_ROOT_PASSWORD
30 |
31 | mysql_started=false
32 | waited=0
33 | while [ "$mysql_started" = false ]; do
34 | mysqladmin -h $DB_HOST -u root status &> /mysql.status
35 | if [[ "$(cat /mysql.status)" =~ "Uptime" ]]; then
36 | echo "Mysql is now running."
37 | mysql_started=true
38 | else
39 | echo "Bootstrap container is waiting for mysql, sleeping 2 seconds, intentionally waited $waited seconds so far"
40 | waited=$[$waited+2]
41 | sleep 2
42 | fi
43 | done
44 |
45 | # ------ Now that we have mysql alive, check if the homer tables are already created...
46 |
47 | # Show the databases.
48 | databases=$(mysql -h $DB_HOST -u root -s -e 'show databases;')
49 |
50 | # Check if the homer_data database is in there.
51 | if [[ ! "$databases" =~ "homer_data" ]]; then
52 |
53 | # If it's not, go ahead and start loading data.
54 | echo "Beginning initial data load...."
55 |
56 | echo "Creating Databases..."
57 | mysql --host "$DB_HOST" -u "root" < $SQL_LOCATION/homer_databases.sql
58 | mysql --host "$DB_HOST" -u "root" < $SQL_LOCATION/homer_user.sql
59 | mysql --host "$DB_HOST" -u "root" -e "GRANT ALL ON *.* TO '$DB_USER'@'%' IDENTIFIED BY '$DB_PASS'; FLUSH PRIVILEGES;";
60 |
61 | export MYSQL_PWD=$DB_PASS
62 |
63 | echo "Creating Tables..."
64 | mysql --host "$DB_HOST" -u "$DB_USER" homer_data < $SQL_LOCATION/schema_data.sql
65 | mysql --host "$DB_HOST" -u "$DB_USER" homer_configuration < $SQL_LOCATION/schema_configuration.sql
66 | mysql --host "$DB_HOST" -u "$DB_USER" homer_statistic < $SQL_LOCATION/schema_statistic.sql
67 |
68 | # echo "Creating local DB Node..."
69 | mysql --host "$DB_HOST" -u "$DB_USER" homer_configuration -e "REPLACE INTO node VALUES(1,'mysql','homer_data','3306','"$DB_USER"','"$DB_PASS"','sip_capture','node1', 1);"
70 |
71 | echo "Homer initial data load complete" > $DATADIR/.homer_initialized
72 | else
73 | echo "Detected Homer databases are already installed."
74 | fi
75 |
76 | echo "Bootstrapped @ $(date)" > /homer-semaphore/.bootstrapped
77 | echo "Data bootstrapped semaphore written to /homer-semaphore/.bootstrapped"
78 |
--------------------------------------------------------------------------------
/charts/README.md:
--------------------------------------------------------------------------------
1 | # Experimental HELM Charts
2 |
3 | Warning: this repository is experimental and should be used at your own risk!
4 |
--------------------------------------------------------------------------------
/charts/hepop-elastic/Chart.yaml:
--------------------------------------------------------------------------------
1 | name: hepop-elastic
2 | version: 7.0.0
3 | appVersion: 7.0.0.
4 | description: Open-Source VoIP and RTC Monitoring
5 | keywords:
6 | - homer
7 | - voip
8 | - rtc
9 | - monitoring
10 | - troubleshooting
11 | - capture
12 | - alerting
13 | - janus
14 | home: https://sipcapture.org
15 | icon: http://sipcapture.org/images/logos/preloader-logo.png
16 | sources:
17 | - https://github.com/sipcapture/homer
18 | maintainers:
19 | - name: QXIP
20 | email: info@qxip.net
21 | engine: gotpl
22 |
--------------------------------------------------------------------------------
/charts/hepop-elastic/templates/heplify-server-claim0-persistentvolumeclaim.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: PersistentVolumeClaim
3 | metadata:
4 | creationTimestamp: null
5 | labels:
6 | io.kompose.service: heplify-server-claim0
7 | name: heplify-server-claim0
8 | spec:
9 | accessModes:
10 | - ReadWriteOnce
11 | resources:
12 | requests:
13 | storage: 100Mi
14 | status: {}
15 |
--------------------------------------------------------------------------------
/charts/hepop-elastic/templates/heplify-server-config.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | data:
3 | myconfig.js: |
4 | {
5 | "id" : "HEPop101",
6 | "socket": "http",
7 | "port": 8080,
8 | "address": "0.0.0.0",
9 | "queue": {
10 | "timeout": 2000,
11 | "maxSize": 1000,
12 | "useInterval": true
13 | },
14 | "dbName": "homer_data",
15 | "tableName": "hep",
16 | "db": {
17 | "rawSize": 8000,
18 | "elastic" : {
19 | "target": "http://elasticsearch:9200",
20 | "max_bulk_qtty": 10,
21 | "max_request_num": 20,
22 | "index": "homer"
23 | }
24 | },
25 | "metrics": {
26 | "influx":{
27 | "period": 30000,
28 | "expire": 300000,
29 | "dbName": "hep",
30 | "hostname": "telegraf:8094"
31 | }
32 | },
33 | "debug": false
34 | }
35 | kind: ConfigMap
36 | metadata:
37 | name: heplify-server-config
38 |
--------------------------------------------------------------------------------
/charts/hepop-elastic/templates/heplify-server-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: extensions/v1beta1
2 | kind: Deployment
3 | metadata:
4 | creationTimestamp: null
5 | labels:
6 | io.kompose.service: heplify-server
7 | name: heplify-server
8 | spec:
9 | replicas: 1
10 | strategy:
11 | type: Recreate
12 | template:
13 | metadata:
14 | creationTimestamp: null
15 | labels:
16 | io.kompose.service: heplify-server
17 | spec:
18 | containers:
19 | - env:
20 | - name: HEPOP_HOST
21 | value: 0.0.0.0
22 | - name: HEPOP_ID
23 | value: HEPOP_101
24 | - name: HEPOP_PORT
25 | value: "8080"
26 | - name: HEPOP_PROTO
27 | value: http
28 | - name: INFLUXDB_DB
29 | value: homer
30 | - name: INFLUXDB_HOST
31 | value: influxdb
32 | - name: INFLUXDB_PORT
33 | value: "8094"
34 | image: sipcapture/hepop:master
35 | name: heplify-server
36 | ports:
37 | - containerPort: 8080
38 | - containerPort: 9060
39 | - containerPort: 9060
40 | protocol: UDP
41 | resources: {}
42 | volumeMounts:
43 | - name: heplify-server-config-volume
44 | mountPath: /app/
45 | restartPolicy: Always
46 | volumes:
47 | - name: heplify-server-config-volume
48 | configMap:
49 | name: heplify-server-config
50 | - name: heplify-server-claim0
51 | persistentVolumeClaim:
52 | claimName: heplify-server-claim0
53 | status: {}
54 |
--------------------------------------------------------------------------------
/charts/hepop-elastic/templates/heplify-server-service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | creationTimestamp: null
5 | labels:
6 | io.kompose.service: heplify-server
7 | name: heplify-server
8 | spec:
9 | ports:
10 | - name: "8080"
11 | port: 8080
12 | targetPort: 8080
13 | - name: "9060"
14 | port: 9060
15 | targetPort: 9060
16 | - name: 9060-udp
17 | port: 9060
18 | protocol: UDP
19 | targetPort: 9060
20 | selector:
21 | io.kompose.service: heplify-server
22 | status:
23 | loadBalancer: {}
24 |
--------------------------------------------------------------------------------
/charts/hepop-elastic/templates/telegraf-claim0-persistentvolumeclaim.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: PersistentVolumeClaim
3 | metadata:
4 | creationTimestamp: null
5 | labels:
6 | io.kompose.service: telegraf-claim0
7 | name: telegraf-claim0
8 | spec:
9 | accessModes:
10 | - ReadWriteOnce
11 | resources:
12 | requests:
13 | storage: 100Mi
14 | status: {}
15 |
--------------------------------------------------------------------------------
/charts/hepop-elastic/templates/telegraf-config.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | data:
3 | telegraf.conf: |
4 | # Configuration for influxdb server to send metrics to
5 | [[outputs.influxdb]]
6 | urls = ["http://influxdb:8086/"] # required
7 | database = "homer" # required
8 | retention_policy = ""
9 | write_consistency = "any"
10 | timeout = "5s"
11 | namedrop = ["homer*"]
12 | # # Generic socket listener capable of handling multiple socket types.
13 | [[inputs.socket_listener]]
14 | service_address = "udp://127.0.0.1:8094"
15 | data_format = "influx"
16 | [[inputs.prometheus]]
17 | ## An array of urls to scrape metrics from.
18 | urls = ["http://heplify-server:9096/metrics"]
19 | kind: ConfigMap
20 | metadata:
21 | name: telegraf-config
22 |
--------------------------------------------------------------------------------
/charts/hepop-elastic/templates/telegraf-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: extensions/v1beta1
2 | kind: Deployment
3 | metadata:
4 | annotations:
5 | kompose.cmd: kompose convert
6 | kompose.version: 1.17.0 (a74acad)
7 | creationTimestamp: null
8 | labels:
9 | io.kompose.service: telegraf
10 | name: telegraf
11 | spec:
12 | replicas: 1
13 | strategy:
14 | type: Recreate
15 | template:
16 | metadata:
17 | creationTimestamp: null
18 | labels:
19 | io.kompose.service: telegraf
20 | spec:
21 | containers:
22 | - image: telegraf:1.8-alpine
23 | name: telegraf
24 | ports:
25 | - containerPort: 8094
26 | resources: {}
27 | volumeMounts:
28 | - name: telegraf-config-volume
29 | mountPath: /etc/telegraf
30 | restartPolicy: Always
31 | volumes:
32 | - name: telegraf-config-volume
33 | configMap:
34 | name: telegraf-config
35 | status: {}
36 |
--------------------------------------------------------------------------------
/charts/hepop-elastic/templates/telegraf-service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | annotations:
5 | kompose.cmd: kompose convert
6 | kompose.version: 1.17.0 (a74acad)
7 | creationTimestamp: null
8 | labels:
9 | io.kompose.service: telegraf
10 | name: telegraf
11 | spec:
12 | ports:
13 | - name: "8094"
14 | port: 8094
15 | targetPort: 8094
16 | selector:
17 | io.kompose.service: telegraf
18 | status:
19 | loadBalancer: {}
20 |
--------------------------------------------------------------------------------
/cron-k8s/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM sipcapture/homer-webapp
2 | MAINTAINER L. Mangani
3 | ENV BUILD_DATE 2017-04-17
4 | COPY run.sh /run.sh
5 | RUN chmod a+rx /run.sh
6 | ENTRYPOINT ["/run.sh"]
7 |
--------------------------------------------------------------------------------
/cron-k8s/run.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # ----------------------------------------------------
3 | # HOMER 5 Docker (http://sipcapture.org)
4 | # ----------------------------------------------------
5 | # -- Run script for Homer's cron jobs
6 | # ----------------------------------------------------
7 | # Reads from environment variables to set:
8 | # DB_PASS MySQL password (homer_password)
9 | # DB_USER MySQL user (homer_user)
10 | # DB_HOST MySQL host (127.0.0.1 [docker0 bridge])
11 | # ----------------------------------------------------
12 |
13 | while [[ ! -f "/homer-semaphore/.bootstrapped" ]]; do
14 | echo "Homer cron container, waiting for MySQL"
15 | sleep 2;
16 | done
17 |
18 | # Work around key size constraints (noted in issue @ https://github.com/sipcapture/homer-docker/issues/42)
19 | perl -p -i -e 's/\(`session_id`\)/(`session_id`(255))/' /opt/homer_mysql_rotate.pl
20 | perl -p -i -e 's/\(`correlation_id`\)/(`correlation_id`(255))/' /opt/homer_mysql_rotate.pl
21 |
22 |
23 | # Reconfigure rotation
24 |
25 | # --- I believe these are deprecated (@dougbtv, 3/30/17)
26 | # export PATH_ROTATION_SCRIPT=/opt/homer_rotate
27 | # chmod 775 $PATH_ROTATION_SCRIPT
28 | # chmod +x $PATH_ROTATION_SCRIPT
29 |
30 | export PATH_ROTATION_CONFIG=/opt/rotation.ini
31 |
32 | perl -p -i -e "s/homer_user/$DB_USER/" $PATH_ROTATION_CONFIG
33 | perl -p -i -e "s/homer_password/$DB_PASS/" $PATH_ROTATION_CONFIG
34 | perl -p -i -e "s/localhost/$DB_HOST/" $PATH_ROTATION_CONFIG
35 |
36 | # --- I believe these are deprecated (@dougbtv, 3/30/17)
37 | # PERL_SCRIPTS=(/opt/homer_mysql_new_table.pl /opt/homer_mysql_partrotate_unixtimestamp.pl)
38 | # for perl_script in ${PERL_SCRIPTS[@]}
39 | # do
40 | # perl -p -i -e "s/homer_user/$DB_USER/" $perl_script
41 | # perl -p -i -e "s/homer_password/$DB_PASS/" $perl_script
42 | # perl -p -i -e "s/mysql_host = \"localhost\"/mysql_host = \"$DB_HOST\"/" $perl_script
43 | # done
--------------------------------------------------------------------------------
/cron/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM debian:jessie
2 | MAINTAINER L. Mangani
3 | # v.5.02
4 |
5 | # Default baseimage settings
6 | ENV HOME /root
7 | ENV DEBIAN_FRONTEND noninteractive
8 |
9 | ENV BUILD_DATE 2018-08-12
10 |
11 | # Update and upgrade apt
12 | RUN apt-get update -qq
13 | # RUN apt-get upgrade -y
14 | RUN apt-get install --no-install-recommends --no-install-suggests -yqq ca-certificates apache2 libapache2-mod-php5 php5 php5-cli php5-gd php-pear php5-dev php5-mysql php5-json php-services-json git wget pwgen perl libdbi-perl libclass-dbi-mysql-perl && rm -rf /var/lib/apt/lists/*
15 | RUN a2enmod php5
16 |
17 | # HOMER 5
18 | ENV HOMER_VERSION_CACHE_BUSTER arbitrary_value_0x000000d00d
19 |
20 | RUN git clone https://github.com/sipcapture/homer-api.git /homer-api && cd /homer-api
21 | RUN git clone https://github.com/sipcapture/homer-ui.git /homer-ui && cd /homer-ui && git checkout 941954f20c462f89853133424775cce5c48c42ed
22 |
23 | WORKDIR /
24 |
25 | RUN chmod -R +x /homer-api/scripts/mysql/*
26 | RUN cp -R /homer-api/scripts/mysql/. /opt/
27 |
28 | RUN cp -R /homer-ui/* /var/www/html/
29 | RUN cp -R /homer-api/api /var/www/html/
30 | RUN chown -R www-data:www-data /var/www/html/store/
31 | RUN chmod -R 0775 /var/www/html/store/dashboard
32 |
33 | COPY configuration.php /var/www/html/api/configuration.php
34 | COPY preferences.php /var/www/html/api/preferences.php
35 | COPY vhost.conf /etc/apache2/sites-enabled/000-default.conf
36 |
37 | # Add persistent volumes
38 | VOLUME ["/var/www/html/store"]
39 |
40 | # Install the cron service
41 | RUN touch /var/log/cron.log
42 | RUN apt-get update -qq && apt-get install cron mysql-client -y && rm -rf /var/lib/apt/lists/*
43 |
44 | # Add our crontab file
45 | RUN echo "30 3 * * * /opt/homer_mysql_rotate.pl >> /var/log/cron.log 2>&1" > /crons.conf
46 | RUN crontab /crons.conf
47 |
48 | COPY rotation.ini /opt/rotation.ini
49 |
50 | COPY run.sh /run.sh
51 | RUN chmod a+rx /run.sh
52 |
53 | ENTRYPOINT ["/run.sh"]
54 |
--------------------------------------------------------------------------------
/cron/configuration.php:
--------------------------------------------------------------------------------
1 |
24 |
--------------------------------------------------------------------------------
/cron/preferences.php:
--------------------------------------------------------------------------------
1 |
80 |
--------------------------------------------------------------------------------
/cron/rotation.ini:
--------------------------------------------------------------------------------
1 | # --------------------------------------------
2 | # Rotation parameters - -
3 | # --------------------------------------------
4 | # Customize here for purge horizons.
5 |
6 | # BUT DON'T change the mysql options!
7 | # The run.sh will change these dynamically for you base on environment variables
8 |
9 | [MYSQL]
10 | user = homer_user
11 | password = homer_password
12 | host = localhost
13 | port = 3306
14 | usesocket = 0
15 | socket = /var/run/mysqld/mysqld.sock
16 | db_data = homer_data
17 | db_stats = homer_statistic
18 | # Extra param
19 | newtables = 2 # Create new tables or partitions for next 2 days
20 | engine = InnoDB #MyISAM or InnoDB
21 | compress=ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8
22 |
23 | [DATA_TABLE_ROTATION]
24 | #how long data keeps
25 | sip_capture_call = 10 #days
26 | sip_capture_registration = 10 # 10 days
27 | sip_capture_rest = 10 # 10 days
28 | rtcp_capture_all = 10 # days
29 | logs_capture = 10 # days
30 | report_capture = 10 # days
31 | webrtc_capture_all = 10 # days
32 | isup_capture_all = 10
33 |
34 | [DATA_TABLE_TYPE_TIMESTAMP]
35 | #type: sip, isup, webrtc, rtcp
36 | sip_capture_call = sip
37 | sip_capture_registration = sip
38 | sip_capture_rest = sip
39 | isup_capture_all = isup
40 | rtcp_capture_all = rtcp
41 | webrtc_capture_all = webrtc
42 |
43 | [DATA_TABLE_STEP]
44 | # 0 - Day, 1 - Hour, 2 - 30 Minutes, 3 - 15 Minutes
45 | sip_capture_call = 0
46 | sip_capture_registration = 0
47 | sip_capture_rest = 0
48 | rtcp_capture_all = 0
49 | logs_capture = 0
50 | webrtc_capture_all = 0
51 | isup_capture_all = 0
52 |
53 | [DROP_OLD_PARTITIONS]
54 | # Remove partitions older than $seconds
55 | # Ignored if zero
56 | sip_capture_call = 0
57 | sip_capture_registration = 0
58 | sip_capture_rest = 0
59 | rtcp_capture_all = 0
60 | logs_capture = 0
61 | report_capture = 0
62 | isup_capture_all = 0
63 | webrtc_capture_all = 0
64 |
65 | [STATS_TABLE_ROTATION]
66 | stats_ip = 20 # days
67 | stats_geo = 20 # days
68 | alarm_data = 10 # days
69 | stats_method = 10 # days
70 | stats_useragent = 20 # days
71 |
72 | [STATS_TABLE_STEP]
73 | #0 - Day, 1 - Hour, 2 - 30 Minutes, 3 - 15 Minutes
74 | stats_ip = 0
75 | stats_geo = 0
76 | alarm_data = 0
77 | stats_method = 0
78 | stats_useragent = 0
79 |
80 | [SYSTEM]
81 | debug = 0
82 | exec = 1
83 |
84 | [MSG_TABLE_SIZE]
85 | #characters
86 | sip_capture_call = 1500
87 | isup_capture_all = 3000
88 | webrtc_capture_all = 3000
89 | rtcp_capture_all = 1500
90 |
--------------------------------------------------------------------------------
/cron/run.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # ----------------------------------------------------
3 | # HOMER 5 Docker (http://sipcapture.org)
4 | # ----------------------------------------------------
5 | # -- Run script for Homer's cron jobs
6 | # ----------------------------------------------------
7 | # Reads from environment variables to set:
8 | # DB_PASS MySQL password (homer_password)
9 | # DB_USER MySQL user (homer_user)
10 | # DB_HOST MySQL host (127.0.0.1 [docker0 bridge])
11 | # ----------------------------------------------------
12 |
13 | while [[ ! -f "/homer-semaphore/.bootstrapped" ]]; do
14 | echo "Homer cron container, waiting for MySQL"
15 | sleep 2;
16 | done
17 |
18 | # Work around key size constraints (noted in issue @ https://github.com/sipcapture/homer-docker/issues/42)
19 | perl -p -i -e 's/\(`session_id`\)/(`session_id`(255))/' /opt/homer_mysql_rotate.pl
20 | perl -p -i -e 's/\(`correlation_id`\)/(`correlation_id`(255))/' /opt/homer_mysql_rotate.pl
21 |
22 |
23 | # Reconfigure rotation
24 |
25 | # --- I believe these are deprecated (@dougbtv, 3/30/17)
26 | # export PATH_ROTATION_SCRIPT=/opt/homer_rotate
27 | # chmod 775 $PATH_ROTATION_SCRIPT
28 | # chmod +x $PATH_ROTATION_SCRIPT
29 |
30 | export PATH_ROTATION_CONFIG=/opt/rotation.ini
31 |
32 | perl -p -i -e "s/homer_user/$DB_USER/" $PATH_ROTATION_CONFIG
33 | perl -p -i -e "s/homer_password/$DB_PASS/" $PATH_ROTATION_CONFIG
34 | perl -p -i -e "s/localhost/$DB_HOST/" $PATH_ROTATION_CONFIG
35 |
36 | # --- I believe these are deprecated (@dougbtv, 3/30/17)
37 | # PERL_SCRIPTS=(/opt/homer_mysql_new_table.pl /opt/homer_mysql_partrotate_unixtimestamp.pl)
38 | # for perl_script in ${PERL_SCRIPTS[@]}
39 | # do
40 | # perl -p -i -e "s/homer_user/$DB_USER/" $perl_script
41 | # perl -p -i -e "s/homer_password/$DB_PASS/" $perl_script
42 | # perl -p -i -e "s/mysql_host = \"localhost\"/mysql_host = \"$DB_HOST\"/" $perl_script
43 | # done
44 |
45 | # Init rotation
46 | /opt/homer_mysql_rotate.pl
47 |
48 | # Ensure cron is allowed to run
49 | sed -i 's/^\(session\s\+required\s\+pam_loginuid\.so.*$\)/# \1/g' /etc/pam.d/cron
50 |
51 | # Start the cron service in the foreground, which will run rotation
52 | cron -f
53 |
--------------------------------------------------------------------------------
/cron/vhost.conf:
--------------------------------------------------------------------------------
1 |
2 | ServerName homer
3 |
4 | # SSLEngine on
5 | # SSLCertificateFile /etc/ssl/localcerts/apache.pem
6 | # SSLCertificateKeyFile /etc/ssl/localcerts/apache.key
7 |
8 | # Indexes + Directory Root.
9 | DirectoryIndex index.php index.html index.htm
10 | DocumentRoot /var/www/html
11 |
12 |
13 | Options FollowSymLinks
14 | AllowOverride None
15 |
16 |
17 | Options Indexes FollowSymLinks MultiViews
18 | AllowOverride All
19 | Order allow,deny
20 | allow from all
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '2'
2 | services:
3 | # --------------------------------------------- Web app container
4 | webapp:
5 | container_name: homer-webapp
6 | build: ./webapp/.
7 | image: sipcapture/homer-webapp
8 | ports:
9 | - "80:80"
10 | depends_on:
11 | - mysql
12 | volumes:
13 | - /homer-api/
14 | - homer-data-semaphore:/homer-semaphore/
15 | - homer-data-dashboard:/var/www/html/store/dashboard/
16 | links:
17 | - "mysql:mysql"
18 | env_file:
19 | - ./homer.env
20 | restart: always
21 | # --------------------------------------------- cron container
22 | cron:
23 | container_name: homer-cron
24 | build: ./cron/.
25 | image: sipcapture/homer-cron
26 | depends_on:
27 | - mysql
28 | volumes:
29 | - homer-data-semaphore:/homer-semaphore/
30 | links:
31 | - "mysql:mysql"
32 | env_file:
33 | - ./homer.env
34 | restart: always
35 | # --------------------------------------------- Kamailio container
36 | kamailio:
37 | container_name: homer-kamailio
38 | build: ./kamailio/.
39 | image: sipcapture/homer-kamailio
40 | ports:
41 | - "9060:9060/udp"
42 | depends_on:
43 | - mysql
44 | links:
45 | - "mysql:mysql"
46 | volumes:
47 | - homer-data-semaphore:/homer-semaphore/
48 | # entrypoint:
49 | # - /bin/bash
50 | # command:
51 | # >
52 | # -c 'while true; do sleep 60; done;'
53 | env_file:
54 | - ./homer.env
55 | restart: always
56 | # --------------------------------------------- Data bootstrapping container
57 | # debug with:
58 | # docker run -it --volumes-from homer-webapp --network homerdocker_default --link mysql:mysql mysql:5.6 /bin/bash
59 | bootstrap:
60 | container_name: bootstrap-mysql
61 | image: mysql:5.6
62 | depends_on:
63 | - mysql
64 | - webapp
65 | links:
66 | - "mysql:mysql"
67 | volumes_from:
68 | - webapp
69 | volumes:
70 | - homer-data-semaphore:/homer-semaphore/
71 | - ./bootstrap-data/bootstrap.sh:/bootstrap.sh
72 | # entrypoint:
73 | # - /bin/bash
74 | # command:
75 | # >
76 | # -c 'while true; do sleep 60; done;'
77 | entrypoint:
78 | - /bootstrap.sh
79 | env_file:
80 | - ./homer.env
81 | # --------------------------------------------- MySQL container.
82 | mysql:
83 | container_name: mysql
84 | image: mysql:5.6
85 | volumes:
86 | - ./mysql/run.sh:/run.sh
87 | - homer-data-semaphore:/homer-semaphore/
88 | - homer-data-mysql:/var/lib/mysql
89 | entrypoint:
90 | - /run.sh
91 | env_file:
92 | - ./homer.env
93 | restart: always
94 | volumes:
95 | homer-data-semaphore:
96 | homer-data-mysql:
97 | homer-data-dashboard:
98 |
--------------------------------------------------------------------------------
/everything/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM debian:jessie
2 | MAINTAINER L. Mangani
3 | # v.5.02
4 |
5 | # Default baseimage settings
6 | ENV HOME /root
7 | ENV DEBIAN_FRONTEND noninteractive
8 |
9 | # Update and upgrade apt
10 | RUN apt-get update -qq
11 | # RUN apt-get upgrade -y
12 | RUN apt-get install --no-install-recommends --no-install-suggests -yqq ca-certificates apache2 libapache2-mod-php5 php5 php5-ldap php5-cli php5-gd php-pear php5-dev php5-mysql php5-json php-services-json git wget pwgen && rm -rf /var/lib/apt/lists/*
13 | RUN a2enmod php5
14 |
15 | # MySQL
16 | RUN groupadd -r mysql && useradd -r -g mysql mysql
17 | RUN mkdir /docker-entrypoint-initdb.d
18 |
19 | # Perl + MySQL DBI
20 | RUN apt-get update && apt-get install -y perl libdbi-perl libclass-dbi-mysql-perl --no-install-recommends && rm -rf /var/lib/apt/lists/*
21 |
22 | # gpg: key 5072E1F5: public key "MySQL Release Engineering " imported
23 | RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5
24 | ENV MYSQL_MAJOR 5.7
25 | ENV MYSQL_VERSION 5.6.27
26 | RUN echo "deb http://repo.mysql.com/apt/debian/ jessie mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list
27 |
28 | RUN apt-get update && apt-get install -y mysql-server libmysqlclient18 && rm -rf /var/lib/apt/lists/* \
29 | && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql
30 |
31 | # comment out a few problematic configuration values
32 | # don't reverse lookup hostnames, they are usually another container
33 | RUN sed -Ei 's/^(bind-address|log)/#&/' /etc/mysql/my.cnf \
34 | && echo 'skip-host-cache\nskip-name-resolve' | awk '{ print } $1 == "[mysqld]" && c == 0 { c = 1; system("cat") }' /etc/mysql/my.cnf > /tmp/my.cnf \
35 | && mv /tmp/my.cnf /etc/mysql/my.cnf
36 |
37 | RUN mkdir -p /var/lib/mysql/
38 | RUN chmod -R 755 /var/lib/mysql/
39 |
40 | WORKDIR /
41 |
42 | # HOMER 5
43 | RUN git clone --depth 1 https://github.com/sipcapture/homer-api.git /homer-api
44 | RUN git clone --depth 1 https://github.com/sipcapture/homer-ui.git /homer-ui
45 |
46 | RUN chmod -R +x /homer-api/scripts/mysql/*
47 | RUN cp -R /homer-api/scripts/mysql/. /opt/
48 |
49 | RUN cp -R /homer-ui/* /var/www/html/
50 | RUN cp -R /homer-api/api /var/www/html/
51 | RUN chown -R www-data:www-data /var/www/html/store/
52 | RUN chmod -R 0775 /var/www/html/store/dashboard
53 |
54 | RUN wget https://raw.githubusercontent.com/sipcapture/homer-config/master/docker/configuration.php -O /var/www/html/api/configuration.php
55 | RUN wget https://raw.githubusercontent.com/sipcapture/homer-config/master/docker/preferences.php -O /var/www/html/api/preferences.php
56 | RUN wget https://raw.githubusercontent.com/sipcapture/homer-config/master/docker/vhost.conf -O /etc/apache2/sites-enabled/000-default.conf
57 |
58 | # Kamailio + sipcapture module
59 | RUN apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xfb40d3e6508ea4c8
60 | RUN echo "deb http://deb.kamailio.org/kamailio jessie main" >> etc/apt/sources.list
61 | RUN echo "deb-src http://deb.kamailio.org/kamailio jessie main" >> etc/apt/sources.list
62 | RUN apt-get update -qq && apt-get install -f -yqq kamailio rsyslog kamailio-outbound-modules kamailio-geoip-modules kamailio-sctp-modules kamailio-tls-modules kamailio-websocket-modules kamailio-utils-modules kamailio-mysql-modules kamailio-extra-modules && rm -rf /var/lib/apt/lists/*
63 |
64 | COPY data/kamailio.cfg /etc/kamailio/kamailio.cfg
65 | RUN chmod 775 /etc/kamailio/kamailio.cfg
66 |
67 | RUN ln -s /usr/lib64 /usr/lib/x86_64-linux-gnu/
68 |
69 | # GeoIP (http://dev.maxmind.com/geoip/legacy/geolite/)
70 | RUN apt-get update -qq && apt-get install -f -yqq geoip-database geoip-database-extra
71 | # RUN cd /usr/share/GeoIP && wget -N -q http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz && gunzip GeoLiteCity.dat.gz
72 |
73 | # Install the cron service
74 | RUN touch /var/log/cron.log
75 | RUN apt-get install cron -y
76 |
77 | # Add our crontab file
78 | RUN echo "30 3 * * * /opt/homer_mysql_rotate >> /var/log/cron.log 2>&1" > /crons.conf
79 | RUN crontab /crons.conf
80 |
81 | COPY run.sh /run.sh
82 | RUN chmod a+rx /run.sh
83 |
84 | # Add persistent MySQL volumes
85 | VOLUME ["/etc/mysql", "/var/lib/mysql", "/var/www/html/store"]
86 |
87 | # UI
88 | EXPOSE 80
89 | # HEP
90 | EXPOSE 9060
91 | # MySQL
92 | #EXPOSE 3306
93 |
94 | ENTRYPOINT ["/run.sh"]
95 |
--------------------------------------------------------------------------------
/everything/data/configuration.php:
--------------------------------------------------------------------------------
1 |
24 |
--------------------------------------------------------------------------------
/everything/data/preferences.php:
--------------------------------------------------------------------------------
1 |
80 |
--------------------------------------------------------------------------------
/everything/data/vhost.conf:
--------------------------------------------------------------------------------
1 |
2 | ServerName homer
3 |
4 | # SSLEngine on
5 | # SSLCertificateFile /etc/ssl/localcerts/apache.pem
6 | # SSLCertificateKeyFile /etc/ssl/localcerts/apache.key
7 |
8 | # Indexes + Directory Root.
9 | DirectoryIndex index.php index.html index.htm
10 | DocumentRoot /var/www/html
11 |
12 |
13 | Options FollowSymLinks
14 | AllowOverride None
15 |
16 |
17 | Options Indexes FollowSymLinks MultiViews
18 | AllowOverride All
19 | Order allow,deny
20 | allow from all
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/hepgen/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:7.7
2 | MAINTAINER @qxip (twitter)
3 | RUN git clone https://github.com/sipcapture/hepgen.js.git
4 | WORKDIR hepgen.js
5 | RUN npm install
6 | ENTRYPOINT node hepgen.js
--------------------------------------------------------------------------------
/heplify-server/hom5-hep-elastic/README.md:
--------------------------------------------------------------------------------
1 | Homer 5, heplify-server, Elasticsearch
2 | ========
3 |
4 | ## Setup
5 |
6 | ```bash
7 | docker-compose up
8 | ```
9 |
10 | to bring up:
11 |
12 | * HEPlify-server localhost:9060 (hep-only)
13 | * Homer localhost:9080 (admin/test123)
14 | * Telegraf
15 | * Kibana localhost:9070
16 | * Elasticsearch
17 |
18 |
19 | ### Notes
20 | #### Timelion CPS and RPS
21 | The following Timelion expression can be used to graph CPS and RPS from HOMER statistics stored in Elasticsearch:
22 | ##### Registrations per Second
23 | ```
24 | .es(index=hep-*, timefield=@timestamp,q='measurement_name:"heplify_method_response" AND tag.method:"REGISTER" AND tag.response:"200"', metric=max:heplify_method_response.counter).derivative().abs().mvavg(1m).scale_interval(1s).yaxis(min=0).color(orange).lines(fill=2,width=1).label("RPS").legend(position=nw,showTime=true)
25 | ```
26 | ##### Calls per Second
27 | ```
28 | .es(index=hep-*, timefield=@timestamp,q='measurement_name:"heplify_method_response" AND tag.method:"INVITE" AND tag.response:"200"', metric=avg:heplify_method_response.counter).derivative().mvavg(1m).scale_interval(1s).yaxis(min=0).color(green).lines(fill=1,width=1).label("CPS").legend(position=nw,showTime=true)
29 | ```
30 | ##### Failures per Second
31 | ```
32 | .es(index=hep-*, timefield=@timestamp,q='measurement_name:"heplify_method_response" AND tag.method:"INVITE" AND (tag.response:"407" or tag.response:"401")', metric=avg:heplify_method_response.counter).derivative().mvavg(1m).scale_interval(1s).yaxis(min=0).color(red).bars(stack=true).label("FPS").legend(position=nw,showTime=true)
33 | ```
34 |
35 |
36 |
--------------------------------------------------------------------------------
/heplify-server/hom5-hep-elastic/caddy/Caddyfile:
--------------------------------------------------------------------------------
1 |
2 | :9090 {
3 | basicauth / {$ADMIN_USER} {$ADMIN_PASSWORD}
4 | proxy / kibana:5601 {
5 | transparent
6 | }
7 |
8 | errors stderr
9 | tls off
10 | }
11 |
12 | :9080 {
13 | proxy / homer-webapp:80 {
14 | transparent
15 | }
16 |
17 | errors stderr
18 | tls off
19 | }
20 |
--------------------------------------------------------------------------------
/heplify-server/hom5-hep-elastic/conf/homer_dashboard.json:
--------------------------------------------------------------------------------
1 | {"id":1,"cells":[{"i":"741da399-1d0b-4751-98da-04019bb9099e","x":0,"y":3,"w":12,"h":3,"name":"RTCP Jitter","queries":[{"query":"SELECT mean(\"gauge\") AS \"mean_gauge\" FROM \"homer\".\"60s\".\"heplify_rtcp_jitter\" WHERE time \u003e :dashboardTime: GROUP BY time(:interval:) FILL(null)","queryConfig":{"database":"homer","measurement":"heplify_rtcp_jitter","retentionPolicy":"60s","fields":[{"value":"mean","type":"func","alias":"mean_gauge","args":[{"value":"gauge","type":"field","alias":""}]}],"tags":{},"groupBy":{"time":"auto","tags":[]},"areTagsAccepted":false,"fill":"null","rawText":null,"range":null,"shifts":null},"source":"/chronograf/v1/sources/0"}],"axes":{"x":{"bounds":["",""],"label":"","prefix":"","suffix":"","base":"10","scale":"linear"},"y":{"bounds":["",""],"label":"","prefix":"","suffix":" ms","base":"10","scale":"linear"},"y2":{"bounds":["",""],"label":"","prefix":"","suffix":"","base":"10","scale":"linear"}},"type":"line","colors":[{"id":"d0af32a4-8a50-405f-80d7-61523c30a3ec","type":"scale","hex":"#31C0F6","name":"Nineteen Eighty Four","value":"0"},{"id":"b2a97322-ff7a-4164-be86-b6d3fc9e2d56","type":"scale","hex":"#A500A5","name":"Nineteen Eighty Four","value":"0"},{"id":"13ee385d-caed-4d55-a04f-9dd99f7bfe85","type":"scale","hex":"#FF7E27","name":"Nineteen Eighty Four","value":"0"}],"legend":{},"tableOptions":{"verticalTimeAxis":true,"sortBy":{"internalName":"time","displayName":"","visible":true},"wrapping":"truncate","fixFirstColumn":true},"fieldOptions":[{"internalName":"time","displayName":"","visible":true}],"timeFormat":"MM/DD/YYYY HH:mm:ss","decimalPlaces":{"isEnforced":false,"digits":3},"links":{"self":"/chronograf/v1/dashboards/1/cells/741da399-1d0b-4751-98da-04019bb9099e"}},{"i":"06763dec-bc1c-4dff-9f66-0d34dbb02acf","x":0,"y":0,"w":12,"h":3,"name":"SIP METHODS","queries":[{"query":"SELECT derivative(last(\"counter\")) AS \"diff_counter\" FROM \"homer\".\"60s\".\"heplify_method_response\" WHERE time \u003e :dashboardTime: GROUP BY time(:interval:), \"method\", \"response\" FILL(null)","queryConfig":{"database":"","measurement":"","retentionPolicy":"","fields":[],"tags":{},"groupBy":{"time":"","tags":[]},"areTagsAccepted":false,"rawText":"SELECT derivative(last(\"counter\")) AS \"diff_counter\" FROM \"homer\".\"60s\".\"heplify_method_response\" WHERE time \u003e :dashboardTime: GROUP BY time(:interval:), \"method\", \"response\" FILL(null)","range":null,"shifts":null},"source":"/chronograf/v1/sources/0"}],"axes":{"x":{"bounds":["",""],"label":"","prefix":"","suffix":"","base":"10","scale":"linear"},"y":{"bounds":["",""],"label":"","prefix":"","suffix":"","base":"10","scale":"linear"},"y2":{"bounds":["",""],"label":"","prefix":"","suffix":"","base":"10","scale":"linear"}},"type":"line","colors":[{"id":"d0af32a4-8a50-405f-80d7-61523c30a3ec","type":"scale","hex":"#31C0F6","name":"Nineteen Eighty Four","value":"0"},{"id":"b2a97322-ff7a-4164-be86-b6d3fc9e2d56","type":"scale","hex":"#A500A5","name":"Nineteen Eighty Four","value":"0"},{"id":"13ee385d-caed-4d55-a04f-9dd99f7bfe85","type":"scale","hex":"#FF7E27","name":"Nineteen Eighty Four","value":"0"}],"legend":{},"tableOptions":{"verticalTimeAxis":true,"sortBy":{"internalName":"time","displayName":"","visible":true},"wrapping":"truncate","fixFirstColumn":true},"fieldOptions":[{"internalName":"time","displayName":"","visible":true}],"timeFormat":"MM/DD/YYYY HH:mm:ss","decimalPlaces":{"isEnforced":false,"digits":3},"links":{"self":"/chronograf/v1/dashboards/1/cells/06763dec-bc1c-4dff-9f66-0d34dbb02acf"}}],"templates":[],"name":"Name This Dashboard","organization":"default","links":{"self":"/chronograf/v1/dashboards/1","cells":"/chronograf/v1/dashboards/1/cells","templates":"/chronograf/v1/dashboards/1/templates"}}
2 |
--------------------------------------------------------------------------------
/heplify-server/hom5-hep-elastic/conf/retention.policy:
--------------------------------------------------------------------------------
1 | use homer;
2 | CREATE RETENTION POLICY "60s" ON "homer" DURATION 4w REPLICATION 1 DEFAULT;
3 | CREATE RETENTION POLICY "300s" ON "homer" DURATION 8w REPLICATION 1;
4 | CREATE RETENTION POLICY "3600s" ON "homer" DURATION 16w REPLICATION 1;
5 | CREATE RETENTION POLICY "86400s" ON "homer" DURATION 32w REPLICATION 1;
6 |
7 | CREATE CONTINUOUS QUERY cq_300s ON homer RESAMPLE EVERY 1m BEGIN SELECT mean(*) INTO homer."300s".:MEASUREMENT FROM homer."60s"./.*/ GROUP BY time(5m),* END
8 | CREATE CONTINUOUS QUERY cq_3600s ON homer RESAMPLE EVERY 10m BEGIN SELECT mean(*) INTO homer."3600s".:MEASUREMENT FROM homer."60s"./.*/ GROUP BY time(1h),* END
9 | CREATE CONTINUOUS QUERY cq_86400s ON homer RESAMPLE EVERY 1h BEGIN SELECT mean(*) INTO homer."86400s".:MEASUREMENT FROM homer."60s"./.*/ GROUP BY time(1d),* END
10 |
11 | drop retention policy "autogen" ON "homer"
12 |
--------------------------------------------------------------------------------
/heplify-server/hom5-hep-elastic/conf/telegraf.conf:
--------------------------------------------------------------------------------
1 | # Configuration for influxdb server to send metrics to
2 | [[outputs.elasticsearch]]
3 | ## The full HTTP endpoint URL for your Elasticsearch instance
4 | ## Multiple urls can be specified as part of the same cluster,
5 | ## this means that only ONE of the urls will be written to each interval.
6 | urls = [ "http://elasticsearch:9200" ] # required.
7 | ## Elasticsearch client timeout, defaults to "5s" if not set.
8 | timeout = "5s"
9 | ## Set to true to ask Elasticsearch a list of all cluster nodes,
10 | ## thus it is not necessary to list all nodes in the urls config option
11 | enable_sniffer = false
12 | ## Set the interval to check if the Elasticsearch nodes are available
13 | ## Setting to "0s" will disable the health check (not recommended in production)
14 | health_check_interval = "10s"
15 | ## HTTP basic authentication details (eg. when using Shield)
16 | # username = "telegraf"
17 | # password = "mypassword"
18 |
19 | ## Index Config
20 | ## The target index for metrics (Elasticsearch will create if it not exists).
21 | ## You can use the date specifiers below to create indexes per time frame.
22 | ## The metric timestamp will be used to decide the destination index name
23 | # %Y - year (2016)
24 | # %y - last two digits of year (00..99)
25 | # %m - month (01..12)
26 | # %d - day of month (e.g., 01)
27 | # %H - hour (00..23)
28 | # %V - week of the year (ISO week) (01..53)
29 | ## Additionally, you can specify a tag name using the notation {{tag_name}}
30 | ## which will be used as part of the index name. If the tag does not exist,
31 | ## the default tag value will be used.
32 | # index_name = "telegraf-{{host}}-%Y.%m.%d"
33 | # default_tag_value = "none"
34 | index_name = "hep-%Y.%m.%d" # required.
35 |
36 | ## Optional TLS Config
37 | # tls_ca = "/etc/telegraf/ca.pem"
38 | # tls_cert = "/etc/telegraf/cert.pem"
39 | # tls_key = "/etc/telegraf/key.pem"
40 | ## Use TLS but skip chain & host verification
41 | # insecure_skip_verify = false
42 |
43 | ## Template Config
44 | ## Set to true if you want telegraf to manage its index template.
45 | ## If enabled it will create a recommended index template for telegraf indexes
46 | manage_template = true
47 | ## The template name used for telegraf indexes
48 | template_name = "heplify"
49 | ## Set to true if you want telegraf to overwrite an existing template
50 | overwrite_template = false
51 | namedrop = ["go*","process*","promhttp*"]
52 | fielddrop = ["go*"]
53 |
54 | # # Generic socket listener capable of handling multiple socket types.
55 | [[inputs.socket_listener]]
56 | service_address = "udp://127.0.0.1:8094"
57 | data_format = "influx"
58 | namedrop = ["go*","process*","promhttp*"]
59 | fielddrop = ["go*"]
60 |
61 | [[inputs.prometheus]]
62 | ## An array of urls to scrape metrics from.
63 | urls = ["http://heplify-server:9096/metrics"]
64 | namedrop = ["go*","process*","promhttp*"]
65 | fielddrop = ["go*"]
66 |
67 |
--------------------------------------------------------------------------------
/heplify-server/hom5-hep-elastic/docker-compose-ext.yml:
--------------------------------------------------------------------------------
1 | version: '3.1'
2 |
3 | services:
4 | caddy:
5 | container_name: caddy
6 | image: stefanprodan/caddy
7 | container_name: caddy
8 | ports:
9 | - "3000:3000"
10 | - "9090:9090"
11 | - "9093:9093"
12 | - "9080:9080"
13 | volumes:
14 | - ./caddy/:/etc/caddy/
15 | environment:
16 | - ADMIN_USER=${ADMIN_USER:-admin}
17 | - ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin}
18 | restart: unless-stopped
19 | labels:
20 | org.label-schema.group: "monitoring"
21 |
22 | db:
23 | container_name: db
24 | image: mariadb:latest
25 | environment:
26 | - "MYSQL_ROOT_PASSWORD="
27 | - "MYSQL_ALLOW_EMPTY_PASSWORD=yes"
28 | - "MYSQL_ROOT_HOST=%"
29 | expose:
30 | - 3306
31 | restart: unless-stopped
32 |
33 | heplify-server:
34 | image: sipcapture/heplify-server:latest
35 | container_name: heplify-server
36 | ports:
37 | - "9060:9060"
38 | - "9060:9060/udp"
39 | command:
40 | - './heplify-server'
41 | environment:
42 | - "HEPLIFYSERVER_HEPADDR=0.0.0.0:9060"
43 | - "HEPLIFYSERVER_DBDRIVER=mysql"
44 | - "HEPLIFYSERVER_DBADDR=db:3306"
45 | - "HEPLIFYSERVER_DBUSER=root"
46 | - "HEPLIFYSERVER_DBPASS="
47 | - "HEPLIFYSERVER_LOGLVL=info"
48 | - "HEPLIFYSERVER_LOGSTD=true"
49 | - "HEPLIFYSERVER_PROMADDR=0.0.0.0:9096"
50 | - "HEPLIFYSERVER_PROMTARGETIP="
51 | - "HEPLIFYSERVER_PROMTARGETNAME="
52 | - "HEPLIFYSERVER_DBDROPDAYS=7"
53 | # - "HEPLIFYSERVER_ESADDR=http://elasticsearch:9200"
54 | restart: unless-stopped
55 | expose:
56 | - 9096
57 | depends_on:
58 | - db
59 | labels:
60 | org.label-schema.group: "monitoring"
61 |
62 | homer-webapp:
63 | container_name: homer-webapp
64 | image: sipcapture/homer-webapp
65 | environment:
66 | - "DB_HOST=db"
67 | - "DB_USER=root"
68 | - "DB_PASS="
69 | expose:
70 | - 80
71 | volumes:
72 | - ./docker-compose.yml:/homer-semaphore/.bootstrapped
73 | restart: unless-stopped
74 | depends_on:
75 | - db
76 | version: '3.1'
77 |
78 | services:
79 | caddy:
80 | container_name: caddy
81 | image: stefanprodan/caddy
82 | container_name: caddy
83 | ports:
84 | - "3000:3000"
85 | - "9090:9090"
86 | - "9093:9093"
87 | - "9080:9080"
88 | volumes:
89 | - ./caddy/:/etc/caddy/
90 | environment:
91 | - ADMIN_USER=${ADMIN_USER:-admin}
92 | - ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin}
93 | restart: unless-stopped
94 | labels:
95 | org.label-schema.group: "monitoring"
96 |
97 | db:
98 | container_name: db
99 | image: mariadb:latest
100 | environment:
101 | - "MYSQL_ROOT_PASSWORD="
102 | - "MYSQL_ALLOW_EMPTY_PASSWORD=yes"
103 | - "MYSQL_ROOT_HOST=%"
104 | expose:
105 | - 3306
106 | restart: unless-stopped
107 |
108 | heplify-server:
109 | image: sipcapture/heplify-server:latest
110 | container_name: heplify-server
111 | ports:
112 | - "9060:9060"
113 | - "9060:9060/udp"
114 | command:
115 | - './heplify-server'
116 | environment:
117 | - "HEPLIFYSERVER_HEPADDR=0.0.0.0:9060"
118 | - "HEPLIFYSERVER_DBDRIVER=mysql"
119 | - "HEPLIFYSERVER_DBADDR=db:3306"
120 | - "HEPLIFYSERVER_DBUSER=root"
121 | - "HEPLIFYSERVER_DBPASS="
122 | - "HEPLIFYSERVER_LOGLVL=info"
123 | - "HEPLIFYSERVER_LOGSTD=true"
124 | - "HEPLIFYSERVER_PROMADDR=0.0.0.0:9096"
125 | - "HEPLIFYSERVER_PROMTARGETIP="
126 | - "HEPLIFYSERVER_PROMTARGETNAME="
127 | - "HEPLIFYSERVER_DBDROPDAYS=7"
128 | restart: unless-stopped
129 | expose:
130 | - 9096
131 | depends_on:
132 | - db
133 | labels:
134 | org.label-schema.group: "monitoring"
135 |
136 | homer-webapp:
137 | container_name: homer-webapp
138 | image: sipcapture/homer-webapp
139 | environment:
140 | - "DB_HOST=db"
141 | - "DB_USER=root"
142 | - "DB_PASS="
143 | expose:
144 | - 80
145 | volumes:
146 | - ./docker-compose.yml:/homer-semaphore/.bootstrapped
147 | restart: unless-stopped
148 | depends_on:
149 | - db
150 |
151 | telegraf:
152 | image: telegraf:1.5-alpine
153 | restart: unless-stopped
154 | volumes:
155 | - ./conf/telegraf.conf:/etc/telegraf/telegraf.conf
156 | ports:
157 | - "8092:8092/udp"
158 | - "8125:8125/udp"
159 | depends_on:
160 | - heplify-server
161 |
--------------------------------------------------------------------------------
/heplify-server/hom5-hep-elastic/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.1'
2 |
3 | services:
4 | caddy:
5 | container_name: caddy
6 | image: stefanprodan/caddy
7 | container_name: caddy
8 | ports:
9 | - "3000:3000"
10 | - "9090:9090"
11 | - "9093:9093"
12 | - "9080:9080"
13 | volumes:
14 | - ./caddy/:/etc/caddy/
15 | environment:
16 | - ADMIN_USER=${ADMIN_USER:-admin}
17 | - ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin}
18 | restart: unless-stopped
19 | labels:
20 | org.label-schema.group: "monitoring"
21 |
22 | db:
23 | container_name: db
24 | image: mariadb:latest
25 | environment:
26 | - "MYSQL_ROOT_PASSWORD="
27 | - "MYSQL_ALLOW_EMPTY_PASSWORD=yes"
28 | - "MYSQL_ROOT_HOST=%"
29 | expose:
30 | - 3306
31 | restart: unless-stopped
32 |
33 | heplify-server:
34 | image: sipcapture/heplify-server:latest
35 | container_name: heplify-server
36 | ports:
37 | - "9060:9060"
38 | - "9060:9060/udp"
39 | command:
40 | - './heplify-server'
41 | environment:
42 | - "HEPLIFYSERVER_HEPADDR=0.0.0.0:9060"
43 | - "HEPLIFYSERVER_DBDRIVER=mysql"
44 | - "HEPLIFYSERVER_DBADDR=db:3306"
45 | - "HEPLIFYSERVER_DBUSER=root"
46 | - "HEPLIFYSERVER_DBPASS="
47 | - "HEPLIFYSERVER_LOGLVL=info"
48 | - "HEPLIFYSERVER_LOGSTD=true"
49 | - "HEPLIFYSERVER_PROMADDR=0.0.0.0:9096"
50 | - "HEPLIFYSERVER_PROMTARGETIP="
51 | - "HEPLIFYSERVER_PROMTARGETNAME="
52 | - "HEPLIFYSERVER_DBDROPDAYS=7"
53 | # - "HEPLIFYSERVER_ESADDR=http://elasticsearch:9200"
54 | restart: unless-stopped
55 | expose:
56 | - 9096
57 | depends_on:
58 | - db
59 | labels:
60 | org.label-schema.group: "monitoring"
61 |
62 | homer-webapp:
63 | container_name: homer-webapp
64 | image: sipcapture/homer-webapp
65 | environment:
66 | - "DB_HOST=db"
67 | - "DB_USER=root"
68 | - "DB_PASS="
69 | expose:
70 | - 80
71 | volumes:
72 | - ./docker-compose.yml:/homer-semaphore/.bootstrapped
73 | restart: unless-stopped
74 | depends_on:
75 | - db
76 |
77 | telegraf:
78 | image: telegraf:1.5-alpine
79 | restart: unless-stopped
80 | volumes:
81 | - ./conf/telegraf.conf:/etc/telegraf/telegraf.conf
82 | ports:
83 | - "8092:8092/udp"
84 | - "8125:8125/udp"
85 | depends_on:
86 | - heplify-server
87 |
88 | elasticsearch:
89 | image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.3.1
90 | container_name: elasticsearch
91 | environment: ['http.host=0.0.0.0', 'transport.host=127.0.0.1']
92 | ports:
93 | - "9200:9200"
94 |
95 | kibana:
96 | image: docker.elastic.co/kibana/kibana-oss:6.3.1
97 | container_name: kibana
98 | ports:
99 | - "5601:5601"
100 | depends_on:
101 | - elasticsearch
102 |
103 |
--------------------------------------------------------------------------------
/heplify-server/hom5-hep-influx/README.md:
--------------------------------------------------------------------------------
1 | Homer 5, heplify-server, TICK Stack
2 | ========
3 |
4 | ## Setup
5 |
6 | ```bash
7 | docker-compose up
8 | ```
9 |
10 | to bring up:
11 |
12 | * HEPlify-server localhost:9060 (hep-only)
13 | * Homer localhost:9080 (admin/test123)
14 | * Chronograf localhost:9090 (admin/admin)
15 | * InfluxDB
16 | * Kapacitor
17 | * Telegraf
18 |
19 | ## Notes
20 | When dealing with prometheus counters in InfluxDB, refer to the following example usage of `difference` and `derivative` functions when selecting:
21 | ```
22 | SELECT difference(last("counter")) AS "mean_counter" FROM "homer"."autogen"."heplify_method_response" WHERE time > :dashboardTime: GROUP BY time(:interval:), "method", "response" FILL(null)
23 | ```
24 | ```
25 | SELECT derivative(last("counter")) AS "mean_counter" FROM "homer"."autogen"."heplify_method_response" WHERE time > :dashboardTime: GROUP BY time(:interval:), "method", "response" FILL(null)
26 | ```
27 |
28 | 
29 |
--------------------------------------------------------------------------------
/heplify-server/hom5-hep-influx/caddy/Caddyfile:
--------------------------------------------------------------------------------
1 |
2 | :9090 {
3 | basicauth / {$ADMIN_USER} {$ADMIN_PASSWORD}
4 | proxy / chronograf:8888 {
5 | transparent
6 | }
7 |
8 | errors stderr
9 | tls off
10 | }
11 |
12 | :9080 {
13 | proxy / homer-webapp:80 {
14 | transparent
15 | }
16 |
17 | errors stderr
18 | tls off
19 | }
20 |
--------------------------------------------------------------------------------
/heplify-server/hom5-hep-influx/conf/homer_dashboard.json:
--------------------------------------------------------------------------------
1 | {"id":1,"cells":[{"i":"741da399-1d0b-4751-98da-04019bb9099e","x":0,"y":3,"w":12,"h":3,"name":"RTCP Jitter","queries":[{"query":"SELECT mean(\"gauge\") AS \"mean_gauge\" FROM \"homer\".\"60s\".\"heplify_rtcp_jitter\" WHERE time \u003e :dashboardTime: GROUP BY time(:interval:) FILL(null)","queryConfig":{"database":"homer","measurement":"heplify_rtcp_jitter","retentionPolicy":"60s","fields":[{"value":"mean","type":"func","alias":"mean_gauge","args":[{"value":"gauge","type":"field","alias":""}]}],"tags":{},"groupBy":{"time":"auto","tags":[]},"areTagsAccepted":false,"fill":"null","rawText":null,"range":null,"shifts":null},"source":"/chronograf/v1/sources/0"}],"axes":{"x":{"bounds":["",""],"label":"","prefix":"","suffix":"","base":"10","scale":"linear"},"y":{"bounds":["",""],"label":"","prefix":"","suffix":" ms","base":"10","scale":"linear"},"y2":{"bounds":["",""],"label":"","prefix":"","suffix":"","base":"10","scale":"linear"}},"type":"line","colors":[{"id":"d0af32a4-8a50-405f-80d7-61523c30a3ec","type":"scale","hex":"#31C0F6","name":"Nineteen Eighty Four","value":"0"},{"id":"b2a97322-ff7a-4164-be86-b6d3fc9e2d56","type":"scale","hex":"#A500A5","name":"Nineteen Eighty Four","value":"0"},{"id":"13ee385d-caed-4d55-a04f-9dd99f7bfe85","type":"scale","hex":"#FF7E27","name":"Nineteen Eighty Four","value":"0"}],"legend":{},"tableOptions":{"verticalTimeAxis":true,"sortBy":{"internalName":"time","displayName":"","visible":true},"wrapping":"truncate","fixFirstColumn":true},"fieldOptions":[{"internalName":"time","displayName":"","visible":true}],"timeFormat":"MM/DD/YYYY HH:mm:ss","decimalPlaces":{"isEnforced":false,"digits":3},"links":{"self":"/chronograf/v1/dashboards/1/cells/741da399-1d0b-4751-98da-04019bb9099e"}},{"i":"06763dec-bc1c-4dff-9f66-0d34dbb02acf","x":0,"y":0,"w":12,"h":3,"name":"SIP METHODS","queries":[{"query":"SELECT derivative(last(\"counter\")) AS \"diff_counter\" FROM \"homer\".\"60s\".\"heplify_method_response\" WHERE time \u003e :dashboardTime: GROUP BY time(:interval:), \"method\", \"response\" FILL(null)","queryConfig":{"database":"","measurement":"","retentionPolicy":"","fields":[],"tags":{},"groupBy":{"time":"","tags":[]},"areTagsAccepted":false,"rawText":"SELECT derivative(last(\"counter\")) AS \"diff_counter\" FROM \"homer\".\"60s\".\"heplify_method_response\" WHERE time \u003e :dashboardTime: GROUP BY time(:interval:), \"method\", \"response\" FILL(null)","range":null,"shifts":null},"source":"/chronograf/v1/sources/0"}],"axes":{"x":{"bounds":["",""],"label":"","prefix":"","suffix":"","base":"10","scale":"linear"},"y":{"bounds":["",""],"label":"","prefix":"","suffix":"","base":"10","scale":"linear"},"y2":{"bounds":["",""],"label":"","prefix":"","suffix":"","base":"10","scale":"linear"}},"type":"line","colors":[{"id":"d0af32a4-8a50-405f-80d7-61523c30a3ec","type":"scale","hex":"#31C0F6","name":"Nineteen Eighty Four","value":"0"},{"id":"b2a97322-ff7a-4164-be86-b6d3fc9e2d56","type":"scale","hex":"#A500A5","name":"Nineteen Eighty Four","value":"0"},{"id":"13ee385d-caed-4d55-a04f-9dd99f7bfe85","type":"scale","hex":"#FF7E27","name":"Nineteen Eighty Four","value":"0"}],"legend":{},"tableOptions":{"verticalTimeAxis":true,"sortBy":{"internalName":"time","displayName":"","visible":true},"wrapping":"truncate","fixFirstColumn":true},"fieldOptions":[{"internalName":"time","displayName":"","visible":true}],"timeFormat":"MM/DD/YYYY HH:mm:ss","decimalPlaces":{"isEnforced":false,"digits":3},"links":{"self":"/chronograf/v1/dashboards/1/cells/06763dec-bc1c-4dff-9f66-0d34dbb02acf"}}],"templates":[],"name":"Name This Dashboard","organization":"default","links":{"self":"/chronograf/v1/dashboards/1","cells":"/chronograf/v1/dashboards/1/cells","templates":"/chronograf/v1/dashboards/1/templates"}}
2 |
--------------------------------------------------------------------------------
/heplify-server/hom5-hep-influx/conf/retention.policy:
--------------------------------------------------------------------------------
1 | use homer;
2 | CREATE RETENTION POLICY "60s" ON "homer" DURATION 4w REPLICATION 1 DEFAULT;
3 | CREATE RETENTION POLICY "300s" ON "homer" DURATION 8w REPLICATION 1;
4 | CREATE RETENTION POLICY "3600s" ON "homer" DURATION 16w REPLICATION 1;
5 | CREATE RETENTION POLICY "86400s" ON "homer" DURATION 32w REPLICATION 1;
6 |
7 | CREATE CONTINUOUS QUERY cq_300s ON homer RESAMPLE EVERY 1m BEGIN SELECT mean(*) INTO homer."300s".:MEASUREMENT FROM homer."60s"./.*/ GROUP BY time(5m),* END
8 | CREATE CONTINUOUS QUERY cq_3600s ON homer RESAMPLE EVERY 10m BEGIN SELECT mean(*) INTO homer."3600s".:MEASUREMENT FROM homer."60s"./.*/ GROUP BY time(1h),* END
9 | CREATE CONTINUOUS QUERY cq_86400s ON homer RESAMPLE EVERY 1h BEGIN SELECT mean(*) INTO homer."86400s".:MEASUREMENT FROM homer."60s"./.*/ GROUP BY time(1d),* END
10 |
11 | drop retention policy "autogen" ON "homer"
12 |
--------------------------------------------------------------------------------
/heplify-server/hom5-hep-influx/conf/telegraf.conf:
--------------------------------------------------------------------------------
1 | # Configuration for influxdb server to send metrics to
2 | [[outputs.influxdb]]
3 | urls = ["http://influxdb:8086/"] # required
4 | database = "homer" # required
5 | retention_policy = ""
6 | write_consistency = "any"
7 | timeout = "5s"
8 | namedrop = ["homer*"]
9 |
10 | # # Generic socket listener capable of handling multiple socket types.
11 | [[inputs.socket_listener]]
12 | service_address = "udp://127.0.0.1:8094"
13 | data_format = "influx"
14 |
15 | [[inputs.prometheus]]
16 | ## An array of urls to scrape metrics from.
17 | urls = ["http://heplify-server:9096/metrics"]
18 |
19 |
--------------------------------------------------------------------------------
/heplify-server/hom5-hep-influx/influx/.ignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sipcapture/homer5-docker/24009db5110d9c62469a482135134aa62d9028c1/heplify-server/hom5-hep-influx/influx/.ignore
--------------------------------------------------------------------------------
/heplify-server/hom5-hep-prom-graf/Dockerfile:
--------------------------------------------------------------------------------
1 | # sudo docker build -t negbie/heplify-server:latest .
2 |
3 | FROM golang:latest as builder
4 |
5 | RUN go get -u -d -v github.com/negbie/heplify-server/
6 | WORKDIR /go/src/github.com/negbie/heplify-server/cmd/heplify-server/
7 | RUN set -x && go get -u -d -v .
8 |
9 | RUN go get -u -v github.com/gobuffalo/packr/...
10 | WORKDIR /go/bin/
11 | RUN ./packr -i /go/src/github.com/negbie/heplify-server/database
12 |
13 | WORKDIR /go/src/github.com/negbie/heplify-server/cmd/heplify-server/
14 | RUN CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-s -w' -installsuffix cgo -o heplify-server .
15 |
16 |
17 | FROM alpine:latest
18 | RUN apk --no-cache add ca-certificates
19 | WORKDIR /root/
20 | COPY --from=builder /go/src/github.com/negbie/heplify-server/cmd/heplify-server/heplify-server .
--------------------------------------------------------------------------------
/heplify-server/hom5-hep-prom-graf/README.md:
--------------------------------------------------------------------------------
1 | Homer5, heplify-server, Prometheus, Grafana Stack
2 | ========
3 |
4 | ## Setup
5 |
6 | ```bash
7 | docker-compose up
8 | ```
9 |
10 | ## User Interfaces
11 | * Homer localhost:9080 (admin/test123)
12 | * Prometheus localhost:9090 (admin/admin)
13 | * Alertmanager localhost:9093 (admin/admin)
14 | * Grafana localhost:3000 (admin/admin)
15 |
16 | When the Grafana dashboard autoprovisioning does not work for you make sure you have no old grafana volumes.
17 |
18 | ## Sockets
19 | * HEP packet input :9060
20 | * RTCP-XR phone input :9064
21 |
22 | ## Configuration
23 |
24 | When you change some files inside the Prometheus or Alertmanager folder you can reload them without interruption.
25 |
26 | #### Prometheus
27 | ```bash
28 | curl -s -XPOST localhost:9090/-/reload -u admin:admin
29 | ```
30 |
31 | #### Alertmanager
32 | ```bash
33 | curl -s -XPOST localhost:9093/-/reload -u admin:admin
34 | ```
35 |
36 | #### Service
37 | When you need to change the docker-compose file i.e to setup smtp for Grafana:
38 | ```bash
39 | docker-compose up -d
40 | ```
41 | Docker will only restart the service you changed inside the docker-compose file.
42 |
--------------------------------------------------------------------------------
/heplify-server/hom5-hep-prom-graf/alertmanager/config.yml:
--------------------------------------------------------------------------------
1 | global:
2 | # The smarthost and SMTP sender used for mail notifications.
3 | smtp_smarthost: 'localhost:25'
4 | smtp_from: 'alertmanager@example.org'
5 |
6 | # The root route on which each incoming alert enters.
7 | route:
8 | # The root route must not have any matchers as it is the entry point for
9 | # all alerts. It needs to have a receiver configured so alerts that do not
10 | # match any of the sub-routes are sent to someone.
11 | receiver: 'team-X-mails'
12 |
13 | # The labels by which incoming alerts are grouped together. For example,
14 | # multiple alerts coming in for cluster=A and alertname=LatencyHigh would
15 | # be batched into a single group.
16 | group_by: ['alertname', 'cluster']
17 |
18 | # When a new group of alerts is created by an incoming alert, wait at
19 | # least 'group_wait' to send the initial notification.
20 | # This way ensures that you get multiple alerts for the same group that start
21 | # firing shortly after another are batched together on the first
22 | # notification.
23 | group_wait: 30s
24 |
25 | # When the first notification was sent, wait 'group_interval' to send a batch
26 | # of new alerts that started firing for that group.
27 | group_interval: 5m
28 |
29 | # If an alert has successfully been sent, wait 'repeat_interval' to
30 | # resend them.
31 | repeat_interval: 3h
32 |
33 | # All the above attributes are inherited by all child routes and can
34 | # overwritten on each.
35 |
36 | # The child route trees.
37 | routes:
38 | # This routes performs a regular expression match on alert labels to
39 | # catch alerts that are related to a list of services.
40 | - match_re:
41 | service: ^(foo1|foo2|baz)$
42 | receiver: team-X-mails
43 |
44 | # The service has a sub-route for critical alerts, any alerts
45 | # that do not match, i.e. severity != critical, fall-back to the
46 | # parent node and are sent to 'team-X-mails'
47 | routes:
48 | - match:
49 | severity: critical
50 | receiver: team-X-pager
51 |
52 | - match:
53 | service: files
54 | receiver: team-Y-mails
55 |
56 | routes:
57 | - match:
58 | severity: critical
59 | receiver: team-Y-pager
60 |
61 | # This route handles all alerts coming from a database service. If there's
62 | # no team to handle it, it defaults to the DB team.
63 | - match:
64 | service: database
65 |
66 | receiver: team-DB-pager
67 | # Also group alerts by affected database.
68 | group_by: [alertname, cluster, database]
69 |
70 | routes:
71 | - match:
72 | owner: team-X
73 | receiver: team-X-pager
74 |
75 | - match:
76 | owner: team-Y
77 | receiver: team-Y-pager
78 |
79 |
80 | # Inhibition rules allow to mute a set of alerts given that another alert is
81 | # firing.
82 | # We use this to mute any warning-level notifications if the same alert is
83 | # already critical.
84 | inhibit_rules:
85 | - source_match:
86 | severity: 'critical'
87 | target_match:
88 | severity: 'warning'
89 | # Apply inhibition if the alertname is the same.
90 | equal: ['alertname']
91 |
92 |
93 | receivers:
94 | - name: 'team-X-mails'
95 | email_configs:
96 | - to: 'team-X+alerts@example.org, team-Y+alerts@example.org'
97 |
98 | - name: 'team-X-pager'
99 | email_configs:
100 | - to: 'team-X+alerts-critical@example.org'
101 | pagerduty_configs:
102 | - routing_key:
103 |
104 | - name: 'team-Y-mails'
105 | email_configs:
106 | - to: 'team-Y+alerts@example.org'
107 |
108 | - name: 'team-Y-pager'
109 | pagerduty_configs:
110 | - routing_key:
111 |
112 | - name: 'team-DB-pager'
113 | pagerduty_configs:
114 | - routing_key:
--------------------------------------------------------------------------------
/heplify-server/hom5-hep-prom-graf/caddy/Caddyfile:
--------------------------------------------------------------------------------
1 |
2 | :9090 {
3 | basicauth / {$ADMIN_USER} {$ADMIN_PASSWORD}
4 | proxy / prometheus:9090 {
5 | transparent
6 | }
7 |
8 | errors stderr
9 | tls off
10 | }
11 |
12 | :9093 {
13 | basicauth / {$ADMIN_USER} {$ADMIN_PASSWORD}
14 | proxy / alertmanager:9093 {
15 | transparent
16 | }
17 |
18 | errors stderr
19 | tls off
20 | }
21 |
22 | :3000 {
23 | proxy / grafana:3000 {
24 | transparent
25 | websocket
26 | }
27 |
28 | errors stderr
29 | tls off
30 | }
31 |
32 | :9080 {
33 | proxy / homer-webapp:80 {
34 | transparent
35 | }
36 |
37 | errors stderr
38 | tls off
39 | }
40 |
--------------------------------------------------------------------------------
/heplify-server/hom5-hep-prom-graf/grafana/provisioning/dashboards/dashboard.yml:
--------------------------------------------------------------------------------
1 | apiVersion: 1
2 |
3 | providers:
4 | - name: 'Prometheus'
5 | orgId: 1
6 | folder: ''
7 | type: file
8 | disableDeletion: false
9 | editable: true
10 | options:
11 | path: /etc/grafana/provisioning/dashboards
12 |
--------------------------------------------------------------------------------
/heplify-server/hom5-hep-prom-graf/grafana/provisioning/datasources/datasource.yml:
--------------------------------------------------------------------------------
1 | # config file version
2 | apiVersion: 1
3 |
4 | # list of datasources that should be deleted from the database
5 | deleteDatasources:
6 | - name: Prometheus
7 | orgId: 1
8 |
9 | # list of datasources to insert/update depending
10 | # whats available in the database
11 | datasources:
12 | # name of the datasource. Required
13 | - name: Prometheus
14 | # datasource type. Required
15 | type: prometheus
16 | # access mode. direct or proxy. Required
17 | access: proxy
18 | # org id. will default to orgId 1 if not specified
19 | orgId: 1
20 | # url
21 | url: http://prometheus:9090
22 | # database password, if used
23 | password:
24 | # database user, if used
25 | user:
26 | # database name, if used
27 | database:
28 | # enable/disable basic auth
29 | basicAuth: false
30 | # basic auth username
31 | basicAuthUser: admin
32 | # basic auth password
33 | basicAuthPassword: admin
34 | # enable/disable with credentials headers
35 | withCredentials:
36 | # mark as default datasource. Max one per org
37 | isDefault:
38 | #