Skip to content
Snippets Groups Projects
Commit 1017dfb6 authored by Georgios Katsikas's avatar Georgios Katsikas
Browse files

refactor: fix tutorial deployment issues


Signed-off-by: default avatargkatsikas <gkatsikas@ubitech.eu>
parent 66ed7477
No related branches found
No related tags found
1 merge request!54Release 2.0.0
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
######################################################################################################################## ########################################################################################################################
# If not already set, set the name of the Kubernetes namespace to deploy to. # If not already set, set the name of the Kubernetes namespace to deploy to.
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs-dev"} export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"}
# If not already set, set the list of components you want to build images for, and deploy. # If not already set, set the list of components you want to build images for, and deploy.
export TFS_COMPONENTS=${TFS_COMPONENTS:-"context device automation policy service compute monitoring dbscanserving opticalattackmitigator opticalcentralizedattackdetector webui"} export TFS_COMPONENTS=${TFS_COMPONENTS:-"context device automation policy service compute monitoring dbscanserving opticalattackmitigator opticalcentralizedattackdetector webui"}
...@@ -32,6 +32,7 @@ for COMPONENT in $TFS_COMPONENTS; do ...@@ -32,6 +32,7 @@ for COMPONENT in $TFS_COMPONENTS; do
echo "Processing '$COMPONENT' component..." echo "Processing '$COMPONENT' component..."
SERVICE_GRPC_PORT=$(kubectl get service ${COMPONENT}service --namespace $TFS_K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.name=="grpc")].port}') SERVICE_GRPC_PORT=$(kubectl get service ${COMPONENT}service --namespace $TFS_K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.name=="grpc")].port}')
echo " '$COMPONENT' service port: $SERVICE_GRPC_PORT"
if [ -z "${SERVICE_GRPC_PORT}" ]; then if [ -z "${SERVICE_GRPC_PORT}" ]; then
printf "\n" printf "\n"
continue; continue;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
# this script opens the dashboard # this script opens the dashboard
K8S_NAMESPACE=${K8S_NAMESPACE:-'tf-dev'} K8S_NAMESPACE=${K8S_NAMESPACE:-'tfs'}
GRAFANA_IP=$(kubectl get service/webuiservice -n ${K8S_NAMESPACE} -o jsonpath='{.spec.clusterIP}') GRAFANA_IP=$(kubectl get service/webuiservice -n ${K8S_NAMESPACE} -o jsonpath='{.spec.clusterIP}')
GRAFANA_PORT=$(kubectl get service webuiservice-public --namespace $K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.port==3000)].nodePort}') GRAFANA_PORT=$(kubectl get service webuiservice-public --namespace $K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.port==3000)].nodePort}')
......
...@@ -14,10 +14,9 @@ ...@@ -14,10 +14,9 @@
# this script opens the webui # this script opens the webui
K8S_NAMESPACE=${K8S_NAMESPACE:-'tf-dev'} K8S_NAMESPACE=${K8S_NAMESPACE:-'tfs'}
WEBUI_SERVICE_NAME="webuiservice-public" WEBUI_SERVICE_NAME="webuiservice"
WEBUI_PROTO=`kubectl get service ${WEBUI_SERVICE_NAME} -n ${K8S_NAMESPACE} -o jsonpath='{.spec.ports[0].name}'`
WEBUI_IP=`kubectl get service ${WEBUI_SERVICE_NAME} -n ${K8S_NAMESPACE} -o jsonpath='{.spec.clusterIP}'` WEBUI_IP=`kubectl get service ${WEBUI_SERVICE_NAME} -n ${K8S_NAMESPACE} -o jsonpath='{.spec.clusterIP}'`
# WEBUI_PORT=$(kubectl get service ${WEBUI_SERVICE_NAME} --namespace $K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.port==8004)].nodePort}') # WEBUI_PORT=$(kubectl get service ${WEBUI_SERVICE_NAME} --namespace $K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.port==8004)].nodePort}')
WEBUI_PORT=8004 WEBUI_PORT=8004
...@@ -25,13 +24,13 @@ WEBUI_PORT=8004 ...@@ -25,13 +24,13 @@ WEBUI_PORT=8004
GRAFANA_PORT=3000 GRAFANA_PORT=3000
# Open WebUI # Open WebUI
URL=${WEBUI_PROTO}://${WEBUI_IP}:${WEBUI_PORT} UI_URL="http://${WEBUI_IP}:${WEBUI_PORT}"
echo Opening web UI on URL ${URL} echo "Opening web UI on URL ${UI_URL}"
# curl -kL ${URL} # curl -kL ${UI_URL}
python3 -m webbrowser ${URL} python3 -m webbrowser ${UI_URL}
# Open Dashboard # Open Dashboard
URL=${WEBUI_PROTO}://${WEBUI_IP}:${GRAFANA_PORT} DASHB_URL="http://${WEBUI_IP}:${GRAFANA_PORT}"
echo Opening Dashboard on URL ${URL} echo "Opening Dashboard on URL ${DASHB_URL}"
# curl -kL ${URL} # curl -kL ${DASHB_URL}
python3 -m webbrowser ${URL} python3 -m webbrowser ${DASHB_URL}
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
######################################################################################################################## ########################################################################################################################
# If not already set, set the name of the Kubernetes namespace to deploy to. # If not already set, set the name of the Kubernetes namespace to deploy to.
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs-dev"} export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"}
######################################################################################################################## ########################################################################################################################
# Automated steps start here # Automated steps start here
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
######################################################################################################################## ########################################################################################################################
# If not already set, set the name of the Kubernetes namespace to deploy to. # If not already set, set the name of the Kubernetes namespace to deploy to.
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs-dev"} export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"}
######################################################################################################################## ########################################################################################################################
# Automated steps start here # Automated steps start here
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
######################################################################################################################## ########################################################################################################################
# If not already set, set the name of the Kubernetes namespace to deploy to. # If not already set, set the name of the Kubernetes namespace to deploy to.
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs-dev"} export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"}
######################################################################################################################## ########################################################################################################################
# Automated steps start here # Automated steps start here
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
######################################################################################################################## ########################################################################################################################
# If not already set, set the name of the Kubernetes namespace to deploy to. # If not already set, set the name of the Kubernetes namespace to deploy to.
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs-dev"} export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"}
######################################################################################################################## ########################################################################################################################
# Automated steps start here # Automated steps start here
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
######################################################################################################################## ########################################################################################################################
# If not already set, set the name of the Kubernetes namespace to deploy to. # If not already set, set the name of the Kubernetes namespace to deploy to.
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs-dev"} export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"}
######################################################################################################################## ########################################################################################################################
# Automated steps start here # Automated steps start here
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
######################################################################################################################## ########################################################################################################################
# If not already set, set the name of the Kubernetes namespace to deploy to. # If not already set, set the name of the Kubernetes namespace to deploy to.
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs-dev"} export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"}
######################################################################################################################## ########################################################################################################################
# Automated steps start here # Automated steps start here
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
######################################################################################################################## ########################################################################################################################
# If not already set, set the name of the Kubernetes namespace to deploy to. # If not already set, set the name of the Kubernetes namespace to deploy to.
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs-dev"} export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"}
######################################################################################################################## ########################################################################################################################
# Automated steps start here # Automated steps start here
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
######################################################################################################################## ########################################################################################################################
# If not already set, set the name of the Kubernetes namespace to deploy to. # If not already set, set the name of the Kubernetes namespace to deploy to.
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs-dev"} export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"}
######################################################################################################################## ########################################################################################################################
# Automated steps start here # Automated steps start here
......
...@@ -70,7 +70,16 @@ sudo ufw default allow routed ...@@ -70,7 +70,16 @@ sudo ufw default allow routed
```bash ```bash
sudo usermod -a -G docker $USER sudo usermod -a -G docker $USER
sudo usermod -a -G microk8s $USER sudo usermod -a -G microk8s $USER
sudo chown -f -R $USER ~/.kube sudo chown -f -R $USER $HOME/.kube
sudo reboot
```
In case that the .kube file is not automatically provisioned into your home folder, you may follow the steps below:
```bash
mkdir -p $HOME/.kube
sudo chown -f -R $USER $HOME/.kube
microk8s config > $HOME/.kube/config
sudo reboot sudo reboot
``` ```
......
...@@ -32,6 +32,13 @@ eval "$(pyenv init -)" ...@@ -32,6 +32,13 @@ eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)" eval "$(pyenv virtualenv-init -)"
``` ```
In case .bashrc is not linked properly to your profile, you may need to append the following line into your local .profile file:
```bash
# Open ~/.profile and append this line:
+source "$HOME"/.bashrc
```
## 2.1.4. Restart the VM ## 2.1.4. Restart the VM
Restart the VM for all the changes to take effect. Restart the VM for all the changes to take effect.
...@@ -58,6 +65,13 @@ pyenv virtualenv 3.9.13 tfs ...@@ -58,6 +65,13 @@ pyenv virtualenv 3.9.13 tfs
pyenv local 3.9.13/envs/tfs pyenv local 3.9.13/envs/tfs
``` ```
In case that the correct pyenv does not get automatically activated when you change to the tfs-ctrl/ folder, then execute the following command:
```bash
cd ~/tfs-ctrl
pyenv activate 3.9.13/envs/tfs
```
After completing these commands, you should see in your prompt that now you're within the virtual environment After completing these commands, you should see in your prompt that now you're within the virtual environment
`3.9.13/envs/tfs` on folder `~/tfs-ctrl`: `3.9.13/envs/tfs` on folder `~/tfs-ctrl`:
``` ```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment