Provide a repository to store how to configure Matterbridge from github to connect with Weather.IM IEM Chat. This chat is not an ALERT service, but we are simply relying on a relay for this. This can fail at any time, provided without warranty. Use must comply with the license agreement defined in this repository.
We're assuming you're either root, or can use sudo before each command.
-
Get a Linux VM with internet access. Ensure it is fully updated on the latest LTS release of Ubuntu, or appropriate Debian distribution, to stay with this guide. Document your work, keep the passwords stored securely and in a location accessible to the ALERT IT Group.
-
Brute force attacks on VM Servers are a thing. Appropriately harden the Linux installation. See potential guide. In essence, ensure that authentication is based on certificate rather than password. Create sudo logins, allow SSH for those logins, and disable ssh for root login. Arrange for some kind of update cadence, to address any CVE's that might come up. Understand the security risk surface: While this VM is likely not going to store sensitive nonpublic info, you never want a rogue VM using Slack or XMPP credentials on ALERT's behalf.
-
REVIEW/UPDATE releases, if new versions exist, and and run the
INSTALL.shscript. *Always pre-review curl-bash scripts, for security! They can change, no matter how much you trust the repository.
bash -c "$(wget -qLO - https://raw.githubusercontent.com/nz2o/K4NWS-bot-relay/main/PREINSTALL.sh)"
- Configure the matterbridge.toml file, and place it in
/etc/matterbridge/matterbridge.toml. See this repository's example configuration for a better idea of what needs to happen.
nano /etc/matterbridge/matterbridge.toml
- Slack bot setup also has to happen here, using this guide. Note that you might have to tweak oauth scopes, because Slack chose to go granular.
- From anywhere, run
matterbridge -version. Expected output is the version number. - From anywhere, run
matterbridge -debug -conf /etc/matterbridge/matterbridge.tomlExpected output:
[0000] INFO main: [setupLogger:matterbridge.go:104] Enabling debug logging.
[0000] INFO main: [main:matterbridge.go:44] Running version 1.26.0 6dafebc7
[0000] INFO config: [NewConfig:bridge/config/config.go:274] Opening log file /var/log/matterbridge/matterbridge.log
*** It should NOT return you to a shell prompt. Use Ctrl+C to break out/end the app.
Be sure to examine the log. Address any errors.
nano /var/log/matterbridge/matterbridge.log
Your output should look like this:
[0000] INFO router: [Start:gateway/router.go:66] Parsing gateway k4nwsbot
[0000] INFO router: [Start:gateway/router.go:75] Starting bridge: xmpp.iemchat
[0000] INFO xmpp: [Connect:bridge/xmpp/xmpp.go:45] Connecting weather.im:5222
If that's good, it's time to create a SYSTEMD service, to ensure it runs at start, and restarts at error.
- Let's make a SYSTEMD service! Use this guide. See example in repository.
Once you create the file, run
systemctl daemon-reloadto refresh SYSTEMD. - Start the service
service matterbridge start - Check the service
service matterbridge statusIt should look like this: If it does, you're done!
● matterbridge.service - Matterbridge daemon
Loaded: loaded (/etc/systemd/system/matterbridge.service; enabled; preset: enabled)
Active: active (running) since Sun 2024-12-29 18:26:42 UTC; 4s ago
Main PID: 2264 (matterbridge)
Tasks: 5 (limit: 2877)
Memory: 8.4M (peak: 8.8M)
CPU: 68ms
CGroup: /system.slice/matterbridge.service
└─2264 /bin/matterbridge -conf /etc/matterbridge/matterbridge.toml
Dec 29 18:26:42 racknerd-28fca83 systemd[1]: Started matterbridge.service - Matterbridge daemon.
Dec 29 18:26:42 racknerd-28fca83 matterbridge[2264]: time="2024-12-29T18:26:42Z" level=info msg="Running version 1.26.0 6dafebc7" prefix=main
Dec 29 18:26:42 racknerd-28fca83 matterbridge[2264]: time="2024-12-29T18:26:42Z" level=info msg="Opening log file /var/log/matterbridge/matterbridge.log" prefix=config