Skip to content

Commit f122090

Browse files
[DPE-7323] Define MySQL roles page (#682)
1 parent 9e90c84 commit f122090

File tree

3 files changed

+66
-1
lines changed

3 files changed

+66
-1
lines changed

docs/explanation/architecture.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## HLD (High Level Design)
66

7-
The charm design leverages on the SNAP “[charmed-mysql](https://snapcraft.io/charmed-mysql)” which is deployed by Juju on the specified VM/MAAS/bare-metal machine based on Ubuntu Jammy/22.04. SNAP allows to run MySQL service(s) in a secure and isolated environment ([strict confinement](https://ubuntu.com/blog/demystifying-snap-confinement)). The installed SNAP:
7+
The charm design leverages on the SNAP “[charmed-mysql](https://snapcraft.io/charmed-mysql)” which is deployed by Juju on the specified VM/MAAS/bare-metal machine based on Ubuntu Jammy/22.04. SNAP allows to run MySQL service(s) in a secure and isolated environment ([strict confinement](https://snapcraft.io/blog/demystifying-snap-confinement)). The installed SNAP:
88

99
```
1010
> juju ssh mysql/0

docs/explanation/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Legacy charm <legacy-charm>
2121
:maxdepth: 2
2222
2323
Users <users>
24+
Roles <roles>
2425
Logs <logs/index>
2526
```
2627

docs/explanation/roles.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Roles
2+
3+
```{note}
4+
The following roles are available starting on revision 412
5+
```
6+
7+
There are several definitions of roles in Charmed MySQL:
8+
* Predefined instance-level roles
9+
* Predefined database-level roles
10+
11+
```{seealso}
12+
[](/explanation/users)
13+
```
14+
15+
## MySQL roles
16+
MySQL does not provide any built-in roles for users to get permissions from.
17+
18+
## Charmed MySQL instance-level roles
19+
20+
Charmed MySQL introduces the following instance-level predefined roles:
21+
22+
* `charmed_backup`: used for the `backups` user.
23+
* `charmed_stats`: used for the `monitoring` user.
24+
* `charmed_read`: used to provide data read permissions to all databases.
25+
* `charmed_dml`: used to provide data read / write permissions to all databases.
26+
* `charmed_ddl`: used to provide schema modification permissions to all databases.
27+
* `charmed_dba`: used to provide data, schema, and system configuration permissions to all databases.
28+
29+
Currently, `charmed_backup` cannot be requested through the relation as extra user roles.
30+
31+
```text
32+
mysql> SELECT host, user FROM mysql.user;
33+
+-----------+------------------+
34+
| host | user |
35+
+-----------+------------------+
36+
| ... | ... |
37+
| % | charmed_backup |
38+
| % | charmed_dba |
39+
| % | charmed_ddl |
40+
| % | charmed_dml |
41+
| % | charmed_read |
42+
| % | charmed_stats |
43+
| ... | ... |
44+
+-----------+------------------+
45+
```
46+
47+
Additionally, the role `charmed_router` is available to ease the integration with [Charmed MySQL Router](https://charmhub.io/mysql-router).
48+
This role contains all the necessary permissions for a MySQL Router relation user to operate.
49+
50+
## Charmed MySQL database-level roles
51+
52+
Charmed MySQL also introduces database level roles, with permissions tied to each database that's created.
53+
Example for a database named `test`:
54+
55+
```text
56+
mysql> SELECT host, user FROM mysql.user WHERE user LIKE '%_test';
57+
+-----------+------------------+
58+
| host | user |
59+
+-----------+------------------+
60+
| % | charmed_dba_test |
61+
+-----------+------------------+
62+
```
63+
64+
The `charmed_dba_<database>` role contains every data and schema related permission, scoped to the database it references.

0 commit comments

Comments
 (0)