Installing Snikket

1. Snikket

Snikket is a chat application based on XMPP. A Snikket server allows you to chat on a server via XMPP, create groups and much more!

2. DNS Records

To use Snikket, some records must be created in the DNS settings of the corresponding domain. These are as follows:

2.1. A-Record

# Domain           TTL  Class  Type  Target
chat.lugbz.org.  300  IN     A     <IP Adress of Server>

2.2. CNAME-Record

# Domain            TTL  Class  Type   Target
groups.chat.lugbz.org  300  IN     CNAME  chat.lugbz.org.
share.chat.lugbz.org   300  IN     CNAME  chat.lugbz.org.

3. Creation LXC

Create the Linux Container with LXC

lxc launch images:ubuntu/22.04 snikket -c security.nesting=true -c security.syscalls.intercept.mknod=true -c security.syscalls.intercept.setxattr=true
lxc list
lxc list -c ns4t
lxc info snikket
lxc config show snikket

4. Give the Container a static IP

Open a bash session inside the LXC

lxc exec snikket -- bash

Find out the IP of the LXC

ip address
ip route

Set a static IP for the container

rm /etc/netplan/*.yaml
cat <<EOF > /etc/netplan/01-netcfg.yaml
network:
version: 2
ethernets:
eth0:
dhcp4: no
addresses:
- 10.24.177.203/8
nameservers:
addresses: [9.9.9.9, 1.1.1.1]
routes:
- to: default
via: 10.24.177.1
EOF

apply the configuration

netplan apply

Check if the new IP address is applied successfully

ip address
ip route
ping 8.8.8.8

5. Forward to the Ports of snikket

To make snikket accessible from outside the local network, the required ports are forwarded.

HOST_IP=85.10.195.94           # the public IP of the host
CONTAINER_IP=10.24.177.203     # local container IP
lxc network forward create lxdbr0 $HOST_IP
lxc network forward list lxdbr0
lxc network forward show lxdbr0 $HOST_IP

5.1. Forward the Ports on the Firewall

If BigBlueButton is installed on the same server, problems may occur. BBB uses ports 3479, 50001-65535, which is used in Snikket’s docs for WebRTC. Therefore our setting is a bit different.

5.1.1. TCP (when BBB is installed)

lxc network forward port add lxdbr0 85.10.195.94 tcp 5222, 5269, 5000, 3478, 5349, 5350 10.24.177.203

5.1.2. UDP (when BBB is installed)

lxc network forward port add lxdbr0 85.10.195.94 udp 3479, 5349, 5350, 40001-50000 10.24.177.203

6. Installation snikket on the container

6.1. Installation of docker + compose

In order to use snikket, docker is required. To install the Docker Engine the following must be executed.

Open bash of LXC Container

lxc exec snikket -- bash

6.1.1. Add Docker’s official GPG key:

sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

6.1.2. Add the repository to Apt sources:

echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

6.1.3. Installation of the last Docker version

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

7. Installation snikket

Now let’s create Snikket

Create the Directory of the Snikket installation

mkdir /etc/snikket
cd /etc/snikket

download the latest docker compose file

curl -o docker-compose.yml https://snikket.org/service/resources/docker-compose.beta.yml

edit the config file of the snikket installation

nano snikket.config

Content (with BBB on the server)

# The primary domain of your Snikket instance
SNIKKET_DOMAIN=chat.lugbz.org

# An email address where the admin can be contacted
# (also used to register your Let's Encrypt account to obtain certificates)
SNIKKET_ADMIN_EMAIL=<admin-email>

# See: https://snikket.org/service/help/advanced/config/#snikket_tweak_turnserver
SNIKKET_TWEAK_TURNSERVER=0
SNIKKET_TWEAK_TURNSERVER_DOMAIN=bbb.lugbz.social
SNIKKET_TWEAK_TURNSERVER_SECRET=<your-secret-key>

Now start the docker compose container

docker compose up -d