Riot web for Matrix with Docker and Traefik

joenas profile image Jon Neverland Originally published at jonnev.se on ・3 min read

Riot web for Matrix with Docker and Traefik

So Riot is the "glossy" web client for Matrix that I prefer to use, at least when not using the desktop one. I've previously written a guide on how to set up your own homeserver and now I thought I'd share how I deploy my Riot instance.


As always this guide assumes some general knowledge of Linux and also that you have a server available with these services installed:

⚠️ The domain needs to be different than your homeserver domain. Read more here. Using a subdomain should be fine, ie if your homeserver is at example.com you could use riot.example.com.

If you don't want to use Traefik you could use any other reverse proxy to forward the traffic to the docker container. Be sure to add SSL/TLS to that proxy with for example Let's Encrypt!

If you're setting up a new VPS feel free to use my referral link at Digital Ocean to get $10 for your server 😊


We'll create a directory for Riot to live in and some supporting files.

mkdir -p /opt/riot 

# If you had to use sudo above, set the permissions to your user to make life easier
sudo chmod -R $USER:$USER -R /opt/riot

mkdir /opt/riot/config
mkdir /opt/riot/versions
touch /opt/riot/docker-compose.yml

docker-compose, with Traefik

Let's start with our docker-compose. Scroll down a bit for an example not using Traefik.

nano /opt/riot/docker-compose.yml

version: '2'

    image: nginx:1.12-alpine
    container_name: riot
    restart: unless-stopped
      - web
      - "traefik.enable=true"
      - "traefik.frontend.rule=Host:riot.example.com"
      - "traefik.port=80"
      - "traefik.docker.network=web"
      - ./riot-web:/usr/share/nginx/html/
      - ./config/config.json:/usr/share/nginx/html/config.json

    external: true

☝️ Remember to replace riot.example.com in traefik.frontend.rule and change the name of the external network if needed.

No Traefik

Use or modify this if using another reverse proxy.

version: '2'

    image: nginx:1.12-alpine
    container_name: riot
    restart: unless-stopped
      - ""
      - ./riot-web:/usr/share/nginx/html/
      - ./config/config.json:/usr/share/nginx/html/config.json

Fetch latest Riot version

Now we fetch the tarball of the lastest Riot release, extract it and put it in the versions folder. Then we create symlink to be able to update the version in an easy way.

wget -qO- https://github.com/vector-im/riot-web/releases/download/v0.17.8/riot-v0.17.8.tar.gz | tar xvz -C /opt/riot/versions
ln -s /opt/riot/versions/riot-v0.17.8 /opt/riot/riot-web

☝️ Be sure to check the releases page and update the commands above accordingly if there is a newer release!


Copy the sample config and edit it to your needs.

cp riot-web/riot-v0.17.8/config.sample.json /opt/riot/config/config.json
nano /opt/riot/config/config.json

I only changed these values:

    "default_hs_url": "https://matrix.example.com",
    "brand": "Custom Brand",
    "roomDirectory": {
        "servers": [

Run it!

And we're good to go. Run docker-compose up -d and you should be able to access your domain and login 😃


To update to a new Riot version check the releases page, fetch the new version by modifying these commands. Then link the new release, stop and start your container again.

wget -qO- https://github.com/vector-im/riot-web/releases/download/v0.17.8/VERSION.tar.gz | tar xvz -C /opt/riot/versions
docker-compose stop
rm riot-web
ln -s /opt/riot/versions/VERSION /opt/riot/riot-web
docker-compose up -d


Editor guide