diff --git a/.github/workflows/build_and_scan_rocks.yaml b/.github/workflows/build_and_scan_rocks.yaml index bb84dbf..3f6a73d 100644 --- a/.github/workflows/build_and_scan_rocks.yaml +++ b/.github/workflows/build_and_scan_rocks.yaml @@ -24,6 +24,7 @@ jobs: - kfam - notebook-controller - volumes-web-app + - tensorboards-web-app uses: canonical/charmed-kubeflow-workflows/.github/workflows/build_and_scan_rock.yaml@main with: rock: ${{ matrix.rock }} diff --git a/tensorboards-web-app/rockcraft.yaml b/tensorboards-web-app/rockcraft.yaml new file mode 100644 index 0000000..8c44234 --- /dev/null +++ b/tensorboards-web-app/rockcraft.yaml @@ -0,0 +1,122 @@ +name: tensorboards-web-app +summary: Tensorboards Web App +description: | + This web app is responsible for allowing the user to manipulate Tensorboard + instances in their Kubeflow cluster. To achieve this it provides a user + friendly way to handle the lifecycle of Tensorboard CRs. +version: v1.7.0_1 +license: Apache-2.0 +base: ubuntu:20.04 + +services: + serve: + override: replace + summary: "tensorboards service" + command: gunicorn -w 3 --bind 0.0.0.0:5000 --access-logfile - entrypoint:app + startup: enabled + user: ubuntu + environment: + NODE_ENV: production +platforms: + amd64: + +parts: + security-team-requirement: + plugin: nil + override-build: | + mkdir -p ${CRAFT_PART_INSTALL}/usr/share/rocks + (echo "# os-release" && cat /etc/os-release && echo "# dpkg-query" && dpkg-query -f '${db:Status-Abbrev},${binary:Package},${Version},${source:Package},${Source:Version}\n' -W) > ${CRAFT_PART_INSTALL}/usr/share/rocks/dpkg.query + + backend: + plugin: nil + source: https://github.com/kubeflow/kubeflow + source-type: git + source-tag: v1.7-branch # upstream branch + source-depth: 1 + build-packages: + - python3-venv + - python3-setuptools + - python3-pip + override-build: | + python3 -m pip install wheel + cd components/crud-web-apps/common/backend + python3 setup.py bdist_wheel + # XXX: Upstream has a hardcoded/dummy version=1.1 in setup.py + cp dist/kubeflow-1.1-py3-none-any.whl $CRAFT_STAGE + + frontend-lib: + plugin: nil + source: https://github.com/kubeflow/kubeflow + source-type: git + source-tag: v1.7-branch # upstream branch + source-depth: 1 + build-snaps: + - node/12/stable + build-environment: + - NG_CLI_ANALYTICS: "ci" + override-build: | + cd components/crud-web-apps/common/frontend/kubeflow-common-lib + npm ci + npm run build + cp -r dist/kubeflow/ $CRAFT_STAGE + + frontend: + after: [frontend-lib] + plugin: nil + source: https://github.com/kubeflow/kubeflow + source-type: git + source-tag: v1.7-branch # upstream branch + source-depth: 1 + build-snaps: + - node/12/stable + build-environment: + - NG_CLI_ANALYTICS: "ci" + override-build: | + cd components/crud-web-apps/tensorboards/frontend + npm ci + cp -r $CRAFT_STAGE/kubeflow/ ./node_modules/ # TODO confirm + npm run build -- --output-path=./dist --configuration=production + cp -r dist $CRAFT_STAGE + + webapp: + after: [backend, frontend] + plugin: nil + source: https://github.com/kubeflow/kubeflow + source-type: git + source-tag: v1.7-branch # upstream branch + source-depth: 1 + build-packages: + - python3-venv + - python3-setuptools + - python3-pip + override-build: | + pip3 install $CRAFT_STAGE/kubeflow-1.1-py3-none-any.whl + cd components/crud-web-apps/tensorboards/backend + cp -r $CRAFT_STAGE/dist/ app/static/ + cp -r app $CRAFT_STAGE/ + cp entrypoint.py $CRAFT_STAGE + override-stage: | + cp -r app $CRAFT_PRIME + cp entrypoint.py $CRAFT_PRIME + # XXX: Ubuntu 20.04 has Python 3.8 + cp -r /usr/local/lib/python3.8/dist-packages/* $CRAFT_PRIME + + gunicorn: + plugin: python + source: https://github.com/kubeflow/kubeflow.git + source-tag: v1.7-branch # upstream branch + source-depth: 1 + python-requirements: + - components/crud-web-apps/tensorboards/backend/requirements.txt + stage-packages: + - python3-venv + + non-root-user: + plugin: nil + after: [ubuntu] + overlay-script: | + # Create a user in the $CRAFT_OVERLAY chroot + groupadd -R $CRAFT_OVERLAY -g 1001 ubuntu + useradd -R $CRAFT_OVERLAY -M -r -u 1001 -g ubuntu ubuntu + override-prime: | + craftctl default