GitHubContribute in GitHub: Edit online

copyright: years: 2017, 2023 lastupdated: "2023-04-21"


Deploying a multi-tenant JSON configuration

As with other IBM® Voice Gateway environments, you can deploy a multi-tenant JSON configuration on-premises with Docker or in the public cloud with Kubernetes-based IBM® Cloud Kubernetes Service by using Advanced JSON configuration properties. JSON configuration is supported in Version 1.0.0.2 and later.

After you deploy your environment, each tenant will be available at the configured tenant URI and can be accessed at a SIP or SIPS URI such as sip:12345556789@myhost.com. Because Voice Gateway verifies the inbound SIP requests based on the SIP To header field and Request-URI value, only calls to the configured tenants can connect.

Before you begin

Familiarize yourself with Voice Gateway deployment options and try out a basic deployment in Getting started with Voice Gateway.

Learn about how to use JSON configuration, and create a tenant configuration JSON file. For more information, see Configuring tenants in a multi-tenant JSON configuration.

The following instructions assume that your tenant configuration JSON file, tenantConfig.json, is in the same local directory as your Voice Gateway configuration.

Deploying with Docker Engine

  1. In your docker-compose.yml file, mount a directory as a Docker volume to contain the tenant configuration. Mounting the directory ensures that the configuration persists when Voice Gateway is redeployed. For more information about Docker volumes, see the Docker documentation.

    To mount the local directory, specify the directory mapping in host_directory:container_directory format on a volumes key for the SIP Orchestrator container. In the following example, $PWD resolves to the current working directory and mounts it to the /vgwConf/ path on the SIP Orchestrator container.

    services:
      sip.orchestrator:
        ...
        volumes:
          - $PWD:/vgwConf/
    
  2. Specify the path to the tenant configuration file on the MULTI_TENANT_CONFIG_FILE Docker environment variable in the Voice Gateway configuration.

MULTI_TENANT_CONFIG_FILE=/vgwConf/tenantConfig.json

  {:codeblock}

1. On the command line, go to the directory that contains your configuration, and redeploy Voice Gateway by running the `docker-compose up` command.

## Deploying on IBM Cloud Kubernetes Service {: #deploy-multi-ibmcloud}

1. Create a Kubernetes secret from your tenant configuration. Kubernetes secrets secure the credentials and other sensitive information in your tenant configuration so that it's not stored verbatim in your Kubernetes cluster.

  On the command line, change to your deployment directory, and run the following command to create the secret from your `tenantConfig.json` file.
  ```bash
kubectl create secret generic tenantconfig --from-file=tenantConfig.json
{:codeblock}
  1. In your deploy.json file, specify references to the tenant configuration file and the secret that you created.

    Tip: For a complete example, see the deploy-multitenant.json file in the sample.voice.gateway GitHub repository.

    • In the deployment configuration, configure the secret with the name and file that you specified when you created it:

"volumes": [{ ... { "name": "tenantconfig", "secret": { "secretName": "tenantconfig", "items": [{ "key": "tenantConfig.json", "path": "tenantConfig.json" }] } }]

  * In the SIP Orchestrator container (`vgw-sip-orchestrator`) configuration, specify the path to the tenant configuration file on the `MULTI_TENANT_CONFIG_FILE` variable. Also mount your tenant configuration secret as a volume.
  ```json
"name": "vgw-sip-orchestrator",
"image": "icr.io/voice-gateway/sip-orchestrator:latest",
...
"env": [
    ...
    {
      "name": "MULTI_TENANT_CONFIG_FILE",
      "value": "/tenantconfig/tenantConfig.json"
  }],
"resources": {},
"volumeMounts": [{
      "name": "tenantconfig",
      "mountPath": "/tenantconfig/tenantConfig.json",
      "subPath": "tenantConfig.json"
}]
  1. Create a Kubernetes secret from your tenantConfig.json file by running the following command.

kubectl create secret generic tenantconfig --from-file=tenantConfig.json

  {:codeblock}
1. Redeploy Voice Gateway by running the `kubectl create` command.
  ```bash
kubectl create -f deploy.json
{:codeblock}