Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
maksimryndin committed Mar 1, 2024
1 parent 61c6e72 commit 75c7299
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/site/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

- [Start](./start.md)
- [System requirements](./system-requirements.md)
- [Installation](./installation.md)
- [Setup](./setup.md)
- [Installation](./installation.md)
- [Services](./services.md)
- [General](./general.md)
- [Healthcheck](./healthcheck.md)
Expand Down
39 changes: 33 additions & 6 deletions .github/site/src/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@ You can install (or update) Goral with

```sh
curl --proto '=https' --tlsv1.2 -sSf https://maksimryndin.github.io/goral/install.sh | sh
sudo mv goral /usr/local/bin/goral
```

<details>
<summary>or by downloading a prebuilt binary from https://github.com/maksimryndin/goral/releases manually
<summary>or by downloading a prebuilt binary from <a href="https://github.com/maksimryndin/goral/releases" target="_blank">the releases page</a> manually
</summary>

```sh
wget https://github.com/maksimryndin/goral/releases/download/0.1.3/goral-0.1.3-x86_64-unknown-linux-gnu.tar.gz
tar -xzf goral-0.1.3-x86_64-unknown-linux-gnu.tar.gz
cd goral-0.1.3-x86_64-unknown-linux-gnu/
shasum -a 256 -c sha256_checksum.txt
sudo mv goral /usr/local/bin/goral
```
</details>

Expand All @@ -41,11 +39,40 @@ where an example `config.toml` is
```toml
[general]
service_account_credentials_path = "/etc/goral_service_account.json"
messenger.url = "https://discord.com/api/webhooks/123/zzz"
messenger.specific.chat_id = "-000000000000"
messenger.url = "https://api.telegram.org/bot12345678:XXXXXxxxxx-XXXddxxss-XXX/sendMessage"

[healthcheck]
spreadsheet_id = "<spreadsheet_id_1>"
messenger.specific.chat_id = "-111111111111"
messenger.url = "https://api.telegram.org/bot12345678:XXXXXxxxxx-XXXddxxss-XXX/sendMessage"
autotruncate_at_usage_percent = 90
[[healthcheck.liveness]]
name = "backend"
type = "Http"
endpoint = "http://127.0.0.1:8080"

[logs]
spreadsheet_id = "<spreadsheet_id_2>"
messenger.url = "https://discord.com/api/webhooks/123456789/xxxxx-XXXXX"
autotruncate_at_usage_percent = 90

[metrics]
spreadsheet_id = "<spreadsheet_id_3>"
messenger.specific.token = "xoxb-123-456-XXXXXX"
messenger.specific.channel = "XXXXXXXX"
messenger.url = "https://slack.com/api/chat.postMessage"
autotruncate_at_usage_percent = 90
[[target]]
endpoint = "http://127.0.0.1:8080/metrics"
name = "backend"

[system]
spreadsheet_id = "123XYZ"
messenger.url = "https://discord.com/api/webhooks/123/zzz"
spreadsheet_id = "<spreadsheet_id_4>"
messenger.url = "https://discord.com/api/webhooks/101010101/xxxxx-XXXXX"
autotruncate_at_usage_percent = 90
mounts = ["/", "/var"]
names = ["goral", "mybackend"]
```

See also [Services](./services.md) and [Recommended deployment](./recommended-deployment.md).
12 changes: 9 additions & 3 deletions .github/site/src/recommended-deployment.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
# Recommended deployment

## Linux

Goral follows a fail-fast approach - if something violates assumptions (marked with `assert:`), the safest thing is to panic and restart. It doesn't behave like that for recoverable errors, of course. For example, if Goral cannot send a message via messenger, it will try to message via General service notifications and its logs. And will continue working and collecting data. If it cannot connect to Google API, it will retry first.

There is also a case of fatal errors (e.g. `MissingToken error` for Google API which usually means that system time has skewed). In that case only someone outside can help. And in case of such panics Goral first tries to notify you via a messenger configured for General service to let you know immediately.

So following Erlang's idea of [supervision trees](https://adoptingerlang.org/docs/development/supervision_trees/) we recommend to run Goral as a systemd service under Linux for automatic restarts in case of panics and other issues.

1. [Install](./installation.md) Goral
2. An example systemd configuration (can be created with `sudo systemctl edit --force --full goral.service`):
2. Make it system-wide available as an executable
```sh
sudo mv goral /usr/local/bin/goral
```
3. An example systemd configuration (can be created with `sudo systemctl edit --force --full goral.service`):
```
[Unit]
Description=Goral observability daemon
Expand All @@ -22,8 +28,8 @@ Restart=always
[Install]
WantedBy=multi-user.target
```
3. Create a service account file (e.g. at `/etc/goral_service_account.json`) and a config file `/etc/goral.toml`
4. Start the service `sudo systemctl start goral`
4. Create a service account file (e.g. at `/etc/goral_service_account.json`) and a config file `/etc/goral.toml`
5. Start the service `sudo systemctl start goral`

Then to check errors in Goral's log (if any error is reported via a messenger):

Expand Down
2 changes: 1 addition & 1 deletion .github/site/src/start.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
![Goral](images/goral.png)
*generated with [Imagine](https://www.imagine.art/?ref=zwrlmtc)*
*generated with [Imagine.art](https://www.imagine.art/?ref=zwrlmtc)*
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
Observability toolkit for small projects. Easy-to-use and compatible with industry standards.

```sh
curl --proto '=https' --tlsv1.2 -sSf https://maksimryndin.github.io/goral/install.sh | sh
```

Also check out [setup](https://maksimryndin.github.io/goral/setup.html) and [recommended deployment](https://maksimryndin.github.io/goral/recommended-deployment.html).

## Overview

Goral is a simple observability daemon developed with the following idea in mind: when you have your favorite application in its infantry, you usually don't need a full-blown observability toolkit (which requires much more setup, maintenance and resources) around as the amount of data is not so huge. It is especially true for pet projects when you just want to test an idea and deploy the app at some free-tier commodity VPS.
Expand Down
2 changes: 1 addition & 1 deletion src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ impl Configuration {
}
}
if !message.is_empty() {
write!(&mut message, " there is a risk to hit a storage quota for Google sheets, [docs](https://github.com/maksimryndin/goral#storage-quota)").expect("assert: can write to string");
write!(&mut message, " there is a risk to hit a storage quota for Google sheets, [docs](https://maksimryndin.github.io/goral/services.html#storage-quota)").expect("assert: can write to string");
Err(message)
} else {
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ impl AppendableLog {

if usage < limit {
if usage > 0.8 * limit && !self.truncate_warning_is_sent {
let message = format!("current spreadsheet usage `{usage:.2}%` for service `{}` is approaching a limit `{limit}%`, copy the data if needed otherwise it will be truncated", self.service);
let message = format!("current spreadsheet usage `{usage:.2}%` for service `{}` is approaching a limit `{limit}%`, the data will be truncated, copy it if needed or consider using a separate spreadsheet for this service", self.service);
tracing::warn!("{}", message);
if let Some(messenger) = self.messenger.as_ref() {
messenger.try_warn(message);
Expand Down

0 comments on commit 75c7299

Please sign in to comment.