Make sure that all of the mandatory prerequisites have been met before progressing further.
| Name | Source | Description |
|---|---|---|
| <CONTAINER_NAME> | User input | The name of the linux container that will be used to host the respective servers for SimpleX Chat. |
| <IP_ADDRESS_INET_GW> | Linux VPS Admin Panel | The static and public IPv4 address of the Internet Gateway. |
| <IP_ADDRESS_SERVER__VPN> | User input | The IPv4 address of the server on the Edge in the VPN, e.g. 10.5.5.2. |
Going through all the steps in this guide shall take around 30 min. with decent Internet connection.
Run the following commands on your server on the Edge.
incus launch images:debian/bullseye/cloud <CONTAINER_NAME>
incus exec <CONTAINER_NAME> bash
ip link set dev eth0 mtu 1100
apt update
apt upgrade
apt install fish openssl wget
chsh -s /usr/bin/fish
useradd -m smp
mkdir -p /var/opt/simplex
mkdir -p /etc/opt/simplex
chown smp:smp /var/opt/simplex
chown smp:smp /etc/opt/simplex
mkdir -p /opt/smp
chown -R smp:smp /opt/smp
cd /opt/smp
wget https://github.com/simplex-chat/simplexmq/releases/download/v5.5.3/smp-server-ubuntu-20_04-x86-64
mv smp-server-ubuntu-20_04-x86-64 smp-server
chown smp:smp smp-server
chmod +x smp-server
vi /etc/systemd/system/smp-server.service
Add the following content and save the file.
[Unit]
Description=SMP server
[Service]
User=smp
Group=smp
Type=simple
ExecStart=/opt/smp/smp-server start
ExecStopPost=/usr/bin/env sh -c '[ -e "/var/opt/simplex/smp-server-store.log" ] && cp "/var/opt/simplex/smp-server-store.log" "/var/opt/simplex/smp-server-store.log.bak"'
KillSignal=SIGINT
TimeoutStopSec=infinity
Restart=always
RestartSec=10
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable smp-server.service
sudo su smp -c "./smp-server init"
Accept all of the default options until you reach this question.
Enter server FQDN or IP address for certificate (127.0.0.1):
Make sure the IP address of the Internet Gateway (<IP_ADDRESS_INET_GW>) will be used by the smp-server.
At the end of the initialisation process a server address URL will be generated for you. Store it somewhere as you will need it to set up your app to use the SMP server.
systemctl start smp-server.service
If the service has started successfully, exit the container. On the Server on the Edge run the following command.
incus config device add <CONTAINER_NAME> port_5223 proxy connect="tcp:127.0.0.1:5223" listen="tcp:0.0.0.0:5223"
We need to set up TCP port forwarding on the Internet Gateway, so that the SMP server would be able to serve requests.
ssh mycelium@<IP_ADDRESS_INET_GW>
ufw allow 5223
sudo apt update && sudo apt install socat
sudo vi /etc/systemd/system/smp-bridge.service
Add the following content and save the file.
Do not forget to substitute <IP_ADDRESS_SERVER__VPN> with the actual IP address of the Server on the Edge.
# /etc/systemd/system/smp-bridge.service
[Unit]
Description=A service managing the tcp port forwarding to a SimpleX Chat SMP server
[Service]
Type=simple
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=smp-bridge
ExecStart=socat -d -d TCP-LISTEN:5223,forever,reuseaddr,fork TCP4:<IP_ADDRESS_SERVER__VPN>:5223
Restart=always
RuntimeMaxSec=900 # the service will be restarted every 15 min.
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable smp-bridge.service
sudo systemctl start smp-bridge.service
You should be able to connect to your smp server from the Simplex Chat app on your phone. Navigate to "Networks & servers" -> "SMP servers" and use the SMP server address that was generated during the initialisation of the server.
From here on every SimpleX Chat client app can use this server as a relay server for text, voice messages and reactions.