From f685ed25b6608f86380c4bfd86886dda07c02e68 Mon Sep 17 00:00:00 2001 From: "midas@devnull" Date: Sun, 15 Jun 2025 18:29:51 +0200 Subject: [PATCH] deploy and run fixes --- simplexalerts/index.md | 43 +++++++++--------------------------------- 1 file changed, 9 insertions(+), 34 deletions(-) diff --git a/simplexalerts/index.md b/simplexalerts/index.md index 81ed766..dd4e623 100644 --- a/simplexalerts/index.md +++ b/simplexalerts/index.md @@ -230,7 +230,7 @@ The release page can be accessed through your web browser or you can download th Run your client in server mode: - [user@devnode:~]$ simplex-chat -d clientDB -p 1337 -x + [user@devnode:~]$ simplex-chat -d chatDB No user profiles found, it will be created now. Please choose your display name. It will be sent to your contacts when you connect. @@ -242,8 +242,8 @@ Run your client in server mode: This command will: - create two databases that your client uses for reconnecting to groups and interacting with the simpleX Network - set this client display name (what you will see in your groups when receiving alerts) -- open a websocket port that the alerter will use on 127.0.0.1:1337 +Ctrl-C once it is finished. ## Grafana-Simplex-alerter @@ -285,7 +285,7 @@ You will then be able to run simplex-alerter: [user@devnode:~]$ simplex-alerter --help - usage: simplex-alerter [-h] [-a ADDR] [-m PROMETHEUS_CONFIG] [-o OTEL_SERVER] [-f PYROSCOPE_SERVER] [-b BIND_ADDR] [-d] [-c CONFIG] [-g] [-e ENDPOINT] + usage: simplex-alerter [-h] [-a ADDR] [-m PROMETHEUS_CONFIG] [-o OTEL_SERVER] [-f PYROSCOPE_SERVER] [-b BIND_ADDR] [-d] [-c CONFIG] [-e ENDPOINT] options: -h, --help show this help message and exit @@ -297,21 +297,15 @@ You will then be able to run simplex-alerter: host:port to run the app on -d, --debug enable debug mode, increases pyroscope sampling rate if configured -c, --config CONFIG config file - -g, --generate-config - generate config file with placeholder values -e, --endpoint ENDPOINT simplex endpoint #### With Docker - - [user@devnode:~]$ git clone https://github.com/MulliganSecurity/grafana-simplex-alerter.git - cd grafana-simplex-alerter - docker build . -t simplex-alerter +To build using docker please use the instructions in the repository README.md -For the rest of the tutorial I will show the docker commands. If you installed the alerter using nix, simply replace "docker run simplex-alerter" with simplex-alerter. Do take note of the following: - In docker run the "--rm" parameter will be used to automatically destroy the container after it's run. If using from nix you can disregard it. @@ -339,10 +333,10 @@ I will now need to create an invite link so the alert can send messages there: #### Generate a basic config file -To get started we need a basic config file to fill out with our alerter information: +To get started we need a basic config file: please use the template provided (example_config.yml) in the repository - [user@devnode:~]$ docker run --rm simplex-alerter -g > config.yml + [user@devnode:~]$ cp example_config.yml config.yml [user@devnode:~]$ cat config.yml alert_groups: - invite_link: https://simplex.chat/contact#/?v=2-7&sm... @@ -352,12 +346,9 @@ To get started we need a basic config file to fill out with our alerter informat ##### Configure the alerter -Update your config file with the invite link you created earler and set the name to your group name +Update your config file with the invite link you created earlier and set the name to your group name [user@devnode:~]$ vi config.yml - -so it looks like this: - [user@devnode:~]$ cat config.yml alert_groups: - invite_link: https://simplex.chat/contact#/?v=2-7&smp=smp%3A%2F%2FUkMFNAXLXeAAe0beCa4w6X_zp18PwxSaSjY17BKUGXQ%3D%40smp12.simplex.im%2FlOgzQT8ZxfF3TV_x00c0mNLMFBDkl6gj%23%2F%3Fv%3D1-4%26dh%3DMCowBQYDK2VuAyEAypkpAgfmsShNThQBGvPXxjBk8O03vKe1x0311UHhK3I%253D%26q%3Dc%26srv%3Die42b5weq7zdkghocs3mgxdjeuycheeqqmksntj57rmejagmg4eor5yd.onion&data=%7B%22groupLinkId%22%3A%22EfuyLGxGhsc0iWkqr9NYvQ%3D%3D%22%7D @@ -367,7 +358,7 @@ so it looks like this: Run the container - sudo docker run -v $(pwd):/config --network="host" --rm simplex-alerter -c /config/config.yml -e 127.0.0.1:1337 + sudo docker run -v $(pwd):/simplex -v $(pwd):/alerterconfig -p 127.0.0.1:7898:7898 --rm simplex-alerter It will connect to the simplex-chat client we started earlier. You can check the metrics to make sure it's running by checking the metrics page @@ -501,20 +492,6 @@ And here's the alert: To turn the simplex-chat and the alerter into systemd services, you only need to create two files: -## /etc/systemd/system/simplex-chat.service -```text - vim /etc/systemd/system/simplex-chat.service - cat /etc/systemd/system/simplex-chat.service -``` - - [Unit] - Requires=tor.service - - [Service] - ExecStart=simplex-chat -d /etc/alerter_clientDB -p 1337 -x - [Install] - WantedBy=multi-user.target - ## /etc/systemd/system/alerter.service ```text @@ -524,10 +501,9 @@ cat /etc/systemd/system/xxx [Unit] - Requires=simplex-chat.service [Service] - ExecStart=docker run --rm simplex-alerter -c /etc/alerter-config.yaml -e 127.0.0.1:1337 + ExecStart=docker run -p 127.0.0.1:7898:7898 -v /my/alerter/data:/alerterconfig -v /my/alerter/data:/simplex --rm simplex-alerter [Install] WantedBy=simplex-chat.service @@ -536,7 +512,6 @@ cat /etc/systemd/system/xxx Now enable the services sudo systemctl daemon-reload - sudo systemctl enable --now simplex-chat.service sudo systemctl enable --now alerter.service # Conclusion