├── .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 | [![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](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 | ![image](https://user-images.githubusercontent.com/1423657/40862016-705d998a-65eb-11e8-8b03-e711b7b4498d.png) 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 | # fields that will be converted to json and stored in json_data 39 | jsonData: 40 | graphiteVersion: "1.1" 41 | tlsAuth: false 42 | tlsAuthWithCACert: false 43 | # json object of data that will be encrypted. 44 | secureJsonData: 45 | tlsCACert: "..." 46 | tlsClientCert: "..." 47 | tlsClientKey: "..." 48 | version: 1 49 | # allow users to edit datasources from the UI. 50 | editable: true 51 | -------------------------------------------------------------------------------- /heplify-server/hom5-hep-prom-graf/prometheus/alert.rules: -------------------------------------------------------------------------------- 1 | groups: 2 | - name: targets 3 | rules: 4 | - alert: monitor_service_down 5 | expr: up == 0 6 | for: 30s 7 | labels: 8 | severity: critical 9 | annotations: 10 | summary: "Monitor service non-operational" 11 | description: "Service {{ $labels.instance }} is down." 12 | 13 | - name: host 14 | rules: 15 | - alert: high_cpu_load 16 | expr: node_load1 > 10 17 | for: 30s 18 | labels: 19 | severity: warning 20 | annotations: 21 | summary: "Server under high load" 22 | description: "Docker host is under high load, the avg load 1m is at {{ $value}}. Reported by instance {{ $labels.instance }} of job {{ $labels.job }}." 23 | 24 | - alert: high_memory_load 25 | expr: (sum(node_memory_MemTotal) - sum(node_memory_MemFree + node_memory_Buffers + node_memory_Cached) ) / sum(node_memory_MemTotal) * 100 > 95 26 | for: 30s 27 | labels: 28 | severity: warning 29 | annotations: 30 | summary: "Server memory is almost full" 31 | description: "Docker host memory usage is {{ humanize $value}}%. Reported by instance {{ $labels.instance }} of job {{ $labels.job }}." 32 | 33 | - alert: high_storage_load 34 | expr: (node_filesystem_size{fstype="aufs"} - node_filesystem_free{fstype="aufs"}) / node_filesystem_size{fstype="aufs"} * 100 > 85 35 | for: 30s 36 | labels: 37 | severity: warning 38 | annotations: 39 | summary: "Server storage is almost full" 40 | description: "Docker host storage usage is {{ humanize $value}}%. Reported by instance {{ $labels.instance }} of job {{ $labels.job }}." 41 | 42 | - name: heplify 43 | rules: 44 | - alert: heplify_down 45 | expr: sum(rate(heplify_packets_total[1m])) < 10 46 | for: 30s 47 | labels: 48 | severity: critical 49 | annotations: 50 | summary: "heplify down" 51 | description: "heplify sends less than 10 pkt/s for 30 seconds." 52 | 53 | - name: heplify-server 54 | rules: 55 | - alert: sip_50x_error 56 | expr: rate(heplify_method_response{method=~"INVITE|REGISTER", response=~"50.*"}[1m]) > 0.40 57 | for: 5m 58 | labels: 59 | severity: warning 60 | annotations: 61 | summary: "SIP server error rate" 62 | description: 'Interface {{ $labels.target_name }} received {{ $value | printf "%.2f" }} {{ $labels.method }}:{{ $labels.response }} per second' 63 | 64 | -------------------------------------------------------------------------------- /heplify-server/hom5-hep-prom-graf/prometheus/prometheus.yml: -------------------------------------------------------------------------------- 1 | global: 2 | scrape_interval: 15s 3 | evaluation_interval: 15s 4 | 5 | # Attach these labels to any time series or alerts when communicating with 6 | # external systems (federation, remote storage, Alertmanager). 7 | external_labels: 8 | monitor: 'docker-heplify-server' 9 | 10 | # Load and evaluate rules in this file every 'evaluation_interval' seconds. 11 | rule_files: 12 | - "alert.rules" 13 | 14 | # A scrape configuration containing exactly one endpoint to scrape. 15 | scrape_configs: 16 | - job_name: 'nodeexporter' 17 | scrape_interval: 5s 18 | static_configs: 19 | - targets: ['nodeexporter:9100'] 20 | 21 | - job_name: 'prometheus' 22 | scrape_interval: 10s 23 | static_configs: 24 | - targets: ['localhost:9090'] 25 | 26 | - job_name: 'heplify-server' 27 | scrape_interval: 5s 28 | static_configs: 29 | - targets: ['heplify-server:9096'] 30 | 31 | 32 | alerting: 33 | alertmanagers: 34 | - scheme: http 35 | static_configs: 36 | - targets: 37 | - 'alertmanager:9093' 38 | -------------------------------------------------------------------------------- /heplify-server/hom7-elastic/README.md: -------------------------------------------------------------------------------- 1 | Homer Elastic 2 | ======== 3 | 4 | #### BETA VERSION! PLEASE REPORT BUGS AND IMPROVEMENTS 5 | 6 | This recipe will bring up a headless HOMER bundle, with both data and statistics stored to Elasticsearch. 7 | 8 | A Kibana [preset kit](https://raw.githubusercontent.com/sipcapture/homer-docker/master/heplify-server/hom7-elastic/conf/kibana-import.json) is provided and ready for manual 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | ## Setup 21 | 22 | ```bash 23 | docker-compose up 24 | ``` 25 | 26 | to bring up: 27 | 28 | * HEPlify-server localhost:9060 (hep-only) 29 | * Telegraf 30 | * Kibana localhost:9090 (admin/admin) 31 | * Elasticsearch (hep-*), (heplify-*) 32 | 33 | 34 | --------------- 35 | ### Notes 36 | 37 | #### Timelion Formulas 38 | The following Timelion expressions can be used to graph CPS and RPS from HOMER statistics stored in Elasticsearch: 39 | ##### Registrations per Second 40 | ``` 41 | .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) 42 | ``` 43 | ##### Calls per Second 44 | ``` 45 | .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) 46 | ``` 47 | ##### Failures per Second 48 | ``` 49 | .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) 50 | ``` 51 | 52 | -------------------------------------------------------------------------------- /heplify-server/hom7-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 | -------------------------------------------------------------------------------- /heplify-server/hom7-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/hom7-elastic/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2.1' 2 | 3 | services: 4 | caddy: 5 | container_name: caddy 6 | image: stefanprodan/caddy 7 | container_name: caddy 8 | ports: 9 | - "9090:9090" 10 | volumes: 11 | - ./caddy/:/etc/caddy/ 12 | environment: 13 | - ADMIN_USER=${ADMIN_USER:-admin} 14 | - ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin} 15 | restart: unless-stopped 16 | labels: 17 | org.label-schema.group: "monitoring" 18 | 19 | heplify-server: 20 | image: sipcapture/heplify-server:latest 21 | container_name: heplify-server 22 | ports: 23 | - "9060:9060" 24 | - "9060:9060/udp" 25 | command: 26 | - './heplify-server' 27 | environment: 28 | - "HEPLIFYSERVER_HEPADDR=0.0.0.0:9060" 29 | - "HEPLIFYSERVER_HEPTLSADDR=0.0.0.0:9060" 30 | - "HEPLIFYSERVER_HEPTCPADDR=" 31 | - "HEPLIFYSERVER_DBSHEMA=homer7" 32 | - "HEPLIFYSERVER_DBADDR=''" 33 | - "HEPLIFYSERVER_LOGLVL=info" 34 | - "HEPLIFYSERVER_LOGSTD=true" 35 | - "HEPLIFYSERVER_PROMADDR=0.0.0.0:9096" 36 | - "HEPLIFYSERVER_PROMTARGETIP=" 37 | - "HEPLIFYSERVER_PROMTARGETNAME=" 38 | - "HEPLIFYSERVER_ESADDR=http://elasticsearch:9200" 39 | - "HEPLIFYSERVER_DEDUP=false" 40 | restart: unless-stopped 41 | expose: 42 | - 9090 43 | labels: 44 | org.label-schema.group: "monitoring" 45 | depends_on: 46 | - elasticsearch 47 | 48 | telegraf: 49 | image: telegraf:1.5-alpine 50 | restart: unless-stopped 51 | volumes: 52 | - ./conf/telegraf.conf:/etc/telegraf/telegraf.conf 53 | ports: 54 | - "8092:8092/udp" 55 | - "8125:8125/udp" 56 | depends_on: 57 | - heplify-server 58 | 59 | elasticsearch: 60 | image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.3.1 61 | container_name: elasticsearch 62 | environment: ['http.host=0.0.0.0', 'transport.host=127.0.0.1'] 63 | ports: 64 | - "9200:9200" 65 | 66 | kibana: 67 | image: docker.elastic.co/kibana/kibana-oss:6.3.1 68 | container_name: kibana 69 | ports: 70 | - "5601:5601" 71 | depends_on: 72 | - elasticsearch 73 | 74 | -------------------------------------------------------------------------------- /heplify-server/hom7-hep-elastic/README.md: -------------------------------------------------------------------------------- 1 | Homer 7, heplify-server, Elastic stack 2 | ======== 3 | 4 | #### BETA VERSION! PLEASE REPORT BUGS AND IMPROVEMENTS 5 | 6 | ## Setup 7 | 8 | ```bash 9 | docker-compose up 10 | ``` 11 | 12 | to bring up: 13 | 14 | * HEPlify-server localhost:9060 (hep-only) 15 | * Homer localhost:9080 (admin/test123) 16 | * Kibana localhost:9090 (admin/admin) 17 | * Elasticsearch (hep-*) 18 | * Telegraf 19 | 20 | ### Notes 21 | #### Timelion CPS and RPS 22 | The following Timelion expression can be used to graph CPS and RPS from HOMER statistics stored in Elasticsearch: 23 | ##### Registrations per Second 24 | ``` 25 | .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) 26 | ``` 27 | ##### Calls per Second 28 | ``` 29 | .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) 30 | ``` 31 | ##### Failures per Second 32 | ``` 33 | .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) 34 | ``` 35 | 36 | 37 | -------------------------------------------------------------------------------- /heplify-server/hom7-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/hom7-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/hom7-hep-elastic/conf/init-user-db.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL 5 | CREATE DATABASE homer_config; 6 | EOSQL 7 | -------------------------------------------------------------------------------- /heplify-server/hom7-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/hom7-hep-elastic/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2.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 | image: postgres:11-alpine 24 | environment: 25 | POSTGRES_PASSWORD: homerSeven 26 | POSTGRES_USER: root 27 | expose: 28 | - 5432 29 | restart: unless-stopped 30 | volumes: 31 | - ./conf/init-user-db.sh:/docker-entrypoint-initdb.d/init-user-db.sh 32 | - ./postgres-data:/var/lib/postgresql/data 33 | healthcheck: 34 | test: ["CMD-SHELL", "psql -h 'localhost' -U 'root' -c '\\l'"] 35 | interval: 1s 36 | timeout: 3s 37 | retries: 30 38 | 39 | heplify-server: 40 | image: sipcapture/heplify-server:latest 41 | container_name: heplify-server 42 | ports: 43 | - "9060:9060" 44 | - "9060:9060/udp" 45 | command: 46 | - './heplify-server' 47 | environment: 48 | - "HEPLIFYSERVER_HEPADDR=0.0.0.0:9060" 49 | - "HEPLIFYSERVER_DBDRIVER=postgres" 50 | - "HEPLIFYSERVER_DBSHEMA=homer7" 51 | - "HEPLIFYSERVER_DBADDR=db:5432" 52 | - "HEPLIFYSERVER_DBUSER=root" 53 | - "HEPLIFYSERVER_DBPASS=homerSeven" 54 | - "HEPLIFYSERVER_DBDATATABLE=homer_data" 55 | - "HEPLIFYSERVER_LOGLVL=info" 56 | - "HEPLIFYSERVER_LOGSTD=true" 57 | - "HEPLIFYSERVER_PROMADDR=0.0.0.0:9096" 58 | - "HEPLIFYSERVER_PROMTARGETIP=" 59 | - "HEPLIFYSERVER_PROMTARGETNAME=" 60 | - "HEPLIFYSERVER_DBDROPDAYS=7" 61 | restart: unless-stopped 62 | expose: 63 | - 9090 64 | depends_on: 65 | db: 66 | condition: service_healthy 67 | labels: 68 | org.label-schema.group: "monitoring" 69 | 70 | homer-webapp: 71 | container_name: homer-webapp 72 | image: sipcapture/homer-app:master 73 | environment: 74 | - "DB_HOST=db" 75 | - "DB_USER=root" 76 | - "DB_PASS=homerSeven" 77 | expose: 78 | - 8001 79 | restart: unless-stopped 80 | depends_on: 81 | db: 82 | condition: service_healthy 83 | 84 | telegraf: 85 | image: telegraf:1.5-alpine 86 | restart: unless-stopped 87 | volumes: 88 | - ./conf/telegraf.conf:/etc/telegraf/telegraf.conf 89 | ports: 90 | - "8092:8092/udp" 91 | - "8125:8125/udp" 92 | depends_on: 93 | - heplify-server 94 | 95 | elasticsearch: 96 | image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.3.1 97 | container_name: elasticsearch 98 | environment: ['http.host=0.0.0.0', 'transport.host=127.0.0.1'] 99 | ports: 100 | - "9200:9200" 101 | 102 | kibana: 103 | image: docker.elastic.co/kibana/kibana-oss:6.3.1 104 | container_name: kibana 105 | ports: 106 | - "5601:5601" 107 | depends_on: 108 | - elasticsearch 109 | 110 | -------------------------------------------------------------------------------- /heplify-server/hom7-hep-influx/README.md: -------------------------------------------------------------------------------- 1 | Homer 7, heplify-server, TICK Stack 2 | ======== 3 | 4 | #### BETA VERSION! PLEASE REPORT BUGS AND IMPROVEMENTS 5 | 6 | ## Setup 7 | 8 | ```bash 9 | docker-compose up 10 | ``` 11 | 12 | to bring up: 13 | 14 | * HEPlify-server localhost:9060 (hep-only) 15 | * Homer localhost:9080 (admin/sipcapture) 16 | * Chronograf localhost:9090 (admin/admin) 17 | * InfluxDB 18 | * Kapacitor 19 | * Telegraf 20 | 21 | ## Notes 22 | When dealing with prometheus counters in InfluxDB, refer to the following example usage of `difference` and `derivative` functions when selecting: 23 | ``` 24 | SELECT difference(last("counter")) AS "mean_counter" FROM "homer"."autogen"."heplify_method_response" WHERE time > :dashboardTime: GROUP BY time(:interval:), "method", "response" FILL(null) 25 | ``` 26 | ``` 27 | SELECT derivative(last("counter")) AS "mean_counter" FROM "homer"."autogen"."heplify_method_response" WHERE time > :dashboardTime: GROUP BY time(:interval:), "method", "response" FILL(null) 28 | ``` 29 | 30 | ![image](https://user-images.githubusercontent.com/1423657/40862016-705d998a-65eb-11e8-8b03-e711b7b4498d.png) 31 | -------------------------------------------------------------------------------- /heplify-server/hom7-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/hom7-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/hom7-hep-influx/conf/init-user-db.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL 5 | CREATE DATABASE homer_config; 6 | EOSQL 7 | -------------------------------------------------------------------------------- /heplify-server/hom7-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/hom7-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 | namedrop = ["go*","process*","promhttp*"] 19 | 20 | -------------------------------------------------------------------------------- /heplify-server/hom7-hep-influx/influx/.holdme: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipcapture/homer5-docker/24009db5110d9c62469a482135134aa62d9028c1/heplify-server/hom7-hep-influx/influx/.holdme -------------------------------------------------------------------------------- /heplify-server/hom7-hep-influx/influx/.ignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipcapture/homer5-docker/24009db5110d9c62469a482135134aa62d9028c1/heplify-server/hom7-hep-influx/influx/.ignore -------------------------------------------------------------------------------- /heplify-server/hom7-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/hom7-hep-prom-graf/README.md: -------------------------------------------------------------------------------- 1 | # Homer7, heplify-server, Prometheus, Grafana Stack 2 | 3 | #### BETA VERSION! PLEASE REPORT BUGS AND IMPROVEMENTS 4 | 5 | -------- 6 | 7 | ## Setup 8 | 9 | ```bash 10 | docker-compose up 11 | ``` 12 | 13 | to bring up: 14 | 15 | * [Adminer] localhost:8080 (root/homerSeven) //select System->PostgresSQL 16 | * [Homer] localhost:9080 (admin/sipcapture) 17 | * [Grafana] localhost:3000 (admin/admin) 18 | * [Prometheus] localhost:9090 (admin/admin) 19 | * [Alertmanager] localhost:9093 (admin/admin) 20 | 21 | When the Grafana dashboard autoprovisioning does not work for you make sure you have no old grafana volumes. 22 | 23 | ## Configuration 24 | 25 | When you change some files inside the Prometheus or Alertmanager folder you can reload them without interruption. 26 | 27 | #### Prometheus 28 | ```bash 29 | curl -s -XPOST localhost:9090/-/reload -u admin:admin 30 | ``` 31 | 32 | #### Alertmanager 33 | ```bash 34 | curl -s -XPOST localhost:9093/-/reload -u admin:admin 35 | ``` 36 | 37 | #### Service 38 | When you need to change the docker-compose file i.e to setup smtp for Grafana: 39 | ```bash 40 | docker-compose up -d 41 | ``` 42 | Docker will only restart the service you changed inside the docker-compose file. 43 | -------------------------------------------------------------------------------- /heplify-server/hom7-hep-prom-graf/alertmanager/config.yml: -------------------------------------------------------------------------------- 1 | global: 2 | route: 3 | group_by: [cluster] 4 | # If an alert isn't caught by a route, send it slack. 5 | receiver: slack_general 6 | routes: 7 | # Send severity=slack alerts to slack. 8 | - match: 9 | severity: slack 10 | receiver: slack_general 11 | 12 | receivers: 13 | - name: slack_general 14 | slack_configs: 15 | - api_url: 'https://hooks.slack.com/services/your_webhook' 16 | channel: '#astricon18' 17 | 18 | # # The smarthost and SMTP sender used for mail notifications. 19 | # smtp_smarthost: 'localhost:25' 20 | # smtp_from: 'alertmanager@example.org' 21 | # 22 | # # The root route on which each incoming alert enters. 23 | # route: 24 | # # The root route must not have any matchers as it is the entry point for 25 | # # all alerts. It needs to have a receiver configured so alerts that do not 26 | # # match any of the sub-routes are sent to someone. 27 | # receiver: 'team-X-mails' 28 | # 29 | # # The labels by which incoming alerts are grouped together. For example, 30 | # # multiple alerts coming in for cluster=A and alertname=LatencyHigh would 31 | # # be batched into a single group. 32 | # group_by: ['alertname', 'cluster'] 33 | # 34 | # # When a new group of alerts is created by an incoming alert, wait at 35 | # # least 'group_wait' to send the initial notification. 36 | # # This way ensures that you get multiple alerts for the same group that start 37 | # # firing shortly after another are batched together on the first 38 | # # notification. 39 | # group_wait: 30s 40 | # 41 | # # When the first notification was sent, wait 'group_interval' to send a batch 42 | # # of new alerts that started firing for that group. 43 | # group_interval: 5m 44 | # 45 | # # If an alert has successfully been sent, wait 'repeat_interval' to 46 | # # resend them. 47 | # repeat_interval: 3h 48 | # 49 | # # All the above attributes are inherited by all child routes and can 50 | # # overwritten on each. 51 | # 52 | # # The child route trees. 53 | # routes: 54 | # # This routes performs a regular expression match on alert labels to 55 | # # catch alerts that are related to a list of services. 56 | # - match_re: 57 | # service: ^(foo1|foo2|baz)$ 58 | # receiver: team-X-mails 59 | # 60 | # # The service has a sub-route for critical alerts, any alerts 61 | # # that do not match, i.e. severity != critical, fall-back to the 62 | # # parent node and are sent to 'team-X-mails' 63 | # routes: 64 | # - match: 65 | # severity: critical 66 | # receiver: team-X-pager 67 | # 68 | # - match: 69 | # service: files 70 | # receiver: team-Y-mails 71 | # 72 | # routes: 73 | # - match: 74 | # severity: critical 75 | # receiver: team-Y-pager 76 | # 77 | # # This route handles all alerts coming from a database service. If there's 78 | # # no team to handle it, it defaults to the DB team. 79 | # - match: 80 | # service: database 81 | # 82 | # receiver: team-DB-pager 83 | # # Also group alerts by affected database. 84 | # group_by: [alertname, cluster, database] 85 | # 86 | # routes: 87 | # - match: 88 | # owner: team-X 89 | # receiver: team-X-pager 90 | # 91 | # - match: 92 | # owner: team-Y 93 | # receiver: team-Y-pager 94 | # 95 | # 96 | # # Inhibition rules allow to mute a set of alerts given that another alert is 97 | # # firing. 98 | # # We use this to mute any warning-level notifications if the same alert is 99 | # # already critical. 100 | # inhibit_rules: 101 | # - source_match: 102 | # severity: 'critical' 103 | # target_match: 104 | # severity: 'warning' 105 | # # Apply inhibition if the alertname is the same. 106 | # equal: ['alertname'] 107 | # 108 | # 109 | # receivers: 110 | # - name: 'team-X-mails' 111 | # email_configs: 112 | # - to: 'team-X+alerts@example.org, team-Y+alerts@example.org' 113 | # 114 | # - name: 'team-X-pager' 115 | # email_configs: 116 | # - to: 'team-X+alerts-critical@example.org' 117 | # pagerduty_configs: 118 | # - routing_key: 119 | # 120 | # - name: 'team-Y-mails' 121 | # email_configs: 122 | # - to: 'team-Y+alerts@example.org' 123 | # 124 | # - name: 'team-Y-pager' 125 | # pagerduty_configs: 126 | # - routing_key: 127 | # 128 | # - name: 'team-DB-pager' 129 | # pagerduty_configs: 130 | # - routing_key: -------------------------------------------------------------------------------- /heplify-server/hom7-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/hom7-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/hom7-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 | # fields that will be converted to json and stored in json_data 39 | jsonData: 40 | graphiteVersion: "1.1" 41 | tlsAuth: false 42 | tlsAuthWithCACert: false 43 | # json object of data that will be encrypted. 44 | secureJsonData: 45 | tlsCACert: "..." 46 | tlsClientCert: "..." 47 | tlsClientKey: "..." 48 | version: 1 49 | # allow users to edit datasources from the UI. 50 | editable: true 51 | -------------------------------------------------------------------------------- /heplify-server/hom7-hep-prom-graf/prometheus/alert.rules: -------------------------------------------------------------------------------- 1 | groups: 2 | - name: targets 3 | rules: 4 | - alert: monitor_service_down 5 | expr: up == 0 6 | for: 30s 7 | labels: 8 | severity: critical 9 | annotations: 10 | summary: "Monitor service non-operational" 11 | description: "Service {{ $labels.instance }} is down." 12 | 13 | - name: host 14 | rules: 15 | - alert: high_cpu_load 16 | expr: node_load1 > 10 17 | for: 30s 18 | labels: 19 | severity: warning 20 | annotations: 21 | summary: "Server under high load" 22 | description: "Docker host is under high load, the avg load 1m is at {{ $value}}. Reported by instance {{ $labels.instance }} of job {{ $labels.job }}." 23 | 24 | - alert: high_memory_load 25 | expr: (sum(node_memory_MemTotal) - sum(node_memory_MemFree + node_memory_Buffers + node_memory_Cached) ) / sum(node_memory_MemTotal) * 100 > 95 26 | for: 30s 27 | labels: 28 | severity: warning 29 | annotations: 30 | summary: "Server memory is almost full" 31 | description: "Docker host memory usage is {{ humanize $value}}%. Reported by instance {{ $labels.instance }} of job {{ $labels.job }}." 32 | 33 | - alert: high_storage_load 34 | expr: (node_filesystem_size{fstype="aufs"} - node_filesystem_free{fstype="aufs"}) / node_filesystem_size{fstype="aufs"} * 100 > 85 35 | for: 30s 36 | labels: 37 | severity: warning 38 | annotations: 39 | summary: "Server storage is almost full" 40 | description: "Docker host storage usage is {{ humanize $value}}%. Reported by instance {{ $labels.instance }} of job {{ $labels.job }}." 41 | 42 | - name: heplify 43 | rules: 44 | - alert: heplify_down 45 | expr: sum(rate(heplify_packets_total[1m])) < 10 46 | for: 30s 47 | labels: 48 | severity: critical 49 | annotations: 50 | summary: "heplify down" 51 | description: "heplify sends less than 10 pkt/s for 30 seconds." 52 | 53 | - name: heplify-server 54 | rules: 55 | - alert: sip_50x_error 56 | expr: rate(heplify_method_response{method=~"INVITE|REGISTER", response=~"50.*"}[1m]) > 0 57 | for: 1m 58 | labels: 59 | severity: warning 60 | annotations: 61 | summary: "SIP server error rate" 62 | description: 'Interface {{ $labels.target_name }} received {{ $value | printf "%.2f" }} {{ $labels.method }}:{{ $labels.response }} per second' 63 | 64 | -------------------------------------------------------------------------------- /heplify-server/hom7-hep-prom-graf/prometheus/prometheus.yml: -------------------------------------------------------------------------------- 1 | global: 2 | scrape_interval: 15s 3 | evaluation_interval: 15s 4 | 5 | # Attach these labels to any time series or alerts when communicating with 6 | # external systems (federation, remote storage, Alertmanager). 7 | external_labels: 8 | monitor: 'docker-heplify-server' 9 | 10 | # Load and evaluate rules in this file every 'evaluation_interval' seconds. 11 | rule_files: 12 | - "alert.rules" 13 | 14 | # A scrape configuration containing exactly one endpoint to scrape. 15 | scrape_configs: 16 | - job_name: 'nodeexporter' 17 | scrape_interval: 5s 18 | static_configs: 19 | - targets: ['nodeexporter:9100'] 20 | 21 | - job_name: 'prometheus' 22 | scrape_interval: 10s 23 | static_configs: 24 | - targets: ['localhost:9090'] 25 | 26 | - job_name: 'heplify-server' 27 | scrape_interval: 5s 28 | static_configs: 29 | - targets: ['heplify-server:9096'] 30 | 31 | 32 | alerting: 33 | alertmanagers: 34 | - scheme: http 35 | static_configs: 36 | - targets: 37 | - 'alertmanager:9093' 38 | -------------------------------------------------------------------------------- /heplify-server/hom7-loudml-influx/README.md: -------------------------------------------------------------------------------- 1 | Homer 7, heplify-server, TICK Stack + LoudML 2 | ======== 3 | 4 | ![ezgif com-optimize 11](https://user-images.githubusercontent.com/1423657/47255154-c915b680-d46c-11e8-9ccb-882a0ed86f4a.gif) 5 | 6 | #### BETA VERSION! PLEASE REPORT BUGS AND IMPROVEMENTS 7 | 8 | This example bundles HOMER 7 + LoudML 1-Click predictions using InfluxDB and Chronograf 9 | 10 | For instructions and inspiration, see https://www.youtube.com/watch?v=qP910YmFpeQ 11 | 12 | 13 | ## Setup 14 | 15 | ```bash 16 | docker-compose up -d 17 | ``` 18 | 19 | to bring up: 20 | 21 | * HEPlify-server localhost:9060 (hep-only) 22 | * Homer localhost:9080 (admin/sipcapture) 23 | * TICK Stack 24 | * Chronograf localhost:9090 (admin/admin) 25 | * InfluxDB 26 | * Kapacitor 27 | * Telegraf 28 | * LoudML 29 | 30 | ## Notes 31 | When dealing with prometheus counters in InfluxDB, refer to the following example usage of `difference` and `derivative` functions when selecting: 32 | ``` 33 | SELECT difference(last("counter")) AS "mean_counter" FROM "homer"."autogen"."heplify_method_response" WHERE time > :dashboardTime: GROUP BY time(:interval:), "method", "response" FILL(null) 34 | ``` 35 | ``` 36 | SELECT derivative(last("counter")) AS "mean_counter" FROM "homer"."autogen"."heplify_method_response" WHERE time > :dashboardTime: GROUP BY time(:interval:), "method", "response" FILL(null) 37 | ``` 38 | 39 | ![image](https://user-images.githubusercontent.com/1423657/40862016-705d998a-65eb-11e8-8b03-e711b7b4498d.png) 40 | -------------------------------------------------------------------------------- /heplify-server/hom7-loudml-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/hom7-loudml-influx/conf/config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | datasources: 3 | - name: influx 4 | type: influxdb 5 | addr: influxdb:8086 6 | database: homer 7 | - name: kapacitor 8 | type: influxdb 9 | addr: kapacitor:9092 10 | database: from_loudml 11 | 12 | storage: 13 | path: /var/lib/loudml 14 | 15 | server: 16 | listen: 0.0.0.0:8077 17 | -------------------------------------------------------------------------------- /heplify-server/hom7-loudml-influx/conf/diffs.tick: -------------------------------------------------------------------------------- 1 | dbrp "homer"."60s" 2 | 3 | stream 4 | |from() 5 | .measurement('heplify_packets_total') 6 | .groupBy('type') 7 | |log() 8 | |difference('counter') 9 | |influxDBOut() 10 | .database('homer') 11 | .retentionPolicy('60s') 12 | .measurement('heplify_packets_total') 13 | 14 | -------------------------------------------------------------------------------- /heplify-server/hom7-loudml-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/hom7-loudml-influx/conf/init-user-db.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL 5 | CREATE DATABASE homer_config; 6 | EOSQL 7 | -------------------------------------------------------------------------------- /heplify-server/hom7-loudml-influx/conf/kapacitor.conf: -------------------------------------------------------------------------------- 1 | data_dir = "/var/lib/kapacitor" 2 | 3 | [replay] 4 | dir = "/var/lib/kapacitor/replay" 5 | 6 | [storage] 7 | boltdb = "/var/lib/kapacitor/kapacitor.db" 8 | 9 | [load] 10 | enabled = true 11 | dir="/var/lib/kapacitor/load" 12 | -------------------------------------------------------------------------------- /heplify-server/hom7-loudml-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/hom7-loudml-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 | namedrop = ["go*","process*","promhttp*"] 19 | 20 | -------------------------------------------------------------------------------- /hepop/hom7-elastic-only/README.md: -------------------------------------------------------------------------------- 1 | Homer Elastic 2 | ======== 3 | 4 | #### BETA VERSION! PLEASE REPORT BUGS AND IMPROVEMENTS 5 | 6 | This recipe will bring up a headless HOMER bundle, shipping RTC Events and Statistics to Elasticsearch. 7 | 8 | #### This recipe is compatible with JANUS and MediaSoup events 9 | 10 | 11 | ## Setup 12 | 13 | ```bash 14 | docker-compose up 15 | ``` 16 | 17 | to bring up: 18 | 19 | * HEPop localhost:8080 (json-only) 20 | * Telegraf 21 | * Kibana localhost:9090 (admin/admin) 22 | * Elasticsearch (hep-*), (heplify-*) 23 | 24 | 25 | --------------- 26 | ### Notes 27 | 28 | #### Timelion Formulas 29 | The following Timelion expressions can be used to graph CPS and RPS from HOMER statistics stored in Elasticsearch: 30 | ##### Registrations per Second 31 | ``` 32 | .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) 33 | ``` 34 | ##### Calls per Second 35 | ``` 36 | .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) 37 | ``` 38 | ##### Failures per Second 39 | ``` 40 | .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) 41 | ``` 42 | 43 | -------------------------------------------------------------------------------- /hepop/hom7-elastic-only/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 | -------------------------------------------------------------------------------- /hepop/hom7-elastic-only/conf/marija.toml: -------------------------------------------------------------------------------- 1 | [datasource] 2 | 3 | [datasource.elasticsearch] 4 | type="elasticsearch" 5 | url="http://elasticsearch:9200/heplify-*" 6 | #username= 7 | #password= 8 | 9 | [[logging]] 10 | output = "stdout" 11 | level = "debug" 12 | -------------------------------------------------------------------------------- /hepop/hom7-elastic-only/conf/myconfig.js: -------------------------------------------------------------------------------- 1 | { 2 | "id" : "HEPop101", 3 | "socket": "http", 4 | "port": 8080, 5 | "address": "0.0.0.0", 6 | "queue": { 7 | "timeout": 2000, 8 | "maxSize": 1000, 9 | "useInterval": true 10 | }, 11 | "dbName": "homer_data", 12 | "tableName": "hep", 13 | "db": { 14 | "rawSize": 8000, 15 | "elastic" : { 16 | "target": "http://elasticsearch:9200", 17 | "max_bulk_qtty": 10, 18 | "max_request_num": 20, 19 | "index": "homer" 20 | } 21 | }, 22 | "metrics": { 23 | "influx":{ 24 | "period": 30000, 25 | "expire": 300000, 26 | "dbName": "hep", 27 | "hostname": "telegraf:8094" 28 | } 29 | }, 30 | "debug": false 31 | } 32 | -------------------------------------------------------------------------------- /hepop/hom7-elastic-only/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 = false 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 | [[inputs.http_listener]] 55 | ## Address and port to host HTTP listener on 56 | service_address = ":8094" 57 | -------------------------------------------------------------------------------- /hepop/hom7-elastic-only/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2.1' 2 | 3 | services: 4 | caddy: 5 | container_name: caddy 6 | image: stefanprodan/caddy 7 | container_name: caddy 8 | ports: 9 | - "9090:9090" 10 | volumes: 11 | - ./caddy/:/etc/caddy/ 12 | environment: 13 | - ADMIN_USER=${ADMIN_USER:-admin} 14 | - ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin} 15 | restart: unless-stopped 16 | labels: 17 | org.label-schema.group: "monitoring" 18 | 19 | heplify-server: 20 | image: sipcapture/hepop:master 21 | container_name: heplify-server 22 | ports: 23 | - "8080:8080" 24 | - "9060:9060" 25 | - "9060:9060/udp" 26 | volumes: 27 | - ./conf/myconfig.js:/app/myconfig.js 28 | environment: 29 | HEPOP_HOST: 0.0.0.0 30 | HEPOP_PROTO: http 31 | HEPOP_ID: HEPOP_101 32 | HEPOP_PORT: 8080 33 | INFLUXDB_HOST: influxdb 34 | INFLUXDB_PORT: 8094 35 | INFLUXDB_DB: homer 36 | restart: unless-stopped 37 | expose: 38 | - 8080 39 | depends_on: 40 | - elasticsearch 41 | 42 | telegraf: 43 | image: telegraf:1.8-alpine 44 | container_name: telegraf 45 | restart: unless-stopped 46 | volumes: 47 | - ./conf/telegraf.conf:/etc/telegraf/telegraf.conf 48 | expose: 49 | - 8094 50 | ports: 51 | - "8094:8094" 52 | depends_on: 53 | - heplify-server 54 | 55 | elasticsearch: 56 | image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.3.1 57 | container_name: elasticsearch 58 | environment: ['http.host=0.0.0.0', 'transport.host=127.0.0.1'] 59 | ports: 60 | - "9200:9200" 61 | 62 | kibana: 63 | image: docker.elastic.co/kibana/kibana-oss:6.3.1 64 | container_name: kibana 65 | ports: 66 | - "5601:5601" 67 | depends_on: 68 | - elasticsearch 69 | -------------------------------------------------------------------------------- /hepop/hom7-hep-influx/README.md: -------------------------------------------------------------------------------- 1 | # 2 | 3 | **HEPop** is a prototype stand-alone [HEP](https://github.com/sipcapture/hep) Capture Server designed for [HOMER7](https://github.com/sipcapture/homer) capable of emitting indexed datasets and tagged timeseries to multiple backends in bulks. HEPop is developed using `NodeJS` and distributed using `npm`. 4 | 5 | HOMER-App, HEPop, TICK Stack 6 | ======== 7 | 8 | #### BETA VERSION! PLEASE REPORT BUGS AND IMPROVEMENTS 9 | 10 | ## Setup 11 | 12 | ```bash 13 | docker-compose up 14 | ``` 15 | 16 | to bring up: 17 | 18 | * HEPop Server localhost:9060 (hep-only) 19 | * Homer localhost:9080 (admin/sipcapture) 20 | * Chronograf localhost:9090 (admin/admin) 21 | * InfluxDB 22 | * Kapacitor 23 | * Telegraf 24 | 25 | -------------------------------------------------------------------------------- /hepop/hom7-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 | -------------------------------------------------------------------------------- /hepop/hom7-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 | -------------------------------------------------------------------------------- /hepop/hom7-hep-influx/conf/init-user-db.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL 5 | CREATE DATABASE homer_config; 6 | EOSQL 7 | 8 | psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL 9 | CREATE DATABASE homer_data; 10 | EOSQL 11 | -------------------------------------------------------------------------------- /hepop/hom7-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 | -------------------------------------------------------------------------------- /hepop/hom7-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 | namedrop = ["go*","process*","promhttp*"] 19 | 20 | -------------------------------------------------------------------------------- /hepop/hom7-json-influx/README.md: -------------------------------------------------------------------------------- 1 | # 2 | 3 | **HEPop** is a prototype stand-alone [HEP](https://github.com/sipcapture/hep) Capture Server designed for [HOMER7](https://github.com/sipcapture/homer) capable of emitting indexed datasets and tagged timeseries to multiple backends in bulks. HEPop is developed using `NodeJS` and distributed using `npm`. 4 | 5 | ![image](https://user-images.githubusercontent.com/1423657/47257858-83201900-d493-11e8-9242-49f5f38854c6.png) 6 | 7 | HOMER-App, HEPop JSON, TICK Stack 8 | ======== 9 | 10 | #### BETA VERSION! PLEASE REPORT BUGS AND IMPROVEMENTS 11 | 12 | ## Setup 13 | 14 | ```bash 15 | docker-compose up 16 | ``` 17 | 18 | to bring up: 19 | 20 | * HEPop HTTP Server localhost:8080 (JSON-only) 21 | * Homer localhost:9080 (admin/sipcapture) 22 | * TICK Stack 23 | * Chronograf localhost:9090 (admin/admin) 24 | * InfluxDB 25 | * Kapacitor 26 | * Telegraf 27 | 28 | -------------------------------------------------------------------------------- /hepop/hom7-json-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 | -------------------------------------------------------------------------------- /hepop/hom7-json-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 | -------------------------------------------------------------------------------- /hepop/hom7-json-influx/conf/init-user-db.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL 5 | CREATE DATABASE homer_config; 6 | EOSQL 7 | 8 | psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL 9 | CREATE DATABASE homer_data; 10 | EOSQL 11 | -------------------------------------------------------------------------------- /hepop/hom7-json-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 | -------------------------------------------------------------------------------- /hepop/hom7-json-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 | namedrop = ["go*","process*","promhttp*"] 19 | 20 | -------------------------------------------------------------------------------- /hepop/hom7-loudml-influx/README.md: -------------------------------------------------------------------------------- 1 | Homer 7, HEPop server, TICK Stack + LoudML 2 | ======== 3 | 4 | 5 | ![ezgif com-optimize 11](https://user-images.githubusercontent.com/1423657/47255154-c915b680-d46c-11e8-9ccb-882a0ed86f4a.gif) 6 | 7 | This example bundles HOMER 7 + LoudML 1-Click predictions using InfluxDB and Chronograf 8 | 9 | For instructions and inspiration, see https://www.youtube.com/watch?v=qP910YmFpeQ 10 | 11 | 12 | #### BETA VERSION! PLEASE REPORT BUGS AND IMPROVEMENTS 13 | 14 | ## Setup 15 | 16 | ```bash 17 | docker-compose up -d 18 | ``` 19 | 20 | to bring up: 21 | 22 | * HEPop server localhost:9060 (hep-only) 23 | * Homer localhost:9080 (admin/sipcapture) 24 | * TICK Stack 25 | * Chronograf localhost:9090 (admin/admin) 26 | * InfluxDB 27 | * Kapacitor 28 | * Telegraf 29 | * LoudML 30 | 31 | 32 | -------------------------------------------------------------------------------- /hepop/hom7-loudml-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 | -------------------------------------------------------------------------------- /hepop/hom7-loudml-influx/conf/config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | datasources: 3 | - name: influx 4 | type: influxdb 5 | addr: influxdb:8086 6 | database: homer 7 | - name: kapacitor 8 | type: influxdb 9 | addr: kapacitor:9092 10 | database: from_loudml 11 | 12 | storage: 13 | path: /var/lib/loudml 14 | 15 | server: 16 | listen: 0.0.0.0:8077 17 | -------------------------------------------------------------------------------- /hepop/hom7-loudml-influx/conf/diffs.tick: -------------------------------------------------------------------------------- 1 | dbrp "homer"."60s" 2 | 3 | stream 4 | |from() 5 | .measurement('heplify_packets_total') 6 | .groupBy('type') 7 | |log() 8 | |difference('counter') 9 | |influxDBOut() 10 | .database('homer') 11 | .retentionPolicy('60s') 12 | .measurement('heplify_packets_total') 13 | 14 | -------------------------------------------------------------------------------- /hepop/hom7-loudml-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 | -------------------------------------------------------------------------------- /hepop/hom7-loudml-influx/conf/init-user-db.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL 5 | CREATE DATABASE homer_config; 6 | EOSQL 7 | -------------------------------------------------------------------------------- /hepop/hom7-loudml-influx/conf/kapacitor.conf: -------------------------------------------------------------------------------- 1 | data_dir = "/var/lib/kapacitor" 2 | 3 | [replay] 4 | dir = "/var/lib/kapacitor/replay" 5 | 6 | [storage] 7 | boltdb = "/var/lib/kapacitor/kapacitor.db" 8 | 9 | [load] 10 | enabled = true 11 | dir="/var/lib/kapacitor/load" 12 | -------------------------------------------------------------------------------- /hepop/hom7-loudml-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 | -------------------------------------------------------------------------------- /hepop/hom7-loudml-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 | namedrop = ["go*","process*","promhttp*"] 19 | 20 | -------------------------------------------------------------------------------- /hepop/readme.md: -------------------------------------------------------------------------------- 1 | # 2 | 3 | **HEPop** is a prototype stand-alone [HEP](https://github.com/sipcapture/hep) Capture Server designed for [HOMER7](https://github.com/sipcapture/homer) capable of emitting indexed datasets and tagged timeseries to multiple backends in bulks. HEPop is developed using `NodeJS` and distributed using `npm`. 4 | 5 | 6 | ##### All container bundles in this directory are based on HEPop Server 7 | -------------------------------------------------------------------------------- /homer.env: -------------------------------------------------------------------------------- 1 | # ---- Timezone 2 | TZ="Etc/UTC" 3 | 4 | # ---- MySQL Setup 5 | 6 | # Database user / pass for homer. 7 | DB_USER=homer_user 8 | DB_PASS=homer_password 9 | 10 | # The Homer docker setup, by default, uses its own MySQL running in it's own container, locally. 11 | # If you'd rather use a different server, change USE_REMOVE_SQL to true 12 | # And set DB_HOST to the hostname or IP address of your MySQL server 13 | # When using local MySQL, DB_HOST must be set to false. 14 | USE_REMOTE_MYSQL=false 15 | DB_HOST=mysql 16 | 17 | # This allows to set up a port different than the default one 18 | DB_PORT=3306 19 | 20 | # Root password for mysql (if a local instance) 21 | MYSQL_ROOT_PASSWORD=secret 22 | 23 | # ----- HEP Listen port. 24 | KAMAILIO_HEP_PORT=9060 25 | -------------------------------------------------------------------------------- /k8s-docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | # --------------------------------------------- Web app container 4 | webapp: 5 | container_name: homer-webapp 6 | build: ./webapp/. 7 | image: dougbtv/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 | hepgen: 23 | container_name: hepgen 24 | build: ./hepgen/. 25 | image: dougbtv/hepgen 26 | # --------------------------------------------- cron container 27 | cron: 28 | container_name: homer-cron 29 | build: ./cron-k8s/. 30 | image: dougbtv/homer-k8s-cron 31 | depends_on: 32 | - mysql 33 | volumes: 34 | - homer-data-semaphore:/homer-semaphore/ 35 | links: 36 | - "mysql:mysql" 37 | env_file: 38 | - ./homer.env 39 | restart: always 40 | # --------------------------------------------- Kamailio container 41 | kamailio: 42 | container_name: homer-kamailio 43 | build: ./kamailio/. 44 | image: dougbtv/homer-kamailio 45 | ports: 46 | - "9060:9060/udp" 47 | depends_on: 48 | - mysql 49 | links: 50 | - "mysql:mysql" 51 | volumes: 52 | - homer-data-semaphore:/homer-semaphore/ 53 | # entrypoint: 54 | # - /bin/bash 55 | # command: 56 | # > 57 | # -c 'while true; do sleep 60; done;' 58 | env_file: 59 | - ./homer.env 60 | restart: always 61 | # --------------------------------------------- Data bootstrapping container 62 | # debug with: 63 | # docker run -it --volumes-from homer-webapp --network homerdocker_default --link mysql:mysql mysql:5.6 /bin/bash 64 | bootstrap: 65 | container_name: bootstrap-mysql 66 | build: ./bootstrap-data/. 67 | image: dougbtv/homer-bootstrap-data 68 | depends_on: 69 | - mysql 70 | links: 71 | - "mysql:mysql" 72 | volumes: 73 | - homer-data-semaphore:/homer-semaphore/ 74 | # entrypoint: 75 | # - /bin/bash 76 | # command: 77 | # > 78 | # -c 'while true; do sleep 60; done;' 79 | entrypoint: 80 | - /bootstrap.sh 81 | env_file: 82 | - ./homer.env 83 | # --------------------------------------------- MySQL container. 84 | mysql: 85 | container_name: mysql 86 | image: mysql:5.6 87 | ports: 88 | - "3306:3306" 89 | volumes: 90 | - ./mysql/run.sh:/run.sh 91 | - homer-data-semaphore:/homer-semaphore/ 92 | - homer-data-mysql:/var/lib/mysql 93 | entrypoint: 94 | - /run.sh 95 | env_file: 96 | - ./homer.env 97 | restart: always 98 | volumes: 99 | homer-data-semaphore: 100 | homer-data-mysql: 101 | homer-data-dashboard: 102 | -------------------------------------------------------------------------------- /k8s/README.md: -------------------------------------------------------------------------------- 1 | # homer-k8s 2 | 3 | Running Homer in Kubernetes. 4 | 5 | ## Running it (Currently WIP!) 6 | 7 | Clone it (Currently based on k8s branch for Doug's PoC.) 8 | 9 | ``` 10 | git clone -b k8s https://github.com/dougbtv/homer-docker.git 11 | cd homer-docker/k8s/ 12 | ``` 13 | 14 | And then create from the given specs. 15 | 16 | ``` 17 | [centos@kube-master k8s]$ kubectl create -f persistent.yaml 18 | [centos@kube-master k8s]$ kubectl create -f deploy.yaml 19 | [centos@kube-master k8s]$ kubectl create -f service.yaml 20 | ``` 21 | 22 | ## Validating the install. 23 | 24 | Let's try it with HEPgen. 25 | 26 | 27 | 28 | ## Exposing externally. 29 | 30 | ``` 31 | [centos@kube-master k8s]$ ifconfig | grep 192 32 | inet 192.168.122.227 netmask 255.255.255.0 broadcast 192.168.122.255 33 | 34 | [centos@kube-master k8s]$ kubectl get svc 35 | NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE 36 | bootstrap None 55555/TCP 18h 37 | cron None 55555/TCP 18h 38 | glusterfs-cluster 10.107.176.131 1/TCP 23h 39 | kamailio 10.97.100.89 9060/UDP 18h 40 | kubernetes 10.96.0.1 443/TCP 12d 41 | mysql None 3306/TCP 18h 42 | webapp 10.106.85.188 80/TCP 18h 43 | [centos@kube-master k8s]$ kubectl get pods 44 | NAME READY STATUS RESTARTS AGE 45 | cron-129834167-dcct9 1/1 Running 0 2h 46 | kamailio-1707360978-3qpsd 1/1 Running 0 2h 47 | mysql-2123826865-sxf5s 1/1 Running 0 2h 48 | webapp-3460772183-4qj99 1/1 Running 0 2h 49 | 50 | [centos@kube-master k8s]$ kubectl delete svc webapp 51 | service "webapp" deleted 52 | [centos@kube-master k8s]$ kubectl expose deployment webapp --port=80 --target-port=80 --external-ip 192.168.122.227 53 | service "webapp" exposed 54 | ``` 55 | 56 | And in my case, tunnel it... since it's running on VMs "out in the ether" 57 | 58 | ssh root@192.168.1.119 -L 8080:192.168.122.227:80 59 | 60 | 61 | 62 | ## Converting yaml with Kompose. 63 | 64 | Installation in Fedora (also available in CentOS EPEL). Failed for Doug on first try. (kompose go app crashed) 65 | 66 | ``` 67 | sudo dnf -y install kompose 68 | ``` 69 | 70 | Or from source with: 71 | 72 | ``` 73 | sudo dnf install -y golang 74 | mkdir /usr/src/gocode 75 | export GOPATH=/usr/src/gocode 76 | go get -u github.com/kubernetes-incubator/kompose 77 | ``` 78 | 79 | And run the convert... 80 | 81 | ``` 82 | $ pwd 83 | ~/homer-docker/k8s 84 | $ /usr/src/gocode/bin/kompose -f ../docker-compose.yml convert 85 | ``` 86 | 87 | And concatenate them together to be nice... 88 | 89 | ``` 90 | $ for each in *persist*; do (cat $each && echo "---")>>pers.yaml; done 91 | $ for each in *service*; do (cat $each && echo "---")>>serv.yaml; done 92 | $ for each in *deploy*; do (cat $each && echo "---")>>depl.yaml; done 93 | ``` 94 | 95 | -------------------------------------------------------------------------------- /k8s/persistent.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: PersistentVolumeClaim 3 | metadata: 4 | creationTimestamp: null 5 | name: homer-data-dashboard 6 | # This storage class is a work around for now... 7 | # see: https://github.com/kubernetes/kubernetes/issues/43929 8 | spec: 9 | storageClassName: gluster 10 | accessModes: 11 | - ReadWriteOnce 12 | resources: 13 | requests: 14 | storage: 100Mi 15 | status: {} 16 | --- 17 | apiVersion: v1 18 | kind: PersistentVolumeClaim 19 | metadata: 20 | creationTimestamp: null 21 | name: homer-data-mysql 22 | spec: 23 | storageClassName: gluster 24 | accessModes: 25 | - ReadWriteOnce 26 | resources: 27 | requests: 28 | storage: 250Mi 29 | status: {} 30 | --- 31 | apiVersion: v1 32 | kind: PersistentVolumeClaim 33 | metadata: 34 | creationTimestamp: null 35 | name: homer-data-semaphore 36 | spec: 37 | storageClassName: gluster 38 | accessModes: 39 | - ReadWriteOnce 40 | resources: 41 | requests: 42 | storage: 5Mi 43 | status: {} 44 | --- -------------------------------------------------------------------------------- /k8s/raw-kompose/bootstrap-claim0-persistentvolumeclaim.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: PersistentVolumeClaim 3 | metadata: 4 | creationTimestamp: null 5 | name: bootstrap-claim0 6 | spec: 7 | accessModes: 8 | - ReadWriteOnce 9 | resources: 10 | requests: 11 | storage: 100Mi 12 | status: {} 13 | -------------------------------------------------------------------------------- /k8s/raw-kompose/bootstrap-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: extensions/v1beta1 2 | kind: Deployment 3 | metadata: 4 | creationTimestamp: null 5 | name: bootstrap 6 | spec: 7 | replicas: 1 8 | strategy: 9 | type: Recreate 10 | template: 11 | metadata: 12 | creationTimestamp: null 13 | labels: 14 | service: bootstrap 15 | spec: 16 | containers: 17 | - command: 18 | - /bootstrap.sh 19 | env: 20 | - name: TZ 21 | value: '"Etc/UTC"' 22 | - name: DB_USER 23 | value: homer_user 24 | - name: DB_PASS 25 | value: homer_password 26 | - name: USE_REMOTE_MYSQL 27 | value: "false" 28 | - name: DB_HOST 29 | value: mysql 30 | - name: DB_PORT 31 | value: "3306" 32 | - name: MYSQL_ROOT_PASSWORD 33 | value: secret 34 | - name: KAMAILIO_HEP_PORT 35 | value: "9060" 36 | image: mysql:5.6 37 | name: bootstrap-mysql 38 | resources: {} 39 | volumeMounts: 40 | - mountPath: /homer-semaphore/ 41 | name: homer-data-semaphore 42 | - mountPath: /bootstrap.sh 43 | name: bootstrap-claim0 44 | - mountPath: /homer-api/ 45 | name: webapp-claim0 46 | - mountPath: /homer-semaphore/ 47 | name: homer-data-semaphore 48 | - mountPath: /var/www/html/store/dashboard/ 49 | name: homer-data-dashboard 50 | restartPolicy: Always 51 | volumes: 52 | - name: homer-data-semaphore 53 | persistentVolumeClaim: 54 | claimName: homer-data-semaphore 55 | - name: bootstrap-claim0 56 | persistentVolumeClaim: 57 | claimName: bootstrap-claim0 58 | - name: webapp-claim0 59 | persistentVolumeClaim: 60 | claimName: webapp-claim0 61 | - name: homer-data-semaphore 62 | persistentVolumeClaim: 63 | claimName: homer-data-semaphore 64 | - name: homer-data-dashboard 65 | persistentVolumeClaim: 66 | claimName: homer-data-dashboard 67 | status: {} 68 | -------------------------------------------------------------------------------- /k8s/raw-kompose/bootstrap-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | creationTimestamp: null 5 | labels: 6 | service: bootstrap 7 | name: bootstrap 8 | spec: 9 | clusterIP: None 10 | ports: 11 | - name: headless 12 | port: 55555 13 | targetPort: 0 14 | selector: 15 | service: bootstrap 16 | status: 17 | loadBalancer: {} 18 | -------------------------------------------------------------------------------- /k8s/raw-kompose/cron-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: extensions/v1beta1 2 | kind: Deployment 3 | metadata: 4 | creationTimestamp: null 5 | name: cron 6 | spec: 7 | replicas: 1 8 | strategy: 9 | type: Recreate 10 | template: 11 | metadata: 12 | creationTimestamp: null 13 | labels: 14 | service: cron 15 | spec: 16 | containers: 17 | - env: 18 | - name: TZ 19 | value: '"Etc/UTC"' 20 | - name: DB_USER 21 | value: homer_user 22 | - name: DB_PASS 23 | value: homer_password 24 | - name: USE_REMOTE_MYSQL 25 | value: "false" 26 | - name: DB_HOST 27 | value: mysql 28 | - name: DB_PORT 29 | value: "3306" 30 | - name: MYSQL_ROOT_PASSWORD 31 | value: secret 32 | - name: KAMAILIO_HEP_PORT 33 | value: "9060" 34 | image: sipcapture/homer-cron 35 | name: homer-cron 36 | resources: {} 37 | volumeMounts: 38 | - mountPath: /homer-semaphore/ 39 | name: homer-data-semaphore 40 | restartPolicy: Always 41 | volumes: 42 | - name: homer-data-semaphore 43 | persistentVolumeClaim: 44 | claimName: homer-data-semaphore 45 | status: {} 46 | -------------------------------------------------------------------------------- /k8s/raw-kompose/cron-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | creationTimestamp: null 5 | labels: 6 | service: cron 7 | name: cron 8 | spec: 9 | clusterIP: None 10 | ports: 11 | - name: headless 12 | port: 55555 13 | targetPort: 0 14 | selector: 15 | service: cron 16 | status: 17 | loadBalancer: {} 18 | -------------------------------------------------------------------------------- /k8s/raw-kompose/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | # --------------------------------------------- Web app container 4 | webapp: 5 | container_name: homer-webapp 6 | build: ./webapp/. 7 | image: dougbtv/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: dougbtv/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: dougbtv/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 | -------------------------------------------------------------------------------- /k8s/raw-kompose/homer-data-dashboard-persistentvolumeclaim.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: PersistentVolumeClaim 3 | metadata: 4 | creationTimestamp: null 5 | name: homer-data-dashboard 6 | spec: 7 | accessModes: 8 | - ReadWriteOnce 9 | resources: 10 | requests: 11 | storage: 100Mi 12 | status: {} 13 | -------------------------------------------------------------------------------- /k8s/raw-kompose/homer-data-mysql-persistentvolumeclaim.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: PersistentVolumeClaim 3 | metadata: 4 | creationTimestamp: null 5 | name: homer-data-mysql 6 | spec: 7 | accessModes: 8 | - ReadWriteOnce 9 | resources: 10 | requests: 11 | storage: 100Mi 12 | status: {} 13 | -------------------------------------------------------------------------------- /k8s/raw-kompose/homer-data-semaphore-persistentvolumeclaim.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: PersistentVolumeClaim 3 | metadata: 4 | creationTimestamp: null 5 | name: homer-data-semaphore 6 | spec: 7 | accessModes: 8 | - ReadWriteOnce 9 | resources: 10 | requests: 11 | storage: 100Mi 12 | status: {} 13 | -------------------------------------------------------------------------------- /k8s/raw-kompose/kamailio-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: extensions/v1beta1 2 | kind: Deployment 3 | metadata: 4 | creationTimestamp: null 5 | name: kamailio 6 | spec: 7 | replicas: 1 8 | strategy: 9 | type: Recreate 10 | template: 11 | metadata: 12 | creationTimestamp: null 13 | labels: 14 | service: kamailio 15 | spec: 16 | containers: 17 | - env: 18 | - name: TZ 19 | value: '"Etc/UTC"' 20 | - name: DB_USER 21 | value: homer_user 22 | - name: DB_PASS 23 | value: homer_password 24 | - name: USE_REMOTE_MYSQL 25 | value: "false" 26 | - name: DB_HOST 27 | value: mysql 28 | - name: DB_PORT 29 | value: "3306" 30 | - name: MYSQL_ROOT_PASSWORD 31 | value: secret 32 | - name: KAMAILIO_HEP_PORT 33 | value: "9060" 34 | image: sipcapture/homer-kamailio 35 | name: homer-kamailio 36 | ports: 37 | - containerPort: 9060 38 | protocol: UDP 39 | resources: {} 40 | volumeMounts: 41 | - mountPath: /homer-semaphore/ 42 | name: homer-data-semaphore 43 | restartPolicy: Always 44 | volumes: 45 | - name: homer-data-semaphore 46 | persistentVolumeClaim: 47 | claimName: homer-data-semaphore 48 | status: {} 49 | -------------------------------------------------------------------------------- /k8s/raw-kompose/kamailio-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | creationTimestamp: null 5 | labels: 6 | service: kamailio 7 | name: kamailio 8 | spec: 9 | ports: 10 | - name: "9060" 11 | port: 9060 12 | protocol: UDP 13 | targetPort: 9060 14 | selector: 15 | service: kamailio 16 | status: 17 | loadBalancer: {} 18 | -------------------------------------------------------------------------------- /k8s/raw-kompose/mysql-claim0-persistentvolumeclaim.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: PersistentVolumeClaim 3 | metadata: 4 | creationTimestamp: null 5 | name: mysql-claim0 6 | spec: 7 | accessModes: 8 | - ReadWriteOnce 9 | resources: 10 | requests: 11 | storage: 100Mi 12 | status: {} 13 | -------------------------------------------------------------------------------- /k8s/raw-kompose/mysql-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: extensions/v1beta1 2 | kind: Deployment 3 | metadata: 4 | creationTimestamp: null 5 | name: mysql 6 | spec: 7 | replicas: 1 8 | strategy: 9 | type: Recreate 10 | template: 11 | metadata: 12 | creationTimestamp: null 13 | labels: 14 | service: mysql 15 | spec: 16 | containers: 17 | - command: 18 | - /run.sh 19 | env: 20 | - name: TZ 21 | value: '"Etc/UTC"' 22 | - name: DB_USER 23 | value: homer_user 24 | - name: DB_PASS 25 | value: homer_password 26 | - name: USE_REMOTE_MYSQL 27 | value: "false" 28 | - name: DB_HOST 29 | value: mysql 30 | - name: DB_PORT 31 | value: "3306" 32 | - name: MYSQL_ROOT_PASSWORD 33 | value: secret 34 | - name: KAMAILIO_HEP_PORT 35 | value: "9060" 36 | image: mysql:5.6 37 | name: mysql 38 | resources: {} 39 | volumeMounts: 40 | - mountPath: /run.sh 41 | name: mysql-claim0 42 | - mountPath: /homer-semaphore/ 43 | name: homer-data-semaphore 44 | - mountPath: /var/lib/mysql 45 | name: homer-data-mysql 46 | restartPolicy: Always 47 | volumes: 48 | - name: mysql-claim0 49 | persistentVolumeClaim: 50 | claimName: mysql-claim0 51 | - name: homer-data-semaphore 52 | persistentVolumeClaim: 53 | claimName: homer-data-semaphore 54 | - name: homer-data-mysql 55 | persistentVolumeClaim: 56 | claimName: homer-data-mysql 57 | status: {} 58 | -------------------------------------------------------------------------------- /k8s/raw-kompose/mysql-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | creationTimestamp: null 5 | labels: 6 | service: mysql 7 | name: mysql 8 | spec: 9 | clusterIP: None 10 | ports: 11 | - name: headless 12 | port: 55555 13 | targetPort: 0 14 | selector: 15 | service: mysql 16 | status: 17 | loadBalancer: {} 18 | -------------------------------------------------------------------------------- /k8s/raw-kompose/webapp-claim0-persistentvolumeclaim.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: PersistentVolumeClaim 3 | metadata: 4 | creationTimestamp: null 5 | name: webapp-claim0 6 | spec: 7 | accessModes: 8 | - ReadWriteOnce 9 | resources: 10 | requests: 11 | storage: 100Mi 12 | status: {} 13 | -------------------------------------------------------------------------------- /k8s/raw-kompose/webapp-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: extensions/v1beta1 2 | kind: Deployment 3 | metadata: 4 | creationTimestamp: null 5 | name: webapp 6 | spec: 7 | replicas: 1 8 | strategy: 9 | type: Recreate 10 | template: 11 | metadata: 12 | creationTimestamp: null 13 | labels: 14 | service: webapp 15 | spec: 16 | containers: 17 | - env: 18 | - name: TZ 19 | value: '"Etc/UTC"' 20 | - name: DB_USER 21 | value: homer_user 22 | - name: DB_PASS 23 | value: homer_password 24 | - name: USE_REMOTE_MYSQL 25 | value: "false" 26 | - name: DB_HOST 27 | value: mysql 28 | - name: DB_PORT 29 | value: "3306" 30 | - name: MYSQL_ROOT_PASSWORD 31 | value: secret 32 | - name: KAMAILIO_HEP_PORT 33 | value: "9060" 34 | image: sipcapture/homer-webapp 35 | name: homer-webapp 36 | ports: 37 | - containerPort: 80 38 | resources: {} 39 | volumeMounts: 40 | - mountPath: /homer-api/ 41 | name: webapp-claim0 42 | - mountPath: /homer-semaphore/ 43 | name: homer-data-semaphore 44 | - mountPath: /var/www/html/store/dashboard/ 45 | name: homer-data-dashboard 46 | restartPolicy: Always 47 | volumes: 48 | - name: webapp-claim0 49 | persistentVolumeClaim: 50 | claimName: webapp-claim0 51 | - name: homer-data-semaphore 52 | persistentVolumeClaim: 53 | claimName: homer-data-semaphore 54 | - name: homer-data-dashboard 55 | persistentVolumeClaim: 56 | claimName: homer-data-dashboard 57 | status: {} 58 | -------------------------------------------------------------------------------- /k8s/raw-kompose/webapp-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | creationTimestamp: null 5 | labels: 6 | service: webapp 7 | name: webapp 8 | spec: 9 | ports: 10 | - name: "80" 11 | port: 80 12 | targetPort: 80 13 | selector: 14 | service: webapp 15 | status: 16 | loadBalancer: {} 17 | -------------------------------------------------------------------------------- /k8s/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | creationTimestamp: null 5 | labels: 6 | service: bootstrap 7 | name: bootstrap 8 | spec: 9 | clusterIP: None 10 | ports: 11 | - name: headless 12 | port: 55555 13 | targetPort: 0 14 | selector: 15 | service: bootstrap 16 | status: 17 | loadBalancer: {} 18 | --- 19 | apiVersion: v1 20 | kind: Service 21 | metadata: 22 | creationTimestamp: null 23 | labels: 24 | service: cron 25 | name: cron 26 | spec: 27 | clusterIP: None 28 | ports: 29 | - name: headless 30 | port: 55555 31 | targetPort: 0 32 | selector: 33 | service: cron 34 | status: 35 | loadBalancer: {} 36 | --- 37 | apiVersion: v1 38 | kind: Service 39 | metadata: 40 | creationTimestamp: null 41 | labels: 42 | service: kamailio 43 | name: kamailio 44 | spec: 45 | ports: 46 | - name: "9060" 47 | port: 9060 48 | protocol: UDP 49 | targetPort: 9060 50 | selector: 51 | service: kamailio 52 | status: 53 | loadBalancer: {} 54 | --- 55 | apiVersion: v1 56 | kind: Service 57 | metadata: 58 | creationTimestamp: null 59 | labels: 60 | service: mysql 61 | name: mysql 62 | spec: 63 | clusterIP: None 64 | ports: 65 | - name: "3306" 66 | port: 3306 67 | protocol: TCP 68 | targetPort: 3306 69 | selector: 70 | service: mysql 71 | status: 72 | loadBalancer: {} 73 | --- 74 | apiVersion: v1 75 | kind: Service 76 | metadata: 77 | creationTimestamp: null 78 | labels: 79 | service: webapp 80 | name: webapp 81 | spec: 82 | ports: 83 | - name: "80" 84 | port: 80 85 | targetPort: 80 86 | selector: 87 | service: webapp 88 | status: 89 | loadBalancer: {} 90 | --- 91 | -------------------------------------------------------------------------------- /kamailio/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 | 12 | # Kamailio + sipcapture module 13 | RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xfb40d3e6508ea4c8 14 | RUN echo "deb http://deb.kamailio.org/kamailio jessie main" >> etc/apt/sources.list 15 | RUN echo "deb-src http://deb.kamailio.org/kamailio jessie main" >> etc/apt/sources.list 16 | RUN apt-get update -qq && apt-get install -f -yqq \ 17 | kamailio \ 18 | rsyslog \ 19 | geoip-database \ 20 | geoip-database-extra \ 21 | kamailio-outbound-modules \ 22 | kamailio-geoip-modules \ 23 | kamailio-sctp-modules \ 24 | kamailio-tls-modules \ 25 | kamailio-websocket-modules \ 26 | kamailio-utils-modules \ 27 | kamailio-mysql-modules \ 28 | kamailio-extra-modules \ 29 | && rm -rf /var/lib/apt/lists/* 30 | 31 | COPY kamailio.cfg /etc/kamailio/kamailio.cfg 32 | RUN chmod 775 /etc/kamailio/kamailio.cfg 33 | 34 | RUN ln -s /usr/lib64 /usr/lib/x86_64-linux-gnu/ 35 | 36 | COPY run.sh /run.sh 37 | 38 | # HEP 39 | EXPOSE 9060 40 | 41 | ENTRYPOINT ["/run.sh"] 42 | -------------------------------------------------------------------------------- /kamailio/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # ---------------------------------------------------- 3 | # HOMER 5 Docker (http://sipcapture.org) 4 | # ---------------------------------------------------- 5 | # -- Run script for Homer's Kamailio 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 | # DB_PORT MySQL port (3306) 12 | # KAMAILIO_HEP_PORT Kamailio HEP Socket port (9060) 13 | # ---------------------------------------------------- 14 | 15 | # Wait for MySQL 16 | 17 | while [[ ! -f "/homer-semaphore/.bootstrapped" ]]; do 18 | echo "Kamailio, waiting for MySQL" 19 | sleep 2; 20 | done 21 | 22 | echo "Kamailio container detected MySQL is running & bootstrapped" 23 | 24 | # Kamailio config 25 | export PATH_KAMAILIO_CFG=/etc/kamailio/kamailio.cfg 26 | 27 | awk '/max_while_loops=100/{print $0 RS "mpath=\"//usr/lib/x86_64-linux-gnu/kamailio/modules/\"";next}1' $PATH_KAMAILIO_CFG >> $PATH_KAMAILIO_CFG.tmp | 2&>1 >/dev/null 28 | mv $PATH_KAMAILIO_CFG.tmp $PATH_KAMAILIO_CFG 29 | 30 | # Replace values in template 31 | perl -p -i -e "s/\{\{ CAPTURE_NODE \}\}/$CAPTURE_NODE/" $PATH_KAMAILIO_CFG 32 | perl -p -i -e "s/\{\{ KAMAILIO_HEP_PORT \}\}/$KAMAILIO_HEP_PORT/" $PATH_KAMAILIO_CFG 33 | perl -p -i -e "s/\{\{ DB_PASS \}\}/$DB_PASS/" $PATH_KAMAILIO_CFG 34 | perl -p -i -e "s/\{\{ DB_HOST \}\}/$DB_HOST/" $PATH_KAMAILIO_CFG 35 | perl -p -i -e "s/\{\{ DB_PORT \}\}/$DB_PORT/" $PATH_KAMAILIO_CFG 36 | perl -p -i -e "s/\{\{ DB_USER \}\}/$DB_USER/" $PATH_KAMAILIO_CFG 37 | 38 | # Change kamailio datestamp for sql tables 39 | # sed -i -e 's/# $var(a) = $var(table) + "_" + $timef(%Y%m%d);/$var(a) = $var(table) + "_" + $timef(%Y%m%d);/' $PATH_KAMAILIO_CFG 40 | # sed -i -e 's/$var(a) = $var(table) + "_%Y%m%d";/# runscript removed -- $var(a) = $var(table) + "_%Y%m%d";/' $PATH_KAMAILIO_CFG 41 | 42 | # Make an alias, kinda. 43 | kamailio=$(which kamailio) 44 | 45 | # Test the syntax. 46 | $kamailio -f $PATH_KAMAILIO_CFG -c 47 | 48 | # It's Homer time! 49 | $kamailio -f $PATH_KAMAILIO_CFG -DD -E -e 50 | 51 | -------------------------------------------------------------------------------- /mysql/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # ---------------------------------------------------- 3 | # HOMER 5 Docker (http://sipcapture.org) 4 | # ---------------------------------------------------- 5 | # -- To facilitate starting (or not starting) MySQL 6 | # -- based on option to use remote mysql. 7 | # ---------------------------------------------------- 8 | # Reads from environment variables to set: 9 | # USE_REMOTE_MYSQL If true, does not start mysql 10 | 11 | if [[ "$USE_REMOTE_MYSQL" = true ]]; then 12 | echo "MySQL existing, not necessary." 13 | else 14 | ./entrypoint.sh mysqld 15 | fi 16 | -------------------------------------------------------------------------------- /opensips-everything/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | MAINTAINER L. Mangani 3 | # v.5.x 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 | && apt-get install --no-install-recommends --no-install-suggests -yqq ca-certificates perl libdbi-perl libclass-dbi-mysql-perl apache2 libapache2-mod-php5 php5 php5-cli php5-gd php-pear php5-dev php5-mysql php5-json php-services-json git wget pwgen curl && rm -rf /var/lib/apt/lists/* \ 12 | && a2enmod php5 13 | 14 | # Install MySQL 5.7 15 | RUN echo "Installing MySQL 5.7..." \ 16 | && echo "deb http://repo.mysql.com/apt//debian/ jessie mysql-apt-config" >> /etc/apt/sources.list \ 17 | && echo "deb http://repo.mysql.com/apt//debian/ jessie mysql-5.7" >> /etc/apt/sources.list \ 18 | && echo "deb http://repo.mysql.com/apt//debian/ jessie connector-python-2.0 connector-python-2.1 router-2.0 mysql-utilities-1.5 mysql-tools" >> /etc/apt/sources.list \ 19 | && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8C718D3B5072E1F5 && apt-get update && apt-get -y --no-install-recommends install mysql-community-server libmysqlclient20 20 | # && echo -e "\ncharacter-set-server=utf8 \ncollation-server=utf8_general_ci \nskip-character-set-client-handshake" >> /etc/mysql/my.cnf 21 | 22 | 23 | # comment out a few problematic configuration values 24 | # don't reverse lookup hostnames, they are usually another container 25 | # RUN sed -Ei 's/^(bind-address|log)/#&/' /etc/mysql/my.cnf \ 26 | RUN echo 'skip-host-cache\nskip-name-resolve' | awk '{ print } $1 == "[mysqld]" && c == 0 { c = 1; system("cat") }' /etc/mysql/my.cnf > /tmp/my.cnf \ 27 | && mv /tmp/my.cnf /etc/mysql/my.cnf 28 | 29 | WORKDIR / 30 | 31 | # HOMER 5 32 | RUN git clone https://github.com/sipcapture/homer-api.git /homer-api \ 33 | && git clone https://github.com/sipcapture/homer-ui.git /homer-ui \ 34 | 35 | && chmod -R +x /homer-api/scripts/mysql/* && cp -R /homer-api/scripts/mysql/. /opt/ \ 36 | && cp -R /homer-ui/* /var/www/html/ \ 37 | && cp -R /homer-api/api /var/www/html/ \ 38 | && chown -R www-data:www-data /var/www/html/store/ \ 39 | && chmod -R 0775 /var/www/html/store/dashboard \ 40 | 41 | && wget https://raw.githubusercontent.com/sipcapture/homer-config/master/docker/configuration.php -O /var/www/html/api/configuration.php \ 42 | && wget https://raw.githubusercontent.com/sipcapture/homer-config/master/docker/preferences.php -O /var/www/html/api/preferences.php \ 43 | && wget https://raw.githubusercontent.com/sipcapture/homer-config/master/docker/vhost.conf -O /etc/apache2/sites-enabled/000-default.conf 44 | 45 | # OpenSIPS + sipcapture module 46 | RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 049AD65B \ 47 | && echo "deb http://apt.opensips.org jessie 2.2-releases" >>/etc/apt/sources.list \ 48 | && apt-get update -qq && apt-get install -f -yqq rsyslog opensips opensips-geoip-module opensips-json-module opensips-mysql-module opensips-regex-module opensips-restclient-module && rm -rf /var/lib/apt/lists/* \ 49 | && rm /etc/opensips/opensips.cfg 50 | 51 | COPY data/opensips.m4 /etc/opensips/opensips.m4 52 | COPY data/opensips-es.m4 /etc/opensips/opensips-es.m4 53 | RUN chmod 775 /etc/opensips/opensips.m4 && chmod 775 /etc/opensips/opensips-es.m4 54 | 55 | # GeoIP (http://dev.maxmind.com/geoip/legacy/geolite/) 56 | RUN apt-get update -qq && apt-get install -f -yqq geoip-database geoip-database-extra \ 57 | # Install the cron service 58 | && touch /var/log/cron.log \ 59 | && apt-get install cron -y \ 60 | 61 | # Add our crontab file 62 | && echo "30 3 * * * /opt/homer_mysql_rotate >> /var/log/cron.log 2>&1" > /etc/cron.d/homer_mysql_rotate.conf \ 63 | && echo "local0.* -/var/log/opensips.log" > /etc/rsyslog.d/opensips.conf 64 | 65 | COPY run.sh /run.sh 66 | RUN chmod a+rx /run.sh 67 | 68 | COPY data/homer-es-template.json /etc/homer-es-template.json 69 | 70 | # Add persistent MySQL volumes 71 | # VOLUME ["/etc/mysql", "/var/lib/mysql", "/var/www/html/store"] 72 | 73 | # UI 74 | EXPOSE 80 75 | # HEP 76 | EXPOSE 9060 77 | 78 | ENTRYPOINT ["/run.sh"] 79 | -------------------------------------------------------------------------------- /opensips-everything/Makefile: -------------------------------------------------------------------------------- 1 | NAME ?= homer5 2 | PARAMS ?= -E 3 | 4 | all: build start run 5 | 6 | .PHONY: build start run 7 | build: 8 | docker build --tag="sipcapture/homer-docker-opensips:local" . 9 | 10 | start: 11 | docker run -tid --name $(NAME) sipcapture/homer-docker-opensips:local $(PARAMS) 12 | -------------------------------------------------------------------------------- /opensips-everything/README.md: -------------------------------------------------------------------------------- 1 | 2 | ![homer](http://i.imgur.com/ViXcGAD.png) 3 | 4 | # HOMER 5 Docker 5 | http://sipcapture.org 6 | 7 | A simple recipe to bring up a quick, self-contained Homer5 instance: 8 | 9 | * debian/jessie (base image) 10 | * OpenSIPS2.3:9060 (sipcapture module) 11 | * Apache2/PHP5:80 (homer ui/api) 12 | * MySQL5.6/InnoDB:3306 (homer db/data) 13 | 14 | Status: 15 | 16 | * [![Build Status](https://travis-ci.org/sipcapture/homer-docker-opensips.svg?branch=master)](https://travis-ci.org/sipcapture/homer-docker-opensips) 17 | 18 | * Initial working prototype - Testing Needed! 19 | 20 | ## Running single container. 21 | 22 | The single container instance is suitable for small setups and for testing only. For production, please consider using the multi-container version instead. 23 | 24 | ### Pull latest 25 | ``` 26 | docker pull sipcapture/homer-docker-opensips 27 | ``` 28 | 29 | ### Run latest 30 | ``` 31 | docker run -tid --name homer5 -p 80:80 -p 9060:9060/udp sipcapture/homer-docker-opensips 32 | ``` 33 | 34 | ### Running with a local MySQL 35 | 36 | By default, the container runs with a local instance of MySQL running. It may 37 | be of interest to run MySQL with a host directory mounted as a volume for 38 | MySQL data. This will help with keeping persistent data if you need to stop & 39 | remove the running container. (Which would otherwise delete the MySQL, without 40 | a mounted volume) 41 | 42 | You can run this container with a volume like so: 43 | 44 | ``` 45 | docker run -it -v /tmp/homer_mysql/:/var/lib/mysql --name homer5 \ 46 | -p 80:80 -p 9060:9060/udp sipcapture/homer-docker-opensips 47 | ``` 48 | 49 | ### Running with an external MySQL 50 | 51 | If you'd like to run with an external MySQL, pass in the host information for 52 | the remote MySQL as entrypoint parameters at the end of your `docker run` 53 | command. 54 | 55 | ``` 56 | docker run -tid --name homer5 -p 80:80 -p 9060:9060/udp sipcapture/homer-docker-opensips \ 57 | --dbhost 10.0.0.1 --dbuser homer_user --dbpass homer_password -E 58 | ``` 59 | 60 | ### Entrypoint Parameters 61 | 62 | For single-container only. 63 | 64 | ``` 65 | Homer5 Docker parameters: 66 | 67 | --dbpass -p MySQL password (homer_password) 68 | --dbuser -u MySQL user (homer_user) 69 | --dbhost -h MySQL host (127.0.0.1 [docker0 bridge]) 70 | --mypass -P MySQL root local password (secret) 71 | --es -E Enable ElasticSearch statistics storage (disabled) 72 | --es-url -U ElasticSearch URL (http://localhost:9200) 73 | --hep -H OpenSIPS HEP Socket port (9060) 74 | ``` 75 | 76 | ### ElasticSearch 77 | The `-E` or `--es` enables ElasticSearch storage for statistics. 78 | Parameter `-U` or `--es-url` sets the ElasticSearch URL and also enables the 79 | ElasticSearch storage. 80 | 81 | #### Note 82 | If you have started the container without ElasticSearch storage enabled, but 83 | you want to use it, simply overwrite `/etc/opensips/opensips.cfg` with 84 | `/etc/opensips/opensips-es.cfg.template`: 85 | ``` 86 | cp /etc/opensips/opensips-es.cfg.template /etc/opensips/opensips.cfg 87 | ``` 88 | 89 | ### Local Build & Test 90 | ``` 91 | git clone https://github.com/sipcapture/homer-docker-opensips; cd homer-docker-opensips 92 | docker build --tag="sipcapture/homer-docker-opensips:local" . 93 | docker run -tid --name homer5 sipcapture/homer-docker-opensips:local 94 | docker exec -it homer5 bash 95 | ``` 96 | -------------------------------------------------------------------------------- /opensips-everything/data/configuration.php: -------------------------------------------------------------------------------- 1 | 24 | -------------------------------------------------------------------------------- /opensips-everything/data/homer-es-template.json: -------------------------------------------------------------------------------- 1 | { 2 | "template": "homer-*", 3 | "mappings" : { 4 | "_default_" : { 5 | "_all" : {"enabled" : true, "omit_norms" : true}, 6 | "dynamic_templates" : 7 | [ 8 | { 9 | "ts_fields" : { 10 | "match" : "timestamp", 11 | "mapping" : { "type" : "date" } } 12 | }, { 13 | "geo_fields" : { 14 | "match" : "*_geo", 15 | "mapping": { "type": "geo_point" } } 16 | }, { 17 | "ip_fields" : { 18 | "match" : "*_ip", 19 | "mapping" : { "type" : "ip" } } 20 | }, { 21 | "byte_fields" : { 22 | "match" : "*_bytes", 23 | "mapping" : { "type" : "byte" } } 24 | }, 25 | { 26 | "string_fields" : { 27 | "match" : "*", 28 | "match_mapping_type" : "string", 29 | "mapping" : { 30 | "type" : "string", "index" : "analyzed", "omit_norms" : true, 31 | "fields" : { "raw" : {"type": "string", "index" : "not_analyzed", "ignore_above" : 256}} 32 | } 33 | } 34 | } 35 | ] 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /opensips-everything/data/preferences.php: -------------------------------------------------------------------------------- 1 | 72 | -------------------------------------------------------------------------------- /opensips-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 | -------------------------------------------------------------------------------- /opensips/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | MAINTAINER L. Mangani 3 | # v.5.05 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 && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 049AD65B \ 11 | && echo "deb http://apt.opensips.org jessie 2.2-releases" >>/etc/apt/sources.list \ 12 | && apt-get update -qq && apt-get install -f -yqq rsyslog opensips opensips-geoip-module opensips-json-module opensips-mysql-module opensips-regex-module opensips-restclient-module geoip-database geoip-database-extra && rm -rf /var/lib/apt/lists/* 13 | 14 | RUN mkdir -p /etc/opensips 15 | COPY opensips.cfg /etc/opensips/opensips.cfg 16 | RUN chmod 775 /etc/opensips/opensips.cfg 17 | 18 | RUN ln -s /usr/lib64 /usr/lib/x86_64-linux-gnu/ 19 | 20 | # GeoIP (http://dev.maxmind.com/geoip/legacy/geolite/) 21 | # RUN cd /usr/share/GeoIP && curl http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz > GeoLiteCity.dat.gz && gunzip GeoLiteCity.dat.gz 22 | 23 | RUN apt-get clean 24 | RUN rm -rf /var/lib/apt/lists/* 25 | 26 | COPY run.sh /run.sh 27 | 28 | # HEP 29 | EXPOSE 5062 30 | EXPOSE 9060 31 | 32 | ENTRYPOINT ["/run.sh"] 33 | -------------------------------------------------------------------------------- /opensips/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # ---------------------------------------------------- 3 | # HOMER 5 Docker (http://sipcapture.org) 4 | # ---------------------------------------------------- 5 | # -- Run script for Homer's OpenSIPS 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 | # OPENSIPS_HEP_PORT OpenSIPS HEP Socket port (9060) 12 | # ---------------------------------------------------- 13 | 14 | # Wait for MySQL 15 | 16 | while [[ ! -f "/homer-semaphore/.bootstrapped" ]]; do 17 | echo "OpenSIPS, waiting for MySQL" 18 | sleep 2; 19 | done 20 | 21 | echo "OpenSIPS container detected MySQL is running & bootstrapped" 22 | 23 | # OpenSIPS config 24 | export PATH_OPENSIPS_CFG=/usr/local/opensips/etc/opensips/opensips.cfg 25 | 26 | # Replace values in template 27 | # perl -p -i -e "s/9060/$OPENSIPS_HEP_PORT/" $PATH_OPENSIPS_CFG 28 | perl -p -i -e "s/homer_password/$DB_PASS/" $PATH_OPENSIPS_CFG 29 | perl -p -i -e "s/homer_user/$DB_USER/" $PATH_OPENSIPS_CFG 30 | 31 | # Make an alias, kinda. 32 | opensips=$(which opensips) 33 | 34 | # Test the syntax. 35 | $opensips -f $PATH_OPENSIPS_CFG -c 36 | 37 | # It's Homer time! 38 | $opensips -f $PATH_OPENSIPS_CFG -DD -E -e 39 | -------------------------------------------------------------------------------- /webapp/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 | COPY run.sh /run.sh 38 | RUN chmod a+rx /run.sh 39 | 40 | # Add persistent volumes 41 | VOLUME ["/var/www/html/store"] 42 | 43 | # UI 44 | EXPOSE 80 45 | 46 | ENTRYPOINT ["/run.sh"] 47 | -------------------------------------------------------------------------------- /webapp/configuration.php: -------------------------------------------------------------------------------- 1 | 24 | -------------------------------------------------------------------------------- /webapp/preferences.php: -------------------------------------------------------------------------------- 1 | 80 | -------------------------------------------------------------------------------- /webapp/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # HOMER 5 Docker (http://sipcapture.org) 3 | # ---------------------------------------------------- 4 | # -- Run script for Homer's Web application 5 | # ---------------------------------------------------- 6 | # Reads from environment variables to set: 7 | # DB_PASS MySQL password (homer_password) 8 | # DB_USER MySQL user (homer_user) 9 | # DB_HOST MySQL host (127.0.0.1 [docker0 bridge]) 10 | # KAMAILIO_HEP_PORT Kamailio HEP Socket port (9060) 11 | # ---------------------------------------------------- 12 | 13 | # Wait for MySQL 14 | 15 | while [[ ! -f "/homer-semaphore/.bootstrapped" ]]; do 16 | echo "Homer web app, waiting for MySQL" 17 | sleep 2; 18 | done 19 | 20 | echo "Homer web app container detected MySQL is running & bootstrapped" 21 | 22 | 23 | # HOMER API CONFIG 24 | PATH_HOMER_CONFIG=/var/www/html/api/configuration.php 25 | chmod 775 $PATH_HOMER_CONFIG 26 | 27 | # Replace values in template 28 | perl -p -i -e "s/\{\{ DB_PASS \}\}/$DB_PASS/" $PATH_HOMER_CONFIG 29 | perl -p -i -e "s/\{\{ DB_HOST \}\}/$DB_HOST/" $PATH_HOMER_CONFIG 30 | perl -p -i -e "s/\{\{ DB_USER \}\}/$DB_USER/" $PATH_HOMER_CONFIG 31 | 32 | # Set Permissions for webapp 33 | mkdir /var/www/html/api/tmp 34 | chmod -R 0777 /var/www/html/api/tmp/ 35 | chown -R www-data:www-data /var/www/html/store/dashboard 36 | chmod -R 0775 /var/www/html/store/dashboard* 37 | 38 | #enable apache mod_php and mod_rewrite 39 | a2enmod php5 40 | a2enmod rewrite 41 | 42 | # Apache gets grumpy about PID files pre-existing 43 | rm -f /var/run/apache2/apache2.pid 44 | 45 | # Start Apache 46 | apachectl -DFOREGROUND 47 | # apachectl start 48 | -------------------------------------------------------------------------------- /webapp/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 | --------------------------------------------------------------------------------