Joe Black | me@joeblack.nyc | github
Minimal image with kazoo, monster-ui, monster-apps, & kazoo-sounds. This image uses a custom, minimal version of Debian Linux.
- 2600hz Github: https://github.com/2600hz/kazoo
- 4.2.x sup-commands: https://gist.github.com/joeblackwaslike/345b9eb3b81d6033d26aaf1953c0f4fe
The aim of this project is combine or experience running Kazoo in docker in a way that lowers the barrier of entry for others.
We target a local docker only environment using docker-compose and a production environment using Kubernetes as the cluster manager. We reccomend the same but effort has been made to ensure this image is flexible and contains enough environment variables to allow significant customization to your needs.
Pull requests with improvements always welcome.
The build environment has been split off from this repo and now lives @ https://github.com/telephoneorg/kazoo-builder. See the README.md file there for more details on the build environment.
The following variables are standard in most of our Dockerfiles to reduce duplication and make scripts reusable among different projects:
APP
: kazooUSER
: kazooHOME
/opt/kazoo
Run environment variables are used in the entrypoint script to render configuration templates, perform flow control, etc. These values can be overridden when inheriting from the base dockerfile, specified during docker run
, or in kubernetes manifests in the env
array.
KAZOO_APPS
: a comma delimited list used directly by the kazoo_apps erlang vm as the list of default apps to start.ERLANG_THREADS
: passed to the+A
argument in vm.args.ERLANG_COOKIE
: written to~/.erlang.cookie
by theerlang-cookie
script in/usr/local/bin
.KAZOO_LOG_LEVEL
: lowercased and used as the value for the console log level in the log section ofconfig.ini
.KAZOO_LOG_COLOR
: used as the value for thecolored
tuple insys.config
.REGION
: interpolated withDATACENTER
as such${COUNTRY}-${REGION}
and stored inKAZOO_ZONE
. SeeKAZOO_ZONE
.COUNTRY
: interpolated withREGION
as such${COUNTRY}-${REGION}
and stored inKAZOO_ZONE
. SeeKAZOO_ZONE
.KAZOO_ZONE
: when provided, interpolation ofCOUNTRY
andREGION
is ignored and the value ofKAZOO_ZONE
is used directly. This is useful for local test and dev environments where ZONE's don't matter. Used as name in[zone]
section and aszone
attribute in other sections ofconfig.ini
.COUCHDB_HOST
: the hostname or ip address of the load balancer to reach bigcouch or couchdb through. Used in thebigcouch
section ofconfig.ini
.COUCHDB_DATA_PORT
: used as the value for theport
key in thebigcouch
section ofconfig.ini
.COUCHDB_ADMIN_PORT
: used as the value for theadmin_port
key in thebigcouch
section ofconfig.ini
.COUCHDB_USER
: used as the value for theusername
key in thebigcouch
section ofconfig.ini
.COUCHDB_PASS
: used as the value for thepassword
key in thebigcouch
section ofconfig.ini
.RABBITMQ_USER
: interpolated as such"amqp://user:pass@host:5672"
and used for alluri
keys in theamqp
section or theamqp_uri
keys in thezone
section ofconfig.ini
.RABBITMQ_PASS
: interpolated as such"amqp://user:pass@host:5672"
and used for alluri
keys in theamqp
section or theamqp_uri
keys in thezone
section ofconfig.ini
.RABBITMQ_HOST
: hostname or ip address, interpolated as such"amqp://{user}:{pass}@{host}:5672"
, and used in theamqp_uri
property of thezone
section ofconfig.ini
.
There is a binary called kazoo-tool in ~/bin
. It contains the useful functions such as remote_console, upgrade, etc found in the original kazoo service file. Since using service files in a docker container is largely a very bad idea, I've extracted the useful functions and adapted them to work in the container environment.
All of our docker-* repos in github have CI pipelines that push to docker cloud/hub.
This image is available at:
- https://store.docker.com/community/images/telephoneorg/kazoo
- https://hub.docker.com/r/telephoneorg/kazoo.
docker pull telephoneorg/kazoo
To run:
docker run -d \
--name kazoo \
-h kazoo.local \
-e "COUCHDB_HOST=bigcouch.local" \
-e "RABBITMQ_HOST=rabbitmq.local" \
-e "KAZOO_LOG_LEVEL=debug" \
-e "KAZOO_APPS=blackhole,callflow,cdr,conference,crossbar,doodle,ecallmgr,hangups,hotornot,konami,jonny5,media_mgr,milliwatt,omnipresence,pivot,registrar,reorder,stepswitch,sysconf,teletype,trunkstore,webhooks" \
-e "ERLANG_COOKIE=test-cookie" \
-p "8000:8000" \
telephoneorg/kazoo
NOTE: Please reference the Run Environment section for the list of available environment variables.
Pull the images
docker-compose pull
Start application and dependencies
# start in foreground
docker-compose up --abort-on-container-exit
# start in background
docker-compose up -d
Edit the manifests under kubernetes/<environment>
to reflect your specific environment and configuration.
Create a secret for the erlang cookie:
kubectl create secret generic erlang --from-literal=cookie=$(LC_ALL=C tr -cd '[:alnum:]' < /dev/urandom | head -c 64)
Ensure that:
- Secrets exist for the
rabbitmq
andcouchdb
credentials, otherwise supply them directly in the env array of the pod template. - rabbitmq deployment and couchdb statefulset is running. This container will be paused by the kubewait init-container until it's service dependencies exist and pass readiness-checks.
Deploy kazoo:
kubectl create -f kubernetes/<environment>