Skip to content

Commit 3cabe98

Browse files
authored
Merge pull request #50 from GabrielSalla/improve-configs-docs
Improve configs docs
2 parents 20c9132 + 4ecf12c commit 3cabe98

File tree

3 files changed

+70
-22
lines changed

3 files changed

+70
-22
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ State machine-related issues often require several data checks and conditional l
6969
1. [Sample Monitor](./docs/sample_monitor.md)
7070
3. [Querying data from databases](./docs/querying.md)
7171
4. [Registering a monitor](./docs/monitor_registering.md)
72-
5. [How to run](./docs/how_to_run.md)
72+
5. Deployment
73+
1. [Configuration](./docs/configuration.md)
74+
2. [How to run](./docs/how_to_run.md)
7375
6. [Monitoring Sentinela](./docs/monitoring_sentinela.md)
7476
7. [Plugins](./docs/plugins.md)
7577
1. [Slack](./docs/plugin_slack.md)

docs/configuration.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Configuration
2+
The basic configs are set through the `configs.yaml` file. This file is read when the application starts and all the settings will be loaded.
3+
4+
THe monitors path is also defined in the `configs.yaml` file. By default, it's set to the `sample_monitors` folder, but it can be changed to another folder if desired. The `configs.yaml` file also have other configurations that can be adjusted.
5+
6+
> [!IMPORTANT]
7+
> Check the documentation for the plugins that are being used to see if they have environment variables of their own.
8+
9+
# Environment variables
10+
## `CONFIGS_FILE`
11+
The application will try to load the configs file through the path defined in the `CONFIGS_FILE` environment variable. If this variable is not defined, it'll look for the file in the root directory of the application.
12+
13+
Example:
14+
```
15+
CONFIGS_FILE=configs.yaml
16+
```
17+
18+
## `SENTINELA_PLUGINS`
19+
To enable a plugin, set the environment variable `SENTINELA_PLUGINS` with the name of the desired plugin. When enabling multiple plugins, separate them with commas.
20+
- To enable the Slack plugin, the environment variable should be set as `SENTINELA_PLUGINS=slack`.
21+
- To enable multiple plugins, the environment variable should be set as `SENTINELA_PLUGINS=plugin_1,plugin_2`.
22+
23+
## `DATABASE_APPLICATION`
24+
Specifies the database DSN that will be used to connect to the application database. This database will not be accessible through the databases interface for the monitors.
25+
26+
Example:
27+
```
28+
DATABASE_APPLICATION=postgresql+asyncpg://postgres:postgres@postgres:5432/postgres
29+
```
30+
31+
## `DATABASE_{NAME}`
32+
Every variable that starts with `DATABASE`, besides the application database, will have a connection pool instantiated, that can be used in the monitors to query data from them. The variable must contain the DSN to be used to connect to the database.
33+
34+
For an environment variable `DATABASE_ABC`, the connection pool will be available with the name `abc`, that will be able to be used in the `query` function.
35+
36+
Example:
37+
```
38+
DATABASE_ABC=postgres://postgres:postgres@postgres:5432/postgres
39+
```
40+
41+
## `AWS_ENDPOINT_URL`
42+
`AWS_ENDPOINT_URL` specifies the AWS endpoint to be used for local testing, without the need of a real SQS queue. When using the `motoserver` container as an AWS mock, it should be `http://motoserver:5000`. Don't set this environment variable when using a real SQS queue.
43+
44+
Example:
45+
```
46+
AWS_ENDPOINT_URL=http://motoserver:5000
47+
```
48+
49+
## `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` and `AWS_SESSION_TOKEN`
50+
`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` and `AWS_SESSION_TOKEN` specifies the service credentials to access the AWS SQS queue.
51+
52+
If the credentials does not include the session token, the `AWS_SESSION_TOKEN` environment variable should not be set.
53+
54+
Example:
55+
```
56+
AWS_ACCESS_KEY_ID=ACCESSKEYID
57+
AWS_SECRET_ACCESS_KEY=SECRETACCESSKEY
58+
AWS_SESSION=SESSIONTOKEN
59+
```
60+
61+
or, when not using a session token,
62+
63+
```
64+
AWS_ACCESS_KEY_ID=ACCESSKEYID
65+
AWS_SECRET_ACCESS_KEY=SECRETACCESSKEY
66+
```

docs/how_to_run.md

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,4 @@
1-
# Deployment
2-
## Configs and secrets
3-
The basic configs are set through the `configs.yaml` file. This file is read when the application starts and all the settings will be loaded.
4-
5-
The application will try to load the configs file through the path defined in the `CONFIGS_FILE` environment variable. If this variable is not defined, it'll look for the file in the root directory of the application.
6-
7-
THe monitors path is also defined in the `configs.yaml` file. By default, it's set to the `sample_monitors` folder, but it can be changed to another folder if desired. The `configs.yaml` file also have other configurations that can be adjusted.
8-
9-
To enable a plugin, set the environment variable `SENTINELA_PLUGINS` with the name of the desired plugin. When enabling multiple plugins, separate them with commas.
10-
- To enable the Slack plugin, the environment variable should be set as `SENTINELA_PLUGINS=slack`.
11-
- To enable multiple plugins, the environment variable should be set as `SENTINELA_PLUGINS=plugin_1,plugin_2`.
12-
13-
For the secrets, the application expects them to be set as environment variables.
14-
- `DATABASE_APPLICATION`: The database DSN that will be used to connect to the application database. This database will not be accessible through the databases interface for the monitors.
15-
- Every variable that starts with `DATABASE`, besides the application database, will have a connection pool instantiated, that can be used in the monitors to query data from them.
16-
- `AWS_ENDPOINT_URL`: The AWS endpoint to be used for local testing, without the need of a real SQS queue. When using the `motoserver` container as an AWS mock, it should be `http://motoserver:5000`. Don't set this environment variable when using a real SQS queue.
17-
- `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` and `AWS_SESSION_TOKEN`: The service credentials to access the AWS SQS queue.
18-
19-
> [!IMPORTANT]
20-
> Check the documentation for the plugins that are being used to see if they have environment variables of their own.
21-
1+
# How to run
222
## Development execution
233
Development execution should be used when developing or testing the platform features. It's not intended to be used to develop monitors as it might set variables that might interfere with the monitors execution.
244

0 commit comments

Comments
 (0)