Skip to content

Commit

Permalink
Updates docs, install scripts and config
Browse files Browse the repository at this point in the history
  - Updates documentation links to release v0.3 branch.
  - Fixes mistakes in install script and docs.
  - Updates gateway config to have libms as well.
  • Loading branch information
prasadtalasila committed Nov 8, 2023
1 parent b801925 commit 84db7ce
Show file tree
Hide file tree
Showing 14 changed files with 107 additions and 64 deletions.
57 changes: 41 additions & 16 deletions deploy/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DTaaS on Linux Operating System

This directory contains code for running DTaaS application
These are installation instructions for running DTaaS application
on a Ubuntu Server 22.04 Operating System.
The setup requires a machine which can spare 16GB
RAM, 8 vCPUs and 50GB Hard Disk space.
Expand All @@ -9,9 +9,16 @@ A dummy **foo.com** URL has been used for illustration.
Please change this to your unique website URL.
It is assumed that you are going to serve the application in only HTTPS mode.

A successful installation will create a setup
similar to the one shown in the figure.

![Single host install](../docs/admin/single-host.png)

Please follow these steps to make this work in your local environment.
Download the codebase as zip file into your computer and unzip the same
into a directory named **DTaaS**. The rest of the instructions assume
into a directory named **DTaaS**.
Alternatively, clone this git repository into your computer.
The rest of the instructions assume
that your working directory is **DTaaS**.

## Configuration
Expand All @@ -22,20 +29,28 @@ The first step is to decide on the number of users and their usenames.
The traefik gateway configuration has a template for two users.
You can modify the usernames in the template to the usernames chosen by you.

### The traefik gateway server
### Traefik gateway server

You can run the Run the Traefik gateway server in both and
You can run the Traefik gateway server in both and
HTTPS and HTTPS mode to experience the DTaaS application.
The installation guide assumes that you can run the application in HTTPS mode.

The Traefik gateway configuration is at [fileConfig](../config/gateway/fileConfig.yml).
Change `localhost` to `foo.com` and user1/user2 to the usernames chosen by you.
The Traefik gateway configuration is at _[fileConfig](config/gateway/fileConfig.yml)_.
Change `foo.com` to your local hostname and user1/user2 to the usernames chosen by you.

**NOTE**: Do not use `http://` or `https://`
in [fileConfig](../config/gateway/fileConfig.yml).
in [fileConfig](config/gateway/fileConfig.yml).

#### Authentication

This step requires `htpasswd` commandline utility. If
it is not available on your system, please install the same by using

```bash
sudo apt-get install -y apache2-utils
```

You can now proceed with update of the gateway authentication setup.
The dummy username is `foo` and the password is `bar`.
Please change this before starting the gateway.

Expand All @@ -46,24 +61,25 @@ htpasswd deploy/config/gateway/auth <first_username>
password: <your password>
```

The user credentials added in [auth](../config/gateway/auth) should match
the usernames in [fileConfig](../config/gateway/fileConfig.yml).
The user credentials added in _[config/gateway/auth](config/gateway/auth)_
should match the usernames in
_[config/gateway/fileConfig](config/gateway/fileConfig.yml)_.

## Configure lib microservice
## Lib microservice

The library microservice requires configuration.
A template of this configuration file is given in _config/lib_ file.
A template of this configuration file is given in _[config/lib](config/lib)_ file.
Please modify this file as per your needs.

The first step in this configuration is to prepare the a filesystem for users.
An example file system in `files/` directory.
You can rename the top-level user1/user2 to the usernames chosen by you.

Add an environment file named .env in lib for the library microservice.
Add an environment file named `.env` in lib for the library microservice.
An example `.env` file is given below.
The simplest possibility is to use `local` mode with the following example.
The filepath is the absolute filepath to `files/` directory.
You can copy this configuration into _config/lib_ file to get started.
You can copy this configuration into _[config/lib](config/lib)_ file to get started.

```env
PORT='4001'
Expand All @@ -74,7 +90,7 @@ APOLLO_PATH='/lib'
GRAPHQL_PLAYGROUND='true'
```

## Configure React Client Website
## React Client Website

### Gitlab OAuth application

Expand All @@ -101,11 +117,11 @@ the [Authentication page](client/auth.md).

### Update Client Config

Change the React website configuration in _deploy/config/client/env.js_.
Change the React website configuration in _[config/client/env.js](config/client/env.js)_.

```js
window.env = {
REACT_APP_ENVIRONMENT: 'dev',
REACT_APP_ENVIRONMENT: 'prod',
REACT_APP_URL: 'https://foo.com/',
REACT_APP_URL_BASENAME: 'dtaas',
REACT_APP_URL_DTLINK: '/lab',
Expand Down Expand Up @@ -141,3 +157,12 @@ You can run this script multiple times until the installation is successful.
## Access the application

Now you should be able to access the DTaaS application at: _<http:>https://foo.com</http:>_

## References

Image sources: [Ubuntu logo](https://logodix.com/linux-ubuntu),
[Traefik logo](https://www.laub-home.de/wiki/Traefik_SSL_Reverse_Proxy_f%C3%BCr_Docker_Container),
[ml-workspace](https://github.com/ml-tooling/ml-workspace),
[nodejs](https://www.metachris.com/2017/01/how-to-install-nodejs-7-on-ubuntu-and-centos/),
[reactjs](https://krify.co/about-reactjs/),
[nestjs](https://camunda.com/blog/2019/10/nestjs-tx-email/)
11 changes: 5 additions & 6 deletions deploy/config/gateway/fileConfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ http:
- basic-auth
service: user2

vis:
libms:
entryPoints:
- http
rule: 'Host(`foo.com`) && PathPrefix(`/vis`)'
service: grafana
rule: 'Host(`foo.com`) && PathPrefix(`/lib`)'
service: libms


# Middleware: Basic authentication
Expand All @@ -55,8 +55,7 @@ http:
servers:
- url: "http://localhost:8091"

grafana:
libms:
loadBalancer:
servers:
- url: "http://localhost:3000"

- url: "http://localhost:4001"
2 changes: 1 addition & 1 deletion deploy/single-script-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ else
git clone https://github.com/INTO-CPS-Association/DTaaS.git DTaaS
cd DTaaS || exit
git fetch --all
git checkout feature/distributed-demo
git checkout release-v0.3
fi

TOP_DIR=$(pwd)
Expand Down
8 changes: 4 additions & 4 deletions docs/admin/client/CLIENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ one [ML Workspace](https://github.com/ml-tooling/ml-workspace)
serving the following routes.

```js
https:foo.com/<username>/lab
https:foo.com/<username>/terminals/main
https:foo.com/<username>/tools/vnc/?password=vncpassword
https:foo.com/<username>/tools/vscode/
https://foo.com/<username>/lab
https://foo.com/<username>/terminals/main
https://foo.com/<username>/tools/vnc/?password=vncpassword
https://foo.com/<username>/tools/vscode/
```

The `username` is the user workspace created using ML Workspace docker container.
Expand Down
11 changes: 6 additions & 5 deletions docs/admin/host.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ The first step is to decide on the number of users and their usenames.
The traefik gateway configuration has a template for two users.
You can modify the usernames in the template to the usernames chosen by you.

### The traefik gateway server
### Traefik gateway server

You can run the Run the Traefik gateway server in both
You can run the Traefik gateway server in both
HTTP and HTTPS mode to experience the DTaaS application.
The installation guide assumes that you can run the application in HTTPS mode.

Expand Down Expand Up @@ -80,7 +80,7 @@ password: <your password>
The user credentials added in _deploy/config/gateway/auth_ should
match the usernames in _deploy/config/gateway/fileConfig.yml_.

## Configure lib microservice
## Lib microservice

The library microservice requires configuration.
A template of this configuration file is given in _deploy/config/lib_ file.
Expand All @@ -90,6 +90,7 @@ The first step in this configuration is to prepare the a filesystem for users.
An example file system in `files/` directory.
You can rename the top-level user1/user2 to the usernames chosen by you.

Add an environment file named `.env` in lib for the library microservice.
An example `.env` file is given below.
The simplest possibility is to use `local` mode with the following example.
The filepath is the absolute filepath to `files/` directory.
Expand All @@ -104,7 +105,7 @@ APOLLO_PATH='/lib'
GRAPHQL_PLAYGROUND='true'
```

## Configure React Client Website
## React Client Website

### Gitlab OAuth application

Expand All @@ -131,7 +132,7 @@ Change the React website configuration in _deploy/config/client/env.js_.

```js
window.env = {
REACT_APP_ENVIRONMENT: 'dev',
REACT_APP_ENVIRONMENT: 'prod',
REACT_APP_URL: 'https://foo.com/',
REACT_APP_URL_BASENAME: 'dtaas',
REACT_APP_URL_DTLINK: '/lab',
Expand Down
10 changes: 10 additions & 0 deletions docs/admin/servers/lib/LIB-MS.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ yarn build # build the application
yarn start # start the application
```

#### Config flag

If the environment file is named something other than `.env`,
the filename must be specifed with the command `-c, --config <path>`,
when starting the application. For instance,

```sh
yarn start -c ".env.development"
```

You can press `Ctl+C` to halt the application.
If you wish to run the microservice in the background, use

Expand Down
1 change: 0 additions & 1 deletion docs/admin/services.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ at the following ports / URLs.
| RabbitMQ Broker | services.foo.com:5672 |
| RabbitMQ Broker Management Website | services.foo.com:15672 |
| MQTT Broker | services.foo.com:1883 |
||

The firewall and network access settings of corporate / cloud network need to be
configured to allow external access to the services. Otherwise the users of DTaaS
Expand Down
2 changes: 1 addition & 1 deletion docs/admin/trial.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ for getting the Gitlab OAuth application details.
## Install

```bash
wget https://raw.githubusercontent.com/INTO-CPS-Association/DTaaS/feature/distributed-demo/deploy/single-script-install.sh
wget https://raw.githubusercontent.com/INTO-CPS-Association/DTaaS/release-v0.3/deploy/single-script-install.sh
bash single-script-install.sh
```

Expand Down
2 changes: 1 addition & 1 deletion docs/admin/vagrant/single-machine.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Set a cronjob inside the vagrant virtual
machine to remote the conflicting default route.

```bash
wget https://raw.githubusercontent.com/INTO-CPS-Association/DTaaS/feature/distributed-demo/deploy/vagrant/route.sh
wget https://raw.githubusercontent.com/INTO-CPS-Association/DTaaS/release-v0.3/deploy/vagrant/route.sh
sudo bash route.sh
```

Expand Down
3 changes: 1 addition & 2 deletions docs/admin/vagrant/two-machines.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ you can see the following services active within server2 (_services.foo.com_).
| MQTT communication service | services.foo.com:1883 |
| RabbitMQ communication service | services.foo.com:5672 |
| RabbitMQ management service | services.foo.com:15672 |
||

### Install DTaaS Application

Expand All @@ -108,7 +107,7 @@ Execute the following commands from terminal
```bash
vagrant up --provision dtaas
vagrant ssh dtaas
wget https://raw.githubusercontent.com/INTO-CPS-Association/DTaaS/feature/distributed-demo/deploy/vagrant/route.sh
wget https://raw.githubusercontent.com/INTO-CPS-Association/DTaaS/release-v0.3/deploy/vagrant/route.sh
sudo bash route.sh
```

Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ It is also possible to share the services offered by one DT with other users.
There is an overview of the software available in the form of
[slides](https://odin.cps.digit.au.dk/into-cps/dtaas/assets/DTaaS-short-intro.pdf),
[video](https://odin.cps.digit.au.dk/into-cps/dtaas/assets/videos/DTaaS-short-intro.mp4),
and [feature walkthrough](https://odin.cps.digit.au.dk/into-cps/dtaas/assets/videos/dtaas-v0.2.0-demo.mp4).
and [feature walkthrough](https://odin.cps.digit.au.dk/into-cps/dtaas/assets/videos/dtaas-v0.3-demo.mp4).

## License

Expand Down
5 changes: 5 additions & 0 deletions docs/redirect-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
<td scope="col"><a href="development/index.html">Online</a></td>
<td scope="col"><a href="DTaaS-development.pdf">PDF</a></td>
</tr>
<tr>
<th scope="row">Version 0.3.0</th>
<td scope="col"><a href="version0.3/index.html">Online</a></td>
<td scope="col"><a href="DTaaS-version0.3.pdf">PDF</a></td>
</tr>
<tr>
<th scope="row">Version 0.2.0</th>
<td scope="col"><a href="version0.2/index.html">Online</a></td>
Expand Down
29 changes: 10 additions & 19 deletions servers/config/gateway/dynamic/fileConfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,47 +24,38 @@ http:
- basic-auth
service: user2

vis:
entryPoints:
- http
rule: 'Host(`localhost`) && PathPrefix(`/vis`)'
service: grafana

lib:
libms:
entryPoints:
- http
rule: 'Host(`localhost`) && PathPrefix(`/lib`)'
service: lib
service: libms


# Middleware: Basic authentication
middlewares:
basic-auth:
basicAuth:
usersFile: '/etc/traefik/auth'
usersFile: "/etc/traefik/auth"
removeHeader: true


services:
dtaas:
loadBalancer:
servers:
- url: 'http://localhost:4000'
- url: "http://localhost:4000"

user1:
loadBalancer:
servers:
- url: 'http://localhost:8090'
- url: "http://localhost:8090"

user2:
loadBalancer:
servers:
- url: 'http://localhost:8091'

grafana:
loadBalancer:
servers:
- url: 'http://localhost:3000'
- url: "http://localhost:8091"

lib:
libms:
loadBalancer:
servers:
- url: 'http://localhost:4001'
- url: "http://localhost:4001"
Loading

0 comments on commit 84db7ce

Please sign in to comment.