Skip to content

Commit 8e28b88

Browse files
committed
add documentation
1 parent dff22d0 commit 8e28b88

File tree

8 files changed

+78
-26
lines changed

8 files changed

+78
-26
lines changed

docs/configuration/auth.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Auth settings
3-
Description: auth, tls, frontend_tls, etc.
3+
description: auth, tls, frontend_tls, etc.
44
---
55

66
## General Settings

docs/configuration/coordinator.mdx

+14-12
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,18 @@ Refer to the [pkg/config/coordinator.go](https://github.com/pg-sharding/spqr/blo
1212

1313
## Coordinator Settings
1414

15-
| Setting | Description | Possible Values |
16-
|--------------------------|---------------------------------------------------------------|-----------------------|
17-
| `log_level` | The level of logging output. | `debug`, `info`, `warning`, `error`, `fatal`|
18-
| `pretty_logging` | Whether to write logs in an colorized, human-friendly format. | `true`, `false` |
19-
| `qdb_addr` | the address of the QDB server | Any valid address |
20-
| `host` | The host address the coordinator listens on. | Any valid hostname |
21-
| `coordinator_port` | The port number for the coordinator. | Any valid port number |
22-
| `grpc_api_port` | The port number for the gRPC API. | Any valid port number |
23-
| `auth` | See [auth.mdx](./auth) | Object of `AuthCfg` |
24-
| `frontend_tls` | See [auth.mdx](./auth) | Object of `TLSConfig` |
25-
| `use_systemd_notifier` | Whether to use systemd notifier. | `true`, `false` |
26-
| `systemd_notifier_debug` | Whether to run systemd notifier in debug mode. | `true`, `false` |
15+
| Setting | Description | Possible Values |
16+
|--------------------------|--------------------------------------------------------------------|-----------------------|
17+
| `log_level` | The level of logging output. | `debug`, `info`, `warning`, `error`, `fatal`|
18+
| `pretty_logging` | Whether to write logs in an colorized, human-friendly format. | `true`, `false` |
19+
| `qdb_addr` | the address of the QDB server | Any valid address |
20+
| `host` | The host address the coordinator listens on. | Any valid hostname |
21+
| `coordinator_port` | The port number for the coordinator. | Any valid port number |
22+
| `grpc_api_port` | The port number for the gRPC API. | Any valid port number |
23+
| `auth` | See [auth.mdx](./auth) | Object of `AuthCfg` |
24+
| `frontend_tls` | See [auth.mdx](./auth) | Object of `TLSConfig` |
25+
| `use_systemd_notifier` | Whether to use systemd notifier. | `true`, `false` |
26+
| `systemd_notifier_debug` | Whether to run systemd notifier in debug mode. | `true`, `false` |
27+
| `enable_role_system` | Whether to enable the [role-based access control system](./roles). | `true`, `false` |
28+
| `roles_file` | The file path to the [roles](./roles) configuration. | Any valid file path |
2729

docs/configuration/roles.mdx

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
title: Roles settings
3+
description: Specify readers, writes, admins
4+
---
5+
6+
## Roles
7+
8+
Roles represents a collection of table groups. It is used to define and manage groups of tables in the configuration. The structure supports JSON, TOML, and YAML serialization formats.
9+
10+
By default, the role system is disabled. To enable it, you have to specify `enable_role_system: true` and `roles_file` settings in both your [router's](./router) and [coordinator's](./coordinator) config.
11+
12+
Refer to the [pkg/config/roles.go](https://github.com/pg-sharding/spqr/blob/master/pkg/config/roles.go) file for the most up-to-date configuration options.
13+
14+
## Table Group
15+
16+
TableGroup represents a group of tables with associated roles and permissions.
17+
18+
| Setting | Description | Possible Values |
19+
|----------|-------------------------------------------------------|-----------------------|
20+
| `id` | Unique identifier for the table group. | Any string value |
21+
| `readers`| List of users with read access to the table group. | Array of string values|
22+
| `writers`| List of users with write access to the table group. | Array of string values|
23+
| `admins` | List of users with admin access to the table group. | Array of string values|
24+
25+
## Example
26+
27+
For example, let's assume we have the following roles configuration:
28+
29+
```yaml
30+
table_groups:
31+
- id: "example_table_group"
32+
readers:
33+
- "user1"
34+
- "user2"
35+
- "user3"
36+
writers:
37+
- "prod_user"
38+
admins:
39+
- "admin_user"
40+
```
41+
42+
When we try to connect to (any) database as user user1 and run a modify query, we get something like this:
43+
44+
```sql
45+
CREATE KEY RANGE krid2 FROM 11 ROUTE TO sh2 FOR DISTRIBUTION ds1;
46+
ERROR: permission denied for user=user1 dbname=prod
47+
```

docs/configuration/router.mdx

+11-9
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,17 @@ Refer to the [pkg/config/router.go](https://github.com/pg-sharding/spqr/blob/mas
1212

1313
## General Settings
1414

15-
| Setting | Description | Possible Values |
16-
|--------------------------|---------------------------------------------------------------|-------------------------|
17-
| `log_level` | The level of logging output. | `debug`, `info`, `warning`, `error`, `fatal`|
18-
| `pretty_logging` | Whether to write logs in an colorized, human-friendly format. | `true`, `false` |
19-
| `daemonize` | Whether to run the router as a daemon. | `true`, `false` |
20-
| `reuse_port` | Whether to create a socket with SO_REUSEPORT and SO_REUSEADDR options | `true`, `false` |
21-
| `use_systemd_notifier` | Whether to use systemd notifier. | `true`, `false` |
22-
| `systemd_notifier_debug` | Whether to run systemd notifier in debug mode. | `true`, `false` |
23-
| `with_coordinator` | Whether to run the router in a special coordinator mode. | `true`, `false` |
15+
| Setting | Description | Possible Values |
16+
|--------------------------|--------------------------------------------------------------------|---------------------|
17+
| `log_level` | The level of logging output. | `debug`, `info`, `warning`, `error`, `fatal`|
18+
| `pretty_logging` | Whether to write logs in an colorized, human-friendly format. | `true`, `false` |
19+
| `daemonize` | Whether to run the router as a daemon. | `true`, `false` |
20+
| `reuse_port` | Whether to create a socket with SO_REUSEPORT and SO_REUSEADDR options. | `true`, `false` |
21+
| `use_systemd_notifier` | Whether to use systemd notifier. | `true`, `false` |
22+
| `systemd_notifier_debug` | Whether to run systemd notifier in debug mode. | `true`, `false` |
23+
| `with_coordinator` | Whether to run the router in a special coordinator mode. | `true`, `false` |
24+
| `enable_role_system` | Whether to enable the [role-based access control system](./roles). | `true`, `false` |
25+
| `roles_file` | The file path to the [roles](./roles) configuration. | Any valid file path |
2426

2527
## Network Settings
2628

docs/mint.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@
8080
"configuration/router",
8181
"configuration/coordinator",
8282
"configuration/balancer",
83-
"configuration/auth"
83+
"configuration/auth",
84+
"configuration/roles"
8485
]
8586
},
8687
{

docs/sharding/console/concepts.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: 'Concepts'
3-
Description: 'Some SPQR Admin Console terms'
3+
description: 'Some SPQR Admin Console terms'
44
---
55

66

docs/sharding/console/how_to_connect.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: 'How to connect'
3-
Description: 'SPQR router and coordinator admin console'
3+
description: 'SPQR router and coordinator admin console'
44
---
55

66
import ConsoleExample from '/snippets/console_example.mdx';

docs/sharding/console/sql_commands.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: 'SQL commands'
3-
Description: 'Create distributions, key ranges and tables and see cluster info'
3+
description: 'Create distributions, key ranges and tables and see cluster info'
44
---
55

66
### CREATE DISTRIBUTION

0 commit comments

Comments
 (0)