Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap ml-workspace container and add admin cookbook #300

Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
59ac12b
traefik-gateway uses new auth
nichlaes Sep 27, 2023
2bf2abb
inital commit on admin guides
nichlaes Sep 27, 2023
1a4a79a
traefik-gateway uses new auth
nichlaes Sep 27, 2023
4e060cd
inital commit on admin guides
nichlaes Sep 27, 2023
a878dad
added admin overview section
nichlaes Oct 11, 2023
4e59779
fixed merge
nichlaes Oct 11, 2023
91da432
restructuring
nichlaes Oct 12, 2023
755db2e
adds overview
nichlaes Oct 12, 2023
4df82d9
merged with main branch
nichlaes Oct 25, 2023
333d717
add post install check and note
nichlaes Oct 26, 2023
01893c8
added hyperlink
nichlaes Nov 8, 2023
fa2b682
Create add_user.md
nichlaes Nov 14, 2023
3bee958
Merge branch 'feature/distributed-demo' into 96-update-admin-document…
nichlaes Nov 14, 2023
adf8fef
Create add_service.md
nichlaes Nov 14, 2023
1d69b95
Update mkdocs.yml
nichlaes Nov 14, 2023
edf1879
added link service guide
nichlaes Nov 14, 2023
4a9228a
Create common_workspace_readonly.md
nichlaes Nov 14, 2023
aa0b806
Delete guide.md
nichlaes Nov 14, 2023
e40bcf8
added guide for workspace and host site without https
nichlaes Nov 16, 2023
27d552a
Update link_service.md
nichlaes Nov 17, 2023
a5e80d8
Update hosting_site_without_https.md
nichlaes Nov 17, 2023
43b9678
Create open_terminal_in_workspace.gif
nichlaes Nov 17, 2023
94a6330
moved to different js file
nichlaes Nov 17, 2023
8b0d5de
added warning about RAM and CPU
nichlaes Nov 17, 2023
c1b0d79
Merge branch 'feature/distributed-demo' into 96-update-admin-document…
nichlaes Nov 17, 2023
99873ee
Update add_user.md
nichlaes Nov 17, 2023
a39e191
formatting
nichlaes Nov 17, 2023
40f50ef
formatting
nichlaes Nov 17, 2023
acf2ec5
updated based on PR feedback
nichlaes Nov 17, 2023
f12fb9f
updated mkdocs
nichlaes Nov 20, 2023
25d5897
formatting
nichlaes Nov 20, 2023
56f4fc1
Create update_basepath.md
nichlaes Nov 20, 2023
8332bce
formatting
nichlaes Nov 20, 2023
b55f654
formatting
nichlaes Nov 20, 2023
a995817
changed ml workpsace image to minimal version
nichlaes Nov 21, 2023
b16cbd9
added specific version
nichlaes Nov 21, 2023
aefca12
formatting
nichlaes Nov 24, 2023
2f6871b
formatting
nichlaes Nov 24, 2023
2bd00e2
added mongodb setup to services
nichlaes Nov 24, 2023
b994ce6
formatting
nichlaes Nov 24, 2023
63f3357
formatting
nichlaes Nov 24, 2023
62eb5ce
formatting
nichlaes Nov 24, 2023
ae810b8
changes ssh server
nichlaes Nov 24, 2023
c110ab0
updated labels for guides documentation
nichlaes Nov 24, 2023
5446877
refactored yarn lock #296
nichlaes Nov 24, 2023
3ce5859
Cleans up docs and fixes services.js script
prasadtalasila Nov 24, 2023
931b5d0
Set mongodb container version
prasadtalasila Nov 24, 2023
7f85a83
Adds mongodb to docker pull list
prasadtalasila Nov 24, 2023
5010068
Fix codeclimate issues
prasadtalasila Nov 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions deploy/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ bash script/base.sh || exit
printf "\n \n Download the required docker images...\n "
printf ".........\n "
docker pull traefik:v2.10
docker pull mltooling/ml-workspace:0.13.2
docker pull mltooling/ml-workspace-minimal:0.13.2
printf "\n\n docker images successfully downloaded...\n \n \n "


Expand Down Expand Up @@ -59,7 +59,7 @@ docker run -d \
--env WORKSPACE_BASE_URL="user1" \
--shm-size 512m \
--restart always \
mltooling/ml-workspace:0.13.2 || true
mltooling/ml-workspace-minimal:0.13.2 || true

docker run -d \
-p 8091:8080 \
Expand All @@ -70,7 +70,7 @@ docker run -d \
--env WORKSPACE_BASE_URL="user2" \
--shm-size 512m \
--restart always \
mltooling/ml-workspace:0.13.2 || true
mltooling/ml-workspace-minimal:0.13.2 || true

#-------------
printf "\n \n Start the traefik gateway server\n "
Expand Down
6 changes: 3 additions & 3 deletions deploy/single-script-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ printf "\n\n End of installing dependencies...\n\n\n "
printf "Download the required docker images...\n "
printf ".........\n\n\n "
docker pull traefik:v2.10
docker pull mltooling/ml-workspace:0.13.2
docker pull mltooling/ml-workspace-minimal:0.13.2
printf "\n\n docker images successfully downloaded...\n \n \n "
#----

Expand Down Expand Up @@ -165,7 +165,7 @@ docker run -d \
--env WORKSPACE_BASE_URL="user1" \
--shm-size 512m \
--restart always \
mltooling/ml-workspace:0.13.2 || true
mltooling/ml-workspace-minimal:0.13.2 || true

docker run -d \
-p 8091:8080 \
Expand All @@ -176,7 +176,7 @@ docker run -d \
--env WORKSPACE_BASE_URL="user2" \
--shm-size 512m \
--restart always \
mltooling/ml-workspace:0.13.2 || true
mltooling/ml-workspace-minimal:0.13.2 || true

#-------------
printf "\n\n Start the traefik gateway server\n "
Expand Down
2 changes: 1 addition & 1 deletion deploy/vagrant/make_boxes/dtaas/user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ cat /vagrant/vagrant.pub >> /root/.ssh/authorized_keys

# get the required docker images
docker pull traefik:v2.10
docker pull mltooling/ml-workspace:0.13.2
docker pull mltooling/ml-workspace-minimal:0.13.2
docker pull grafana/grafana:10.1.4
docker pull influxdb:2.7
docker pull rabbitmq:3-management
Expand Down
4 changes: 2 additions & 2 deletions docs/admin/client/CLIENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ docker run -d \
--env WORKSPACE_BASE_URL="alice" \
--shm-size 512m \
--restart always \
mltooling/ml-workspace:0.13.2
mltooling/ml-workspace-minimal:0.13.2

docker run -d \
-p 8091:8080 \
Expand All @@ -136,7 +136,7 @@ docker run -d \
--env WORKSPACE_BASE_URL="bob" \
--shm-size 512m \
--restart always \
mltooling/ml-workspace:0.13.2
mltooling/ml-workspace-minimal:0.13.2
```

Given that multiple services are running at different routes,
Expand Down
2 changes: 1 addition & 1 deletion docs/admin/client/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ DTaaS application URL: https://foo.com/bar
Gitlab instance URL: https://foo.gitlab.com
Callback URL: https://foo.com/bar/Library
Logout URL: https://foo.com/bar
```
```
112 changes: 112 additions & 0 deletions docs/admin/guides/add_service.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Add other services

<!-- prettier-ignore -->
!!! Pre-requisite
You should read the documentation about
the already available [services](../services.md)

This guide will show you how to add more services.
In the following example we will be adding **mongodb** as a service,
but this could be used for other services as well.

:fontawesome-solid-circle-info:
**Adding other services requires more RAM and CPU power.**
**Please make sure the host machine meets the hardware requirements**
**for running all the services.**

## 1. Add the configuration

You should add the following configuration variables.

| Configuration Variable Name | Description |
| :-------------------------- | :---------------------------------------------------------------- |
| username | the username of the root user in the mongodb |
| password | the password of the root user in the mongodb |
| port | the mapped port on the host machine (default is 27017) |
| datapath | path on host machine to mount the data from the mongodb container |

Open the file `/deploy/services/services.yml` and add the configuration for mongodb:

```yml
services:
rabbitmq:
username: "dtaas"
password: "dtaas"
vhost: "/"
ports:
main: 5672
management: 15672
...
mongodb:
username: <username>
password: <password>
port: <port>
datapath: <datapath>
...
```

## 2. Add the script

The next step is to add the script that set up the mongodb container with the configuraiton.

Create following file `/deploy/services/mongodb.js` and add the following code:

```js
#!/usr/bin/node
/* Install the optional platform services for DTaaS */
import { $ } from "execa";
import chalk from "chalk";
import fs from "fs";
import yaml from "js-yaml";

const $$ = $({ stdio: "inherit" });
const log = console.log;
let config;

try {
log(chalk.blue("Load services configuration"));
config = await yaml.load(fs.readFileSync("services.yml", "utf8"));
log(
chalk.green(
"configuration loading is successful and config is a valid yaml file"
)
);
} catch (e) {
log(chalk.red("configuration is invalid. Please rectify services.yml file"));
process.exit(1);
}

log(chalk.blue("Start MongoDB server"));
const mongodbConfig = config.services.mongodb;

try {
log(
chalk.green(
"Attempt to delete any existing MongoDB server docker container"
)
);
await $$`docker stop mongodb`;
await $$`docker rm mongodb`;
} catch (e) {}

log(chalk.green("Start new Mongodb server docker container"));
await $$`docker run -d -p ${mongodbConfig.port}:27017 \
--name mongodb \
-v ${mongodbConfig.datapath}:/data/db \
-e MONGO_INITDB_ROOT_USERNAME=${mongodbConfig.username} \
-e MONGO_INITDB_ROOT_PASSWORD=${mongodbConfig.password} \
mongo`;
log(chalk.green("MongoDB server docker container started successfully"));
```

## 3. Run the script

Go to the directory `/deploy/services/`
and run services script with the following commands:

```bash
yarn install
node mongodb.js
```

The MongoDB should now be available on **services.foo.com:<port\>**.
82 changes: 82 additions & 0 deletions docs/admin/guides/add_user.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Add a new user

This page will guide you on, how to add more users to the DTaas. Please do the following:

<!-- prettier-ignore -->
!!! important
Make sure to replace **<username\>** and **<port\>**
Select a port that is not already being used by the system.

## 1. Add user

Add the new user on the Gitlab instance.

## 2. Setup a new workspace

The above code creates a new workspace for the new user based on "user2".

```bash
cd DTaaS/files
cp -R user2 <username>
cd ..
docker run -d \
-p <port>:8080 \
--name "ml-workspace-<username>" \
-v "${TOP_DIR}/files/<username>:/workspace" \
-v "${TOP_DIR}/files/<username>:/workspace/common" \
--env AUTHENTICATE_VIA_JUPYTER="" \
--env WORKSPACE_BASE_URL="<username>" \
--shm-size 512m \
--restart always \
mltooling/ml-workspace-minimal:0.13.2

```

## 3. Add username and password

The following code adds basic authentication for the new user.

```bash
cd DTaaS/servers/config/gateway
htpasswd auth <username>
```

## 4. Add 'route' for new user

Now we just need to add a new route to the servers ingress.

Open the following file with your preffered editor (e.g. VIM/nano).

```bash
vi DTaaS/servers/config/gateway/dynamic/fileConfig.yml
```

Now add the new route and service for the user.

<!-- prettier-ignore -->
!!! important
foo.com should be replaced with your own domain.

```yml
http:
routers:
....
<username>:
entryPoints:
- http
rule: 'Host(`foo.com`) && PathPrefix(`/<username>`)'
middlewares:
- basic-auth
service: <username>

services:
...
<username>:
loadBalancer:
servers:
- url: 'http://localhost:<port>'
```

## 5. Access the new user

Log into the DTaaS application as new user
38 changes: 38 additions & 0 deletions docs/admin/guides/common_workspace_readonly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Make common asset area read only

## Why

In some cases you might want to restrict the users rights to the common workspace.
In order to make the common area read only,
you have to change the install script for setting up the user workspace.

## How

To make the common area read-only for user2,
the following changes were made to the install script,
which is located one of the following places.

- trial installation: `single-script-install.sh`

- production installation: `DTaas/deploy/install.sh`

The line `-v "${TOP_DIR}/files/common:/workspace/common:ro"`
was added to make the common workspace read-only for user2.

Here's the updated code:

```sh
docker run -d \
-p 8091:8080 \
--name "ml-workspace-user2" \
-v "${TOP_DIR}/files/user2:/workspace" \
-v "${TOP_DIR}/files/common:/workspace/common:ro" \
--env AUTHENTICATE_VIA_JUPYTER="" \
--env WORKSPACE_BASE_URL="user2" \
--shm-size 512m \
--restart always \
mltooling/ml-workspace-minimal:0.13.2 || true
```

This ensures that the common area is read-only for user2,
while the user's own files are still writable.
6 changes: 6 additions & 0 deletions docs/admin/guides/hosting_site_without_https.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Hosting site without https

In the default setup,
the https connection is provided by the reverse proxy.
The DTaaS application runs in http mode.
So removing the reverse proxy removes the https mode.
38 changes: 38 additions & 0 deletions docs/admin/guides/link_service.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Link services to local ports

<!-- prettier-ignore -->
!!! Requirements

- User needs to have an account on server2.
nichlaes marked this conversation as resolved.
Show resolved Hide resolved
nichlaes marked this conversation as resolved.
Show resolved Hide resolved
- SSH server must be running on server2

To link a port from the service machine (server2)
to the local port on the user workspace.
You can make a ssh link between these two.

## 1. Step

Go to the user workspace, on which you want to map
from localhost to the services machine

- e.g. `foo.com/user1`

## 2. Step

Open a terminal in your user workspace.
![Open terminal in user workspace](open_terminal_in_workspace.gif)

## 3. Step

Run the following command to map a port:

```sh
ssh -fNT -L <local_port>:<destination>:<destination_port> <user>@<ssh_server>

```

Here's an example mapping the service port 5672 to localhost port 5672.

```sh
ssh -fNT -L 5672:localhost:5672 [email protected]
```
Binary file added docs/admin/guides/open_terminal_in_workspace.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading