Skip to content

Commit

Permalink
text based config v0.3.0
Browse files Browse the repository at this point in the history
* text based config

* return early in create endpoints when in config mode

* add example config

* rename get monitor key

* Create configuration.md

* Update README.md

* delete example-config.yaml

* Update configuration.md

* Update configuration.md

* Update configuration.md

* parameterise slug backfill cte

* v0.3.0

* relabel

* prevent config post when github managed
  • Loading branch information
goksan authored Jun 18, 2024
1 parent 18a05a9 commit ab9878f
Show file tree
Hide file tree
Showing 34 changed files with 13,624 additions and 14,285 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ docker compose up
### Binaries
amd64 and arm64 Linux binaries can be found on the [Releases](https://github.com/goksan/Statusnook/releases) page.

## Configuration
Statusnook has the following configuration options:
* Web UI based config
* Text based config (YAML) via the settings page, or on push via GitHub

[Learn more about configuration](docs/configuration.md)

## Gallery

![monitors](https://github.com/goksan/statusnook/assets/17437810/9bc9a023-41fc-4646-a353-0a1755ce148b)
Expand Down
4 changes: 2 additions & 2 deletions compile.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

CC=x86_64-linux-musl-gcc CXX=x86_64-linux-musl-g++ GOARCH=amd64 GOOS=linux CGO_ENABLED=1 go build -ldflags "-w -s -linkmode external -extldflags -static -X main.CA=https://acme-v02.api.letsencrypt.org/directory -X main.BUILD=release" -o bin/statusnook_linux_amd64_v0.2.0
CC=aarch64-linux-musl-gcc CXX=aarch64-linux-musl-g++ GOARCH=arm64 GOOS=linux CGO_ENABLED=1 go build -ldflags "-w -s -linkmode external -extldflags -static -X main.CA=https://acme-v02.api.letsencrypt.org/directory -X main.BUILD=release" -o bin/statusnook_linux_arm64_v0.2.0
CC=x86_64-linux-musl-gcc CXX=x86_64-linux-musl-g++ GOARCH=amd64 GOOS=linux CGO_ENABLED=1 go build -ldflags "-w -s -linkmode external -extldflags -static -X main.CA=https://acme-v02.api.letsencrypt.org/directory -X main.BUILD=release" -o bin/statusnook_linux_amd64_v0.3.0
CC=aarch64-linux-musl-gcc CXX=aarch64-linux-musl-g++ GOARCH=arm64 GOOS=linux CGO_ENABLED=1 go build -ldflags "-w -s -linkmode external -extldflags -static -X main.CA=https://acme-v02.api.letsencrypt.org/directory -X main.BUILD=release" -o bin/statusnook_linux_arm64_v0.3.0
144 changes: 144 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# Configuration

By default, you can configure your Statusnook instance through the standard web UI.

Through the settings page, you can opt for an exclusively text-based configuration. This disables elements of the standard interface and allows you to manage the configuration via text.

Additionally, you can set opt for updates to be managed solely through GitHub, enabling automatic synchronisation with your Statusnook instance on pushes to a chosen branch.


> [!CAUTION]
> Dropping or renaming keys is a destructive action (mail groups, notification channels, monitors, services)
>
>[See "Renaming A Resource Key"](#renaming-a-resource-key)
## Example config.yaml

```yaml
general-settings:
name: Statusnook
mail-groups:
core:
name: Core
members:
- [email protected]
- [email protected]
engineers:
name: Engineers
description: All engineers in our organisation
members:
- [email protected]
notification-channels:
azure:
from: [email protected]
host: smtp.azurecomm.net
name: Azure
password: secret_Qg6RqkWLe1m4a6TzK+grCcgRIQsiFEc95nJXMsLBZIZSyA==.tOw0xDcUdmmr62tJ
port: 587
type: smtp
username: example
postmark:
from: [email protected]
host: smtp.postmarkapp.com
misc:
pm-broadcast: broadcast
pm-transactional: outbound
name: Postmark
password: secret_hyNDZ3rL5ee7eco6DCoGnKcVsksZFY4MMb3b4JsCwbGh3A==.YwiY1DgH0ExUsDmJ
port: 587
type: smtp
username: secret_hyNDZ3rL5ee7eco6DCoGnKcVsksZFY4MMb3b4JsCwbGh3A==.YwiY1DgH0ExUsDmJ
ses:
from: [email protected]
host: email-smtp.eu-north-1.amazonaws.com
name: SES
password: secret_ZYjE7eePnHBlQph6pK0e30yeVpovb37h/VvcJbPw96fbHg==./1e5EXv1iUF8Y6XY
port: 587
type: smtp
username: example
slack-internal-alerts:
name: "Slack #internal-alerts"
type: slack
webhook-url: secret_4//EgNno+/nZwEiO44TQ4k/9FNLbh2zNJc8hJqWIwTIc0Q==.eoLscWK0jMFRkgWa
monitors:
get:
name: Example
url: https://example.com
method: GET
frequency: 10
timeout: 5
attempts: 1
notification-channels:
- azure
- postmark
post-form:
name: Post form example
url: https://example.com
method: POST
frequency: 10
timeout: 5
attempts: 1
headers:
Content-Type: application/x-www-form-urlencoded
body:
example-name: example-value
notification-channels:
- ses
mail-groups:
- engineers
- core
post-json:
name: Post json example
url: https://example.com
method: POST
frequency: 10
timeout: 5
attempts: 1
headers:
Content-Type: application/json
body: '{"key1": "value1", "key2": "value2"}'
notification-channels:
- azure
mail-groups:
- core
services:
website:
name: Website
description: example.com
api:
name: API
description: api.example.com
alert-notification-settings:
email-notification-channel: postmark
managed-subscriptions: true
slack-client-secret: secret_tdBs7fxa31U+Nc31MUWBVea5pdT6ycHUsCOXfw==.M/qsy+BDnJoMALin
slack-install-url: https://slack.com/oauth/v2/authorize?...
```
## Renaming a Resource Key
Below is an example demonstrating how to change the `engineers` mail group key to `engineering-team`

```yaml
rename:
mail-groups.engineers: engineering-team
mail-groups:
engineering-team:
name: Engineers
description: All engineers in our organisation
members:
- [email protected]
# The rest of the config is omitted for demonstration purposes. Retain the rest of your config!
```

In addition to adding the rename section, update all references to `engineers` with `engineering-team` and apply this configuration to execute the rename.

After completing the rename, remove the `rename` section or at least the outdated part from your configuration, and reapply the configuration to ensure that future changes are applied successfully.

## Secrets
Secrets can be encrypted and decrypted via the settings page.

<img src="https://github.com/goksan/statusnook/assets/17437810/78753b51-534a-4116-b5a7-6ba4dd05c7f7" width="800">
<br><br>

When Statusnook is applying a configuration it attempts to decrypt and replace any value prefixed with `secret_`.

3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/goksan/statusnook

go 1.21
go 1.22

require (
github.com/caddyserver/certmagic v0.20.0
Expand All @@ -10,6 +10,7 @@ require (
github.com/miekg/dns v1.1.55
golang.org/x/crypto v0.18.0
golang.org/x/mod v0.11.0
gopkg.in/yaml.v3 v3.0.1
)

require (
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,7 @@ golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/tools v0.10.0 h1:tvDr/iQoUqNdohiYm0LmmKcBk+q86lb9EprIUFhHHGg=
golang.org/x/tools v0.10.0/go.mod h1:UJwyiVBsOA2uwvK/e5OY3GTpDUJriEd+/YlqAwLPmyM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Loading

0 comments on commit ab9878f

Please sign in to comment.