From a43c75ed486cb4943b85f0d95dc87ac8a92b377a Mon Sep 17 00:00:00 2001 From: Nathan Sculli Date: Tue, 28 May 2024 14:49:00 -0700 Subject: [PATCH 1/5] ADD custom docker file to inject our ui --- Dockerfile | 40 ++++++++++++++++++++++++++++++++++++++++ README-tensorwave.md | 19 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 Dockerfile create mode 100644 README-tensorwave.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000000..60dfbad345e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,40 @@ +# syntax=docker/dockerfile:1 + +# Stage 1: Build the Rancher UI +FROM node:17-alpine as build-stage + +# Create the app directory +RUN mkdir -p /rancher-ui + +# Set the working directory +WORKDIR /rancher-ui + +# Copy the package.json and yarn.lock files +COPY package.json ./ +COPY yarn.lock ./ + +# Copy the source code +COPY pkg ./pkg +COPY shell ./shell + +# Copy the configuration files +COPY .eslint* ./ +COPY babel.config.js ./ +COPY svgTransform.js ./ +COPY tsconfig.json tsconfig.paths.json ./ +COPY vue-shim.d.ts vue.config.js ./ + +# Install the dependencies +RUN yarn install + +# Build the Rancher UI +# Make sure we use the proper SSL provider +RUN NODE_OPTIONS="--openssl-legacy-provider --max_old_space_size=4096" \ + ./node_modules/.bin/vue-cli-service build --mode production + +# https://github.com/rancher/dashboard/blob/master/docs/developer/build-methods/build-for-container-registry.md +FROM rancher/rancher:v2.8-head +WORKDIR /var/lib/rancher + +RUN rm -rf /usr/share/rancher-ui/ui-dashboard/dashboard* +COPY --from=build-stage /rancher-ui/dist /usr/share/rancher/ui-dashboard/dashboard diff --git a/README-tensorwave.md b/README-tensorwave.md new file mode 100644 index 00000000000..f733eccb691 --- /dev/null +++ b/README-tensorwave.md @@ -0,0 +1,19 @@ +## Installation + +You will need to install the following packages: +```sh +yarn add --dev @vue/cli-plugin-babel +yarn add --dev @babel/plugin-proposal-class-properties +``` + +## Development + +I'm not sure which version of Node is actually required but... to get the development service up and running you will need to set the following Node option: +```sh +set NODE_OPTIONS=--openssl-legacy-provider +``` + +The following line should bring up a development environment. ***NOTE***: The `API` option MUST point to a running Rancher API instance: +```sh +NODE_OPTIONS=--openssl-legacy-provider API=https://rancher.18.236.138.233.sslip.io yarn dev +``` From 656bf47eea303b76a866377b315b72fdba9c2227 Mon Sep 17 00:00:00 2001 From: Nathan Sculli Date: Thu, 30 May 2024 10:24:11 -0700 Subject: [PATCH 2/5] FIX: Add required ENVs to Dockerfile --- Dockerfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Dockerfile b/Dockerfile index 60dfbad345e..28381799262 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,6 +27,9 @@ COPY vue-shim.d.ts vue.config.js ./ # Install the dependencies RUN yarn install +ENV ROUTER_BASE="/dashboard/" \ + RESOURCE_BASE="/dashboard/" + # Build the Rancher UI # Make sure we use the proper SSL provider RUN NODE_OPTIONS="--openssl-legacy-provider --max_old_space_size=4096" \ @@ -38,3 +41,6 @@ WORKDIR /var/lib/rancher RUN rm -rf /usr/share/rancher-ui/ui-dashboard/dashboard* COPY --from=build-stage /rancher-ui/dist /usr/share/rancher/ui-dashboard/dashboard + +ENV CATTLE_UI_OFFLINE_PREFERRED=true \ + CATTLE_UI_DASHBOARD_INDEX="https://localhost/dashboard/index.html From 8eb349a108b5d4936ebf1ce00b835283bf56d0af Mon Sep 17 00:00:00 2001 From: Nathan Sculli Date: Thu, 30 May 2024 10:51:40 -0700 Subject: [PATCH 3/5] FIX: syntax error --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 28381799262..af1fa90f80c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,4 +43,4 @@ RUN rm -rf /usr/share/rancher-ui/ui-dashboard/dashboard* COPY --from=build-stage /rancher-ui/dist /usr/share/rancher/ui-dashboard/dashboard ENV CATTLE_UI_OFFLINE_PREFERRED=true \ - CATTLE_UI_DASHBOARD_INDEX="https://localhost/dashboard/index.html + CATTLE_UI_DASHBOARD_INDEX="https://localhost/dashboard/index.html" From 3f3759e4ffebaeef176d41fc13717ed7d11806bc Mon Sep 17 00:00:00 2001 From: Nathan Sculli Date: Tue, 11 Jun 2024 15:25:20 -0700 Subject: [PATCH 4/5] Add docker-compose.yml --- docker-compose.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000000..b51e8f44102 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,20 @@ +version: '3.8' + +services: + dashboard: + image: scull7/tensorwave-rancher:latest + # image: scull7/tensorwave-rancher:v1-arm64 # for arm64 / Mac M1 + container_name: dashboard + restart: unless-stopped + privileged: true + volumes: + - rancher_data:/var/lib/rancher + ports: + - "80:80" + - "443:443" + environment: + - CATTLE_UI_DASHBOARD_INDEX=https://localhost/dashboard/index.html + - CATTLE_UI_OFFLINE_PREFERRED=true +volumes: + rancher_data: + driver: local From 35071f7c8e2ddc501a68e0abb4f285cd4c864f64 Mon Sep 17 00:00:00 2001 From: Nathan Sculli Date: Tue, 11 Jun 2024 15:56:35 -0700 Subject: [PATCH 5/5] Update the readme file with the helm instructions --- README-tensorwave.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/README-tensorwave.md b/README-tensorwave.md index f733eccb691..0acbb129233 100644 --- a/README-tensorwave.md +++ b/README-tensorwave.md @@ -17,3 +17,34 @@ The following line should bring up a development environment. ***NOTE***: The ` ```sh NODE_OPTIONS=--openssl-legacy-provider API=https://rancher.18.236.138.233.sslip.io yarn dev ``` + +## Deployment to Docker (local) + +Run docker compose on the docker-compose.yml file found in the base of this repository: +```sh +docker-compose up -d -f ./docker-compose.yml +``` + +## Deployment to Kubernetes + +1. Add the [Rancher Helm Chart] repository: +```sh +helm repo add rancher-stable https://releases.rancher.com/server-charts/stable +``` + +2. Install the [Rancher Helm Chart] you should use something similar to the following command: +```sh +helm install rancher rancher-latest/rancher \ + --namespace cattle-system \ + --set ingress.tls.source=letsEncrypt \ + --set hostname= \ + --set bootstrapPassword= \ + --set rancherImage=scull7/tensorwave-rancher \ + --set rancherImageTag=latest +``` +NOTE: The 2 most important options here are `rancherImage` and `rancherImageTag`. +These options are used to specify the image that will be used to run the Rancher server. +The `rancherImage` option should be set to the image that you want to use (i.e. the Tensorwave Version) and +the `rancherImageTag` option should be set to the tag of the image that you want to use (i.e. `latest`). + +[Rancher Helm Chart]: https://artifacthub.io/packages/helm/rancher-stable/rancher