forked from INTO-CPS-Association/DTaaS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds AuthMS Drawio and resolves documentation issues
- Loading branch information
1 parent
ce40369
commit 99e4439
Showing
7 changed files
with
503 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,76 @@ The CLI has two layers of code: | |
is responsible for. It also | ||
has helper functions that can be used across the CLI. | ||
|
||
### TOML File | ||
|
||
The base configuration file used by the CLI is | ||
the _dtaas.toml_ file. | ||
|
||
This is divided into 3 sections: | ||
|
||
- The Global variables: | ||
|
||
```toml | ||
name = "Digital Twin as a Service (DTaaS)" | ||
version = "0.1.0" | ||
owner = "The INTO-CPS-Association" | ||
git-repo = "https://github.com/into-cps-association/DTaaS.git" | ||
``` | ||
|
||
These define the name, version, owner and git-repo of the DTaaS instance. | ||
Currently, these aren't directly used in the CLI and serve the purpose | ||
of documentation and reference. | ||
|
||
- Common Instance Variables | ||
|
||
```toml | ||
[common] | ||
# absolute path to the DTaaS application directory | ||
server-dns = "localhost" | ||
path = "/home/Desktop/DTaaS" | ||
``` | ||
|
||
The _path_ variable is used globally by the CLI. | ||
It is required while creating new workspace files, | ||
to run bash commands and create new docker services. | ||
|
||
The _server-dns_ variable is used to decide if | ||
the DTaaS instance is a localhost instance or a server | ||
deploy instance. In the case of server deploy, | ||
it is used to define the routes of the server type | ||
docker compose services appropriately. | ||
|
||
- Users variables | ||
|
||
```toml | ||
[users] | ||
# matching user info must present in this config file | ||
add = ["username1","username2", "username3"] | ||
delete = ["username2", "username3"] | ||
|
||
[users.username1] | ||
email = "[email protected]" | ||
``` | ||
|
||
This section firstly has two important lists, add and delete. | ||
The new users to be created, or current users to be removed | ||
from the instance using the CLI are fetched from here in the code. | ||
|
||
Additionally, each unique _user_ identified by their _username_ | ||
has an _email_ variable, which should have the email of the user | ||
as registered on the Gitlab instance. This is currently NOT IN USE. | ||
It is aimed to be incorporated in future versions. | ||
|
||
- Website Client variables | ||
|
||
```toml | ||
[client.web] | ||
config = "/home/Desktop/DTaaS/env.local.js" | ||
``` | ||
|
||
These variables are currently not in use, and will be incorporated | ||
in future work. | ||
|
||
## Setup | ||
|
||
```bash | ||
|
@@ -112,4 +182,23 @@ and publish your package to PyPI using poetry: | |
|
||
```bash | ||
poetry publish | ||
``` | ||
``` | ||
|
||
## Future work | ||
|
||
The final aim for the CLI is to be the standard way that | ||
admins setup, manage, and interact with the DTaaS instance. | ||
Although the base structure for the CLI is set up and | ||
the commands to manage users have been incorporated, we are | ||
a long way from our final aim. | ||
|
||
The following are the next steps for the CLI: | ||
|
||
- Incorporating the AuthMS _conf_ file rules | ||
in the user management commands. | ||
|
||
- [Bug fix] Currently users with usernames containing | ||
a '.' in it aren't handled well by the CLI and result in errors. | ||
This is because '.' is a special character for labels in docker compose. | ||
We need to include such usernames, simply by internally replacing | ||
'.' instances in usernames by '-' or '_'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,39 +74,43 @@ Then simply: | |
dtaas admin user add | ||
``` | ||
|
||
#### Caveat | ||
#### Caveats | ||
|
||
This brings up the containers, without the AuthMS authentication. | ||
1. '.' are a special character. Currently, usernames which have | ||
'.'s in them cannot be added properly through the CLI. | ||
This is an active issue that will be resolved in future releases. | ||
|
||
- Currently the _email_ fields for each user in | ||
_dtaas.toml_ are not in use, and are not necessary | ||
to fill in. These emails must be configured manually | ||
for each user in the | ||
deploy/docker/conf.server files and the _traefik-forward-auth_ | ||
container must be restarted. This is done as follows: | ||
2. This brings up the containers, without the AuthMS authentication. | ||
|
||
- Go to the _docker_ directory | ||
- Currently the _email_ fields for each user in | ||
_dtaas.toml_ are not in use, and are not necessary | ||
to fill in. These emails must be configured manually | ||
for each user in the | ||
deploy/docker/conf.server files and the _traefik-forward-auth_ | ||
container must be restarted. This is done as follows: | ||
|
||
```bash | ||
cd <DTaaS>/deploy/docker | ||
``` | ||
- Go to the _docker_ directory | ||
|
||
- Add three lines to the `conf.server` file | ||
```bash | ||
cd <DTaaS>/deploy/docker | ||
``` | ||
|
||
```txt | ||
rule.onlyu3.action=auth | ||
rule.onlyu3.rule=PathPrefix(`/user3`) | ||
rule.onlyu3.whitelist = [email protected] | ||
``` | ||
- Add three lines to the `conf.server` file | ||
|
||
Run the appropritate command for a server installation: | ||
```txt | ||
rule.onlyu3.action=auth | ||
rule.onlyu3.rule=PathPrefix(`/user3`) | ||
rule.onlyu3.whitelist = [email protected] | ||
``` | ||
|
||
```bash | ||
docker compose -f compose.server.yml --env-file .env up -d --force-recreate traefik-forward-auth | ||
``` | ||
Run the appropritate command for a server installation: | ||
|
||
```bash | ||
docker compose -f compose.server.yml --env-file .env up -d --force-recreate traefik-forward-auth | ||
``` | ||
|
||
The new users are now added to the DTaaS | ||
instance, with authorization enabled. | ||
The new users are now added to the DTaaS | ||
instance, with authorization enabled. | ||
|
||
### Delete users | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.