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

Updates install scripts #150

Merged
Show file tree
Hide file tree
Changes from 7 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
2 changes: 1 addition & 1 deletion .mdl_style.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
all
exclude_rule 'MD033'
rule 'MD013', :code_blocks => false, :tables => false
rule 'MD013', :ignore_code_blocks => true, :tables => false
rule 'MD046', :style => :fenced
2 changes: 1 addition & 1 deletion deploy/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# DTaaS on Linux Operating System

This directory contains code for running DTaaS application
on a Ubuntu Server 20.04 Operating System.
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 Down
2 changes: 1 addition & 1 deletion deploy/config/client/env.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
window.env = {
REACT_APP_ENVIRONMENT: 'dev',
REACT_APP_URL: 'https://foo.com/',
REACT_APP_URL_BASENAME: 'dtaas',
REACT_APP_URL_BASENAME: '',
REACT_APP_URL_DTLINK: '/lab',
REACT_APP_URL_LIBLINK: '',
REACT_APP_WORKBENCHLINK_TERMINAL: '/terminals/main',
Expand Down
8 changes: 5 additions & 3 deletions deploy/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ sleep 60

printf "\n \n Install the system dependencies...\n "
printf "....\n "
bash script/env.sh || exit
bash deploy/make_boxes/dtaas/user.sh || exit

printf "\n \n Download the required docker images...\n "
printf ".........\n "
source script/docker.sh || exit
docker pull traefik:v2.10
docker pull mltooling/ml-workspace:0.13.2
printf "\n\n docker images successfully downloaded...\n \n \n "


printf "\n \n Continue with the DTaaS installation...\n "
Expand Down Expand Up @@ -83,7 +85,7 @@ sudo docker run -d \
-v "$PWD/auth:/etc/traefik/auth" \
-v "$PWD/dynamic:/etc/traefik/dynamic" \
-v /var/run/docker.sock:/var/run/docker.sock \
traefik:v2.5 || true
traefik:v2.10 || true

#----------
printf "\n \n Create crontabs to run the application in daemon mode.\n "
Expand Down
46 changes: 30 additions & 16 deletions deploy/single-script-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ sudo mkdir -p /etc/apt/keyrings
if [ ! -f /etc/apt/keyrings/docker.gpg ]
then
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo printf \
"deb [arch=%s signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
%s stable" "$(dpkg --print-architecture)" "$(lsb_release -cs)" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
printf \
"deb [arch=%s signed-by=/etc/apt/keyrings/docker.gpg] \
https://download.docker.com/linux/ubuntu %s stable" \
"$(dpkg --print-architecture)" "$(lsb_release -cs)" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
fi

sudo apt-get update -y
Expand Down Expand Up @@ -58,14 +60,30 @@ sudo systemctl enable docker.service
sudo systemctl enable containerd.service


# Install nodejs environment
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo bash -
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
sudo mkdir -p /etc/apt/keyrings
if [ ! -f /etc/apt/keyrings/nodesource.gpg ]
then
curl -fsSL "https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key" | \
sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
fi
NODE_MAJOR=18
printf "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use variables in the printf format string. Use printf "..%s.." "$foo".

https://deb.nodesource.com/node_%s.x nodistro main" "$NODE_MAJOR" | \
sudo tee /etc/apt/sources.list.d/nodesource.list
sudo apt-get update
sudo apt-get install -y nodejs
sudo npm install -g [email protected]


if [ ! -f /usr/share/keyrings/yarnkey.gpg ]
then
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
printf "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
curl -sL "https://dl.yarnpkg.com/debian/pubkey.gpg" | gpg --dearmor | \
sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
printf "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] \
https://dl.yarnpkg.com/debian stable main \n" | \
sudo tee /etc/apt/sources.list.d/yarn.list
fi

sudo apt-get update -y
Expand All @@ -78,12 +96,8 @@ printf "\n\n End of installing dependencies...\n\n\n "
# get the required docker images
printf "Download the required docker images...\n "
printf ".........\n\n\n "
docker pull traefik:v2.5
docker pull influxdb:2.4
docker pull traefik:v2.10
docker pull mltooling/ml-workspace:0.13.2
docker pull grafana/grafana
docker pull telegraf
docker pull gitlab/gitlab-ce:15.10.0-ce.0
printf "\n\n docker images successfully downloaded...\n \n \n "
#----

Expand Down Expand Up @@ -128,7 +142,7 @@ yarn build
{
printf "PORT='4001'\n "
printf "MODE='local'\n "
printf "LOCAL_PATH ='%s'\n " "$TOP_DIR"
printf "LOCAL_PATH ='%s/files'\n " "$TOP_DIR"
printf "GITLAB_GROUP ='dtaas'\n "
printf "GITLAB_URL='https://gitlab.com/api/graphql'\n "
printf "TOKEN='123-sample-token'\n "
Expand All @@ -146,7 +160,7 @@ docker run -d \
-p 8090:8080 \
--name "ml-workspace-user1" \
-v "${TOP_DIR}/files/user1:/workspace" \
-v "${TOP_DIR}/files/common:/workspace/common:ro" \
-v "${TOP_DIR}/files/common:/workspace/common" \
--env AUTHENTICATE_VIA_JUPYTER="" \
--env WORKSPACE_BASE_URL="user1" \
--shm-size 512m \
Expand All @@ -157,7 +171,7 @@ docker run -d \
-p 8091:8080 \
--name "ml-workspace-user2" \
-v "${TOP_DIR}/files/user2:/workspace" \
-v "${TOP_DIR}/files/common:/workspace/common:ro" \
-v "${TOP_DIR}/files/common:/workspace/common" \
--env AUTHENTICATE_VIA_JUPYTER="" \
--env WORKSPACE_BASE_URL="user2" \
--shm-size 512m \
Expand All @@ -177,7 +191,7 @@ docker run -d \
-v "$PWD/auth:/etc/traefik/auth" \
-v "$PWD/dynamic:/etc/traefik/dynamic" \
-v /var/run/docker.sock:/var/run/docker.sock \
traefik:v2.5 || true
traefik:v2.10 || true


#----------
Expand Down
70 changes: 55 additions & 15 deletions deploy/vagrant/make_boxes/dtaas/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,61 @@
# DTaaS Boxes
# DTaaS Vagrant Box

This is a box that has the following items:
This README provides instructions on creating a custom Operating System
virtual disk for running the DTaaS software. The virtual disk is managed
by **vagrant**. The purpose is two fold:

* docker
* nodejs and yarn
* jupyter
* microk8s
* Provide cross-platform installation of the DTaaS application. Any operating system supporting use of vagrant software utility can support installation of the DTaaS software.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line length

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@astitva1905 If the line is broken into two lines, then another error comes:

Lists should be surrounded by blank lines

do you know of a good way to resolve this problem?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes Prasad
Simply shift some part to the next line and then add enough spaces at the beginning of the line so that the indentation matches the indentation of “Provide”. It should work then.

* Create a ready to use development environment for code contributors.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lists should be surrounded by blank lines


There are two scripts in this directory:

| Script name | Purpose | Default |
|:---|:---|:---|
| `user.sh` | user installation | :white_check_mark: |
| `developer.sh` | developer installation | :x: |

If you are installing the DTaaS for developers, the default installation
caters to your needs. You can skip the next step and continue with the
creation of vagrant box.

If you are a developer and would like additional software installed, you need
to modify `Vagrantfile`. The existing `Vagrantfile` has two lines:

```sh
config.vm.provision "shell", path: "user.sh"
#config.vm.provision "shell", path: "developer.sh"
```

Uncomment the second line to have more software components installed. If you
are not a developer, no changes are required to the `Vagrantfile`.

This vagrant box installed for users will have the following items:

* docker v24.0
* nodejs v18.8
* yarn v1.22
* npm v10.2
* containers
* ml-workspace v0.13
* traefik v2.10
* gitlab-ce v16.4
* influxdb v2.7
* grafana v10.1
* rabbitmq v3-management
* eclipse-mosquitto (mqtt) v2

This vagrant box installed for developers will have
the following items additional items:

* docker-compose v2.20
* microk8s v1.27
* jupyterlab
* mkdocs
* containers
* mltooling/ml-workspace:0.13.2
* traefik2.5
* influxdb2.4
* grafana
* telegraf
* gitlab
* telegraf v1.28

Publish a base virtualbox package to be used by
vagrant to publish all other virtualbox packages
The upcoming instructions will help with the creation of
base vagrant box.

```bash
#create a key pair
Expand All @@ -26,7 +66,6 @@ mv key.pub vagrant.pub
vagrant up

# let the provisioning be complete
# replace the vagrant ssh key-pair with personal one
vagrant ssh

# install the oh-my-zsh
Expand All @@ -37,6 +76,7 @@ git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-m
# inside ~/.zshrc, modify the following line
plugins=(git zsh-autosuggestions history cp tmux)

# to replace the vagrant ssh key-pair with personal one
# remove the vagrant default public key - first line of
# /home/vagrant/.ssh/authorized_keys

Expand Down
44 changes: 44 additions & 0 deletions deploy/vagrant/make_boxes/dtaas/developer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
# Installs necessary packages to create the docker environment for
# executing the DTaaS application

apt-get update -y
apt-get upgrade -y

#install docker-compose from https://docs.docker.com/compose/install/other/
curl -SL "https://github.com/docker/compose/releases/download/v2.20.3/docker-compose-linux-x86_64" \
-o /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
chmod 755 /usr/local/bin/docker-compose /usr/bin/docker-compose

# Install openssl for certificate generation
apt-get install -y wget openssl

# Install playwright tool for integration tests on browsers
npx playwright install-deps

#-------------
printf "\n\n Install jupyterlab and mkdocs"
pip install jupyterlab
pip install mkdocs
pip3 install mkdocs-material
pip3 install python-markdown-math
pip3 install mkdocs-open-in-new-tab
pip3 install mkdocs-with-pdf
pip3 install qrcode

# Install minimal Kubernetes cluster
snap install microk8s --classic
usermod -a -G microk8s vagrant
chown -f -R vagrant ~/.kube
newgrp microk8s

# get the required docker images
docker pull telegraf:1.28.2

# Install markdownlint
sudo gem install mdl

# Install madge for generating dependency graphs of typescript projects
sudo apt-get install graphviz
sudo npm install -g madge
Loading