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

301 run dtaas with localhost domain name #348

Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
19 changes: 19 additions & 0 deletions deploy/config/client/env.local.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
window.env = {
nichlaes marked this conversation as resolved.
Show resolved Hide resolved
nichlaes marked this conversation as resolved.
Show resolved Hide resolved
REACT_APP_ENVIRONMENT: "dev",
REACT_APP_URL: "http://localhost/",
REACT_APP_URL_BASENAME: "",
REACT_APP_URL_DTLINK: "/lab",
REACT_APP_URL_LIBLINK: "",
REACT_APP_WORKBENCHLINK_TERMINAL: "/terminals/main",
REACT_APP_WORKBENCHLINK_VNCDESKTOP: "/tools/vnc/?password=vncpassword",
REACT_APP_WORKBENCHLINK_VSCODE: "/tools/vscode/",
REACT_APP_WORKBENCHLINK_JUPYTERLAB: "/lab",
REACT_APP_WORKBENCHLINK_JUPYTERNOTEBOOK: "",

REACT_APP_CLIENT_ID:
"1be55736756190b3ace4c2c4fb19bde386d1dcc748d20b47ea8cfb5935b8446c",
REACT_APP_AUTH_AUTHORITY: "https://gitlab.com/",
REACT_APP_REDIRECT_URI: "http://localhost/Library",
REACT_APP_LOGOUT_REDIRECT_URI: "http://localhost/",
REACT_APP_GITLAB_SCOPES: "openid profile read_user read_repository api",
};
35 changes: 35 additions & 0 deletions deploy/config/gateway/fileConfig.local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
http:
routers:
dtaas:
entryPoints:
- http
rule: "Host(`localhost`)"
service: dtaas

user1:
entryPoints:
- http
rule: "Host(`localhost`) && PathPrefix(`/user1`)"
nichlaes marked this conversation as resolved.
Show resolved Hide resolved
service: user1

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

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

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

libms:
loadBalancer:
servers:
- url: "http://localhost:4001"
6 changes: 6 additions & 0 deletions deploy/config/lib.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PORT='4001'
MODE='local'
LOCAL_PATH ='filepath'
LOG_LEVEL='debug'
APOLLO_PATH='/lib'
GRAPHQL_PLAYGROUND='true'
36 changes: 33 additions & 3 deletions deploy/single-script-install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
#!/bin/bash
while [[ "$#" -gt 0 ]]; do
case $1 in
--env)
env_variable="$2"
shift
;;
*)
echo "Unknown parameter passed: $1"
exit 1
;;
esac
shift
done

set -eu

if [ -n "$env_variable" ] ; then
printf "environment: $env_variable.\n"
nichlaes marked this conversation as resolved.
Show resolved Hide resolved
fi

printf "Install script for DTaaS software platform.\n"
printf "You can run the script multiple times until the installation succeeds.\n "
printf ".........\n \n \n "
Expand Down Expand Up @@ -129,13 +147,22 @@ yarn install
yarn build

yarn configapp dev
cp "${TOP_DIR}/deploy/config/client/env.js" build/env.js
if [ -n "$env_variable" ] ; then
cp "${TOP_DIR}/deploy/config/client/env.${env_variable}.js" build/env.js
else
cp "${TOP_DIR}/deploy/config/client/env.js" build/env.js
fi
nohup serve -s build -l 4000 & disown

#-------------
printf "\n\n Build, configure and run the lib microservice\n "
printf "...........\n "
cd "${TOP_DIR}/servers/lib" || exit
if [ -n "$env_variable" ] ; then
cp "${TOP_DIR}/deploy/config/lib.${env_variable}" .env
else
cp "${TOP_DIR}/deploy/config/lib" .env
fi
yarn install
yarn build

Expand Down Expand Up @@ -183,8 +210,11 @@ printf "\n\n Start the traefik gateway server\n "
printf "...........\n "
cd "${TOP_DIR}/servers/config/gateway" || exit
cp "${TOP_DIR}/deploy/config/gateway/auth" auth
cp "${TOP_DIR}/deploy/config/gateway/fileConfig.yml" "dynamic/fileConfig.yml"

if [ -n "$env_variable" ] ; then
cp "${TOP_DIR}/deploy/config/gateway/fileConfig.${env_variable}.yml" "dynamic/fileConfig.yml"
else
cp "${TOP_DIR}/deploy/config/gateway/fileConfig.yml" "dynamic/fileConfig.yml"
fi
docker run -d \
--name "traefik-gateway" \
--network=host -v "$PWD/traefik.yml:/etc/traefik/traefik.yml" \
Expand Down
7 changes: 7 additions & 0 deletions docs/admin/localhost.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
To setup the DTaaS to use localhost, please follow [trial setup](./trial.md),
nichlaes marked this conversation as resolved.
Show resolved Hide resolved
but use the script below instead.

```bash
wget https://raw.githubusercontent.com/INTO-CPS-Association/DTaaS/feature/distributed-demo/deploy/single-script-install.sh
bash single-script-install.sh --env local
```
3 changes: 2 additions & 1 deletion docs/admin/trial.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ Remember to create gitlab accounts for `user1` and `user2`.
While installing you might encounter multiple dialogs asking,
which services should be restarted. Just click **OK** to all of those.

Run the following scripts.
Run the following scripts. To setup the installation to use localhost,
add the following argument to the script `--env local`.

```bash
wget https://raw.githubusercontent.com/INTO-CPS-Association/DTaaS/feature/distributed-demo/deploy/single-script-install.sh
Expand Down
Loading