This is a rewrite of the version 1 recent-messages service.
See https://recent-messages.robotty.de/ for all kinds of information you might want.
- Install Rust
- On Debian and Ubuntu:
sudo apt install build-essential libssl-dev pkg-config, for other operating systems I recommend you just try to proceed with step three and then try to fix the missing compiler programs/system libraries as they pop up git clone https://github.com/robotty/recent-messages2.git && cd recent-messages2cargo build --release- The binary application will be ready in
./target/release/recent-messages2(On Windows with the additional.exesuffix). The binary is statically linked and so can be moved to other directories or sent to remote machines without need for additional files.
This service uses a PostgreSQL database server for persistence.
Your Postgres server requires the TimescaleDB extension, at least version 2.19.3. Follow the installation instructions here.. The TimescaleDB packages from Debian/Ubuntu cannot be used, since they install the Apache-2.0 license edition of TimescaleDB, while we require the "community edition".
After you have completed the TimescaleDB setup steps, restart PostgreSQL:
sudo systemctl restart postgresqlI recommend you set up a system user like this:
sudo adduser --system --home /opt/recent-messages \
--shell /bin/false --no-create-home --group \
--disabled-password --disabled-login \
recent_messagesThen, create the database, and a user under the same name as the system user (the system user will be able to use the database user automatically without passwords or further configuration when connecting via unix domain sockets):
sudo -u postgres psql
#> ALTER SYSTEM SET timescaledb.telemetry_level = 'off';
#> SELECT pg_reload_conf();
#> CREATE USER recent_messages;
#> CREATE DATABASE recent_messages OWNER recent_messages;
#> \c recent_messages
#> CREATE EXTENSION IF NOT EXISTS timescaledb;
#> \qThe config.toml is expected to be in the working directory of the process. Edit it to your use case before first startup:
editor config.tomlThe binary can be run with any process manager in the background (systemd etc.), or you can dockerize it. For testing purposes, you can use cargo run --release.
A sample file for running it as a systemd unit is provided as recent-messages2.service.
cp ./recent-messages2.service /etc/systemd/system/recent-messages2.serviceNow edit the service file to reflect your setup:
sudo editor /etc/systemd/system/recent-messages2.serviceAnd start the service.
sudo systemctl daemon-reload
sudo systemctl enable --now recent-messages2.serviceView log output/service status:
sudo journalctl -efu recent-messages2.service
sudo systemctl status recent-messages2.serviceInstructions for setting up the static website (like the "official" https://recent-messages.robotty.de/) are found in the README in the ./web directory of this repo.
There you can also find an example nginx config.
A prometheus metrics endpoint is exposed at /api/v2/metrics. You can import the grafana-dashboard.json in the repository as a dashboard template into a Grafana instance.