Skip to content

Deploy: Azure

Krzysiek Madejski edited this page Feb 21, 2019 · 3 revisions

Note: Do you know that non-profits can access US $3500 in Azure credits to set up cloud solutions?

Step 1: Create Resource Group

You can easily do it in the portal.

Step 2: Configuration

The question is how do you want to keep your Matterbridge configuration.

Method 1: Static config file on Storage Account

The easiest method is probably to create a Storage Account with a file share and upload there your matterbridge.toml.

Method 2: Versioned configuration on Github

To manage and make it transparent what channels get bridged you might want to keep the configuration versioned on Github and provide tokens via environment variables.

Example: config file and env variables.

Session files

When using WhatsApp bridge it's handy to save session files. For this you will need a mounted volume. You can either use Storage Account mentioned above, or a Secrets Storage.

Step 3: Create container instance

Sadly mounting volumes (Github or Storage Account) is not available from Portal so you have to use the CLI (there is CLI icon in the top menu).

For Github-backed config type:

az container create \
    --resource-group matterbridge \
    --name matterbridge-container \
    --image 42wim/matterbridge:1.13.0 \
    --os-type Linux \
    --restart-policy OnFailure \
    --command-line "/bin/matterbridge -conf /home/config/matterbridge.toml" \
    --gitrepo-url https://github.com/Code-for-All/matterbridge-config \
    --gitrepo-mount-path /home/config \
    --environment-variables 'MATTERBRIDGE_SLACK_CODEFORALL_TOKEN'='xoxb-' 'MATTERBRIDGE_SLACK_EPANSTWO_TOKEN'='xoxb-'

Docs: Github params

For file-share-backed config type:

az container create \
    --resource-group matterbridge \
    --name matterbridge-container \
    --image 42wim/matterbridge:1.13.0 \
    --os-type Linux \
    --restart-policy OnFailure \
    --command-line "/bin/matterbridge -conf /home/config/matterbridge.toml" \
    --azure-file-volume-account-name $ACI_PERS_STORAGE_ACCOUNT_NAME \
    --azure-file-volume-account-key $STORAGE_KEY \
    --azure-file-volume-share-name $ACI_PERS_SHARE_NAME \
    --azure-file-volume-mount-path /home/config 

Check here how to find the file share keys.

Step 4: Check if it works

In Portal, in the menu on the left got to Settings -> Containers and click on the Logs tab. If everything goes well you should see following message:

time="2019-02-04T10:30:19Z" level=info msg="Gateway(s) started succesfully. Now relaying messages" prefix=main

If something is wrong, a verbal error message should guide you to solve it.

Step 5: Update

When you change the config file you just have to restart the container for the new settings to be pulled in. If the config file is hosted on Github and mounted as mentioned above, the restart will download the current commit.

Clone this wiki locally