Cluster
Adding new Kazoo Clusters to Tower of Power#
In Tower of Power, the Kazoo Clusters are used for both authentication, and MVNO identification. For now, Kazoo Clusters have a 1-to-1 relationship to MVNOs, meaning that a Cluster has only one MVNO, and an MVNO has only one Cluster. In the database, however, Clusters and MVNOs each have their own document, linking to each other.
This documentation explains how to add a new Cluster to the database. For information on how to add a new MVNO, please checkout the MVNO documentation.
Note: For Tower of Power to be able to work, there must be at least one Cluster/MVNO pair in the database, typically our own (2600hz).
Creating the Cluster database#
If you are freshly deploying TOP v2 on a new server, the Cluster database will first have to be created.
Note: If the database kazoo_clusters-top
already exists, you can skip this step.
- First, create a new database with the following name:
kazoo_clusters-top
. - Next, you will need to create the design document allowing to list clusters by their MVNO:
{ "_id": "_design/clusters", "language": "javascript", "views": { "list_by_mvno": { "map": "function(doc) { emit(doc.mvno, {'id':doc._id, 'mvno': doc.mvno })}" } } }
Adding the Cluster document#
Now that the database has been created, you can simply add your Cluster document to it. A Cluster document should contain the following fields:
{
"_id": "8a901bea1d3297ef7d4c8d34809472c2",
"mvno_id": "2600hz",
"pvt_api_url": "http://{SERVER}:{PORT}",
"pvt_api_key": "<encrypted_api_key>",
"pvt_type": "kazoo_cluster"
}
- The
_id
field should be the actual Cluster's ID, not a randomly generated UUID. - The
mvno_id
field must be the ID of the MVNO document linked to this Cluster. Here, it is set to our own MVNO. - The
pvt_api_url
field must contain the API URL for this Cluster. This will be used to call -among other things- the crossbar authentication APIs. - The
pvt_api_key
must be an encrypted API key from the master account (superduper admin) for this Cluster. See below how to encrypt it. - The
pvt_type
field must be set to"kazoo_cluster"
.
To encrypt the API key:
* Go to the script folder at the root of the project cd <top_project_root>/scripts
* Execute the encrypt_api_key.php script with your API key as a parameter php ./encrypt_api_key.php <api_key>
* Grab the encrypted API key from the standard output.
Note: since the script uses relative paths, you must be in the scripts directory to execute it.
Adding the Cluster's MVNO#
As mentioned before, each Cluster must be linked to an MVNO, via the mvno_id
field specified above.
If you haven't done it yet, please head over to the MVNO documentation to learn how to add a new MVNO.