Skip to content

Commit 385dc6d

Browse files
committed
feat: updated README.md
1 parent 5bdd532 commit 385dc6d

File tree

1 file changed

+166
-60
lines changed

1 file changed

+166
-60
lines changed

README.md

Lines changed: 166 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,116 +1,214 @@
11
# ns8-chiefonboarding
22

3-
This is a template module for [NethServer 8](https://github.com/NethServer/ns8-core).
4-
To start a new module from it:
3+
A [NethServer 8](https://github.com/NethServer/ns8-core) module for ChiefOnboarding - employee onboarding and management platform.
54

5+
## Table of Contents
6+
7+
- [Install](#install)
8+
- [Configure](#configure)
9+
- [Get Configuration](#get-the-configuration)
10+
- [Uninstall](#uninstall)
11+
- [Update](#update)
12+
- [Smarthost Setting Discovery](#smarthost-setting-discovery)
13+
- [Debug](#debug)
14+
- [Testing](#testing)
15+
- [UI Translation](#ui-translation)
16+
17+
---
618

719
## Install
820

921
Instantiate the module with:
1022

11-
add-module ghcr.io/geniusdynamics/chiefonboarding:latest 1
23+
```bash
24+
add-module ghcr.io/geniusdynamics/chiefonboarding:latest 1
25+
```
1226

1327
The output of the command will return the instance name.
14-
Output example:
1528

16-
{"module_id": "chiefonboarding1", "image_name": "chiefonboarding", "image_url": "ghcr.io/geniusdynamics/chiefonboarding:latest"}
29+
**Output example:**
30+
31+
```json
32+
{"module_id": "chiefonboarding1", "image_name": "chiefonboarding", "image_url": "ghcr.io/geniusdynamics/chiefonboarding:latest"}
33+
```
34+
35+
---
1736

1837
## Configure
1938

20-
Let's assume that the mattermost instance is named `chiefonboarding1`.
39+
Launch `configure-module` by setting the required and optional parameters.
2140

22-
Launch `configure-module`, by setting the following parameters:
23-
- `host`: a fully qualified domain name for the application
24-
- `http2https`: enable or disable HTTP to HTTPS redirection (true/false)
25-
- `lets_encrypt`: enable or disable Let's Encrypt certificate (true/false)
41+
Assume the instance is named `chiefonboarding1`.
2642

43+
### Core Parameters
2744

28-
Example:
45+
| Parameter | Type | Required | Description |
46+
|-----------|------|----------|-------------|
47+
| `host` | string | Yes | Fully qualified domain name for the application |
48+
| `http2https` | boolean | Yes | Enable HTTP to HTTPS redirection (`true`/`false`) |
49+
| `lets_encrypt` | boolean | Yes | Enable Let's Encrypt certificate (`true`/`false`) |
2950

30-
```
51+
### Email Settings
52+
53+
Email configuration is automatically discovered from the system smarthost settings. The following SMTP settings are configured automatically:
54+
55+
- SMTP host, port, username, and password
56+
- SMTP encryption method (TLS/SSL)
57+
- TLS verification settings
58+
59+
### Google SSO (Optional)
60+
61+
| Parameter | Type | Default | Description |
62+
|-----------|------|---------|-------------|
63+
| `allow_google_sso` | boolean | `false` | Enable Google SSO authentication |
64+
| `google_sso_client_id` | string | `""` | Google OAuth client ID |
65+
| `google_sso_secret` | string | `""` | Google OAuth client secret |
66+
67+
### SSO Auto-Creation (Optional)
68+
69+
| Parameter | Type | Default | Description |
70+
|-----------|------|---------|-------------|
71+
| `sso_auto_create_user` | boolean | `true` | Automatically create users from SSO authentication |
72+
73+
### OIDC Role Patterns (Optional)
74+
75+
Configure role mapping patterns for OpenID Connect authentication:
76+
77+
| Parameter | Type | Default | Description |
78+
|-----------|------|---------|-------------|
79+
| `oidc_role_new_hire_pattern` | string | `""` | Regex pattern to match new hire roles |
80+
| `oidc_role_admin_pattern` | string | `""` | Regex pattern to match admin roles |
81+
| `oidc_role_manager_pattern` | string | `""` | Regex pattern to match manager roles |
82+
| `oidc_role_path_in_return` | string | `"groups"` | JSON path in OIDC response for roles |
83+
84+
### Authentication Providers (Optional)
85+
86+
| Parameter | Type | Default | Description |
87+
|-----------|------|---------|-------------|
88+
| `socialaccount_providers` | object | `{}` | JSON object defining social authentication providers |
89+
| `allauth_providers` | string | `""` | JSON configuration for additional authentication providers |
90+
91+
### Example Configuration
92+
93+
```bash
3194
api-cli run configure-module --agent module/chiefonboarding1 --data - <<EOF
3295
{
3396
"host": "chiefonboarding.domain.com",
3497
"http2https": true,
35-
"lets_encrypt": false
98+
"lets_encrypt": false,
99+
"allow_google_sso": true,
100+
"google_sso_client_id": "your-client-id",
101+
"google_sso_secret": "your-client-secret",
102+
"sso_auto_create_user": true,
103+
"oidc_role_new_hire_pattern": ".*new_hire.*",
104+
"oidc_role_admin_pattern": ".*admin.*",
105+
"oidc_role_manager_pattern": ".*manager.*",
106+
"oidc_role_path_in_return": "groups",
107+
"socialaccount_providers": {},
108+
"allauth_providers": ""
36109
}
37110
EOF
38111
```
39112

40-
The above command will:
41-
- start and configure the chiefonboarding instance
42-
- configure a virtual host for trafik to access the instance
113+
**The above command will:**
43114

44-
## Get the configuration
45-
You can retrieve the configuration with
115+
- Configure the chiefonboarding instance
116+
- Configure a virtual host for traefik to access the instance
46117

47-
```
118+
---
119+
120+
## Get the Configuration
121+
122+
Retrieve the configuration with:
123+
124+
```bash
48125
api-cli run get-configuration --agent module/chiefonboarding1
49126
```
50127

128+
---
129+
51130
## Uninstall
52131

53132
To uninstall the instance:
54133

55-
remove-module --no-preserve chiefonboarding1
134+
```bash
135+
remove-module --no-preserve chiefonboarding1
136+
```
137+
138+
---
56139

57140
## Update
58141

59-
To Update the instance:
142+
To update the instance:
143+
144+
```bash
145+
api-cli run update-module --data '{"module_url":"ghcr.io/geniusdynamics/chiefonboarding:latest","instances":["chiefonboarding1"],"force":true}'
146+
```
60147

61-
api-cli run update-module --data '{"module_url":"ghcr.io/geniusdynamics/chiefonboarding:latest","instances":["chiefonboarding1"],"force":true}'
148+
---
62149

63-
## Smarthost setting discovery
150+
## Smarthost Setting Discovery
64151

65-
Some configuration settings, like the smarthost setup, are not part of the
66-
`configure-module` action input: they are discovered by looking at some
67-
Redis keys. To ensure the module is always up-to-date with the
68-
centralized [smarthost
69-
setup](https://geniusdynamics.github.io/ns8-core/core/smarthost/) every time
70-
chiefonboarding starts, the command `bin/discover-smarthost` runs and refreshes
71-
the `state/smarthost.env` file with fresh values from Redis.
152+
Some configuration settings, like the smarthost setup, are not part of the `configure-module` action input: they are discovered by looking at some Redis keys. To ensure the module is always up-to-date with the centralized [smarthost setup](https://geniusdynamics.github.io/ns8-core/core/smarthost/) every time chiefonboarding starts, the command `bin/discover-smarthost` runs and refreshes the `state/smarthost.env` file with fresh values from Redis.
72153

73-
Furthermore if smarthost setup is changed when chiefonboarding is already
74-
running, the event handler `events/smarthost-changed/10reload_services`
75-
restarts the main module service.
154+
Furthermore if smarthost setup is changed when chiefonboarding is already running, the event handler `events/smarthost-changed/10reload_services` restarts the main module service.
76155

77156
See also the `systemd/user/chiefonboarding.service` file.
78157

79-
This setting discovery is just an example to understand how the module is
80-
expected to work: it can be rewritten or discarded completely.
158+
> This setting discovery is just an example to understand how the module is expected to work: it can be rewritten or discarded completely.
159+
160+
---
81161

82162
## Debug
83163

84-
some CLI are needed to debug
164+
### Check Environment Variables
165+
166+
The module runs under an agent that initiates a lot of environment variables (in `/home/chiefonboarding1/.config/state`). Verify them on the root terminal:
85167

86-
- The module runs under an agent that initiate a lot of environment variables (in /home/chiefonboarding1/.config/state), it could be nice to verify them
87-
on the root terminal
168+
```bash
169+
runagent -m chiefonboarding1 env
170+
```
171+
172+
### Use runagent
173+
174+
Become runagent for testing scripts and initiate all environment variables:
88175

89-
`runagent -m chiefonboarding1 env`
176+
```bash
177+
runagent -m chiefonboarding1
178+
```
90179

91-
- you can become runagent for testing scripts and initiate all environment variables
92-
93-
`runagent -m chiefonboarding1`
180+
The path becomes:
94181

95-
the path become :
96182
```
97-
echo $PATH
98-
/home/chiefonboarding1/.config/bin:/usr/local/agent/pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/
183+
echo $PATH
184+
/home/chiefonboarding1/.config/bin:/usr/local/agent/pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/
99185
```
100186

101-
- if you want to debug a container or see environment inside
102-
`runagent -m chiefonboarding1`
103-
```
187+
### List Running Containers
188+
189+
```bash
190+
runagent -m chiefonboarding1
104191
podman ps
192+
```
193+
194+
**Output example:**
195+
196+
```
105197
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
106198
d292c6ff28e9 localhost/podman-pause:4.6.1-1702418000 9 minutes ago Up 9 minutes 127.0.0.1:20015->80/tcp 80b8de25945f-infra
107199
d8df02bf6f4a docker.io/library/postgres:15.5-alpine3.19 --character-set-s... 9 minutes ago Up 9 minutes 127.0.0.1:20015->80/tcp postgresql-app
108200
9e58e5bd676f docker.io/library/nginx:stable-alpine3.17 nginx -g daemon o... 9 minutes ago Up 9 minutes 127.0.0.1:20015->80/tcp chiefonboarding-app
109201
```
110202

111-
you can see what environment variable is inside the container
203+
### Check Container Environment Variables
204+
205+
```bash
206+
podman exec chiefonboarding-app env
207+
```
208+
209+
**Output example:**
210+
112211
```
113-
podman exec chiefonboarding-app env
114212
TERM=xterm
115213
container=podman
116214
NGINX_VERSION=1.24.0
@@ -122,26 +220,34 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
122220
HOME=/root
123221
```
124222

125-
you can run a shell inside the container
223+
### Access Container Shell
126224

225+
Run a shell inside the container:
226+
227+
```bash
228+
podman exec -ti chiefonboarding-app sh
229+
/ #
127230
```
128-
podman exec -ti chiefonboarding-app sh
129-
/ #
130-
```
231+
232+
---
233+
131234
## Testing
132235

133236
Test the module using the `test-module.sh` script:
134237

238+
```bash
239+
./test-module.sh <NODE_ADDR> ghcr.io/geniusdynamics/chiefonboarding:latest
240+
```
135241

136-
./test-module.sh <NODE_ADDR> ghcr.io/geniusdynamics/chiefonboarding:latest
242+
The tests are made using [Robot Framework](https://robotframework.org/).
137243

138-
The tests are made using [Robot Framework](https://robotframework.org/)
244+
---
139245

140-
## UI translation
246+
## UI Translation
141247

142248
Translated with [Weblate](https://hosted.weblate.org/projects/ns8/).
143249

144-
To setup the translation process:
250+
To set up the translation process:
145251

146-
- add [GitHub Weblate app](https://docs.weblate.org/en/latest/admin/continuous.html#github-setup) to your repository
147-
- add your repository to [hosted.weblate.org]((https://hosted.weblate.org) or ask a NethServer developer to add it to ns8 Weblate project
252+
1. Add [GitHub Weblate app](https://docs.weblate.org/en/latest/admin/continuous.html#github-setup) to your repository
253+
2. Add your repository to [hosted.weblate.org](https://hosted.weblate.org) or ask a NethServer developer to add it to ns8 Weblate project

0 commit comments

Comments
 (0)