diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index 3fd25346..00000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "customizations": { - "codespaces": { - "repositories": { - "cs3org/ocm-test-suite": { - "permissions": { - "contents": "write", - "pull_requests": "write" - } - }, - "cs3org/reva": { - "permissions": { - "contents": "write", - "pull_requests": "write" - } - }, - "michielbdejong/ocm-stub": { - "permissions": { - "contents": "write", - "pull_requests": "write" - } - }, - "sciencemesh/nc-sciencemesh": { - "permissions": { - "contents": "write", - "pull_requests": "write" - } - }, - "sciencemesh/oc-sciencemesh": { - "permissions": { - "contents": "write", - "pull_requests": "write" - } - } - } - } - } -} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 6deef920..96177b2f 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ servers/apache-php-7.4/tls servers/apache-php-8.0/tls servers/revad/tls servers/ci/tls +charts +Chart.lock diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..9e26dfee --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 00000000..57c2075e --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,135 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail + +. ./common.sh + +# Kubernetes Dashboard admin-user token. +DASHBOARD_TOKEN="" + +function build_push_images() { + ( + echo "🐳 Building & publishing Docker images in Kubernetes registry" + ( + ./build-images.sh + ) || (echo "❗️ Failed publish docker images.." && exit 1) + ) | indent +} + +function install_k8s_dashboard() { + ( + echo "πŸ–₯️ Installing Kubernetes Dashboard" + ( + kubectl get namespaces kubernetes-dashboard 2>&1 >/dev/null && echo "βœ… Already installed." | indent && return || + kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml | indent_cli && + kubectl apply -f ./k8s/kubernetes-dashboard/dashboard-adminuser.yaml | indent_cli + ) || (echo "❗️ Failed to install Kubernetes Dashboard. You can set this up later..." | indent) + ) | indent + + DASHBOARD_TOKEN=$(kubectl -n kubernetes-dashboard create token admin-user) +} + +function install_k8s_ingress_controller() { + ( + echo "πŸ”€ Installing Nginx ingress controller" + ( + helm -n ingress-nginx list | grep 'ingress-nginx' 2>&1 >/dev/null && echo "βœ… Already installed." | indent && return || + helm upgrade --install ingress-nginx ingress-nginx/ingress-nginx \ + -n ingress-nginx --create-namespace 2>&1 >/dev/null && echo "βœ… Ingress controller installed successfully" | indent + ) || (echo "❌ Failed to set up ingress controller" && exit 1) + ) | indent +} + +function fetch_repositories() { + ( + ( + mkdir -p workspace/ && + clone_repo https://github.com/pondersource/nc-sciencemesh workspace/nc-sciencemesh && + clone_repo https://github.com/cs3org/reva workspace/revad master && + clone_repo https://github.com/michielbdejong/ocm-stub workspace/ocm-stub + ) || (echo "❌ Failed to set up repositories" && exit 1) + ) | indent +} + +function configure_helm() { + ( + ( + echo "πŸ“¦ Configuring Helm Chart repositories" && + helm_add owncloud https://owncloud-docker.github.io/helm-charts && + helm_add nextcloud https://nextcloud.github.io/helm/ && + helm_add cs3org https://cs3org.github.io/charts/ && + helm_add bitnami https://charts.bitnami.com/bitnami && + helm_add ingress-nginx https://kubernetes.github.io/ingress-nginx + ) || (echo "❌ Failed to configure helm repositories" && exit 1) + ) | indent +} + +function is_installed() { + ( + if [ -x "$(command -v "$1")" ]; then + echo "βœ… $1 is properly installed" + else + echo "❌ Install $1 before running this script" + exit 1 + fi + ) | indent +} + +echo +echo "🩻 Performing system checks" + +is_installed docker +is_installed docker-compose +is_installed git +is_installed helm +is_installed kubectl + +( + ($docker ps 2>&1 >/dev/null && echo "βœ… Docker is properly executable") || + (echo "❌ Cannot run docker ps, you might need to check that your user is able to use docker properly" && exit 1) +) | indent + +( + (kubectl version | grep 'Server Version:' 2>&1 >/dev/null && echo "βœ… Kubernetes cluster is running properly") || + (echo "❌ Kubernetes cluster is not running properly. Please refer e.g. to https://rancherdesktop.io on how to set-up a single-node Kubernetes cluster." && exit 1) +) | indent + +echo +echo "πŸ—„οΈ Setting up folder structure and fetching repositories" +fetch_repositories + +echo +echo "☸️ Setting up Kubernetes environment" +build_push_images +configure_helm +ask "install k8s dashboard" install_k8s_dashboard +ask "install nginx ingress controller" install_k8s_ingress_controller + +cat <&1 >/dev/null | indent_cli + ) +done diff --git a/build.sh b/build.sh deleted file mode 100755 index c45c5702..00000000 --- a/build.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -docker build -t tester . -# cd ocm-stub -# docker build -t stub . -# cd .. -cd servers/revad -docker build -t revad . -cd ../apache-php-7.4 -docker build -t apache-php-7.4 . -cd ../apache-php-8.0 -docker build -t apache-php-8.0 . -cd ../nextcloud -docker build -t nextcloud . -cd ../nc1 -docker build -t nc1 . -cd ../nc2 -docker build -t nc2 . -# cd ../owncloud -# docker build -t owncloud . -# cd ../oc1 -# docker build -t oc1 . -# cd ../oc2 -# docker build -t oc2 . diff --git a/cleanup.sh b/cleanup.sh new file mode 100755 index 00000000..694d1d71 --- /dev/null +++ b/cleanup.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +SCENARIO_DIR=$1 +TEST_DIR=./k8s/tests + +scenarios=("$(find ${TEST_DIR} -name 'cleanup.sh' -type f -exec dirname {} \;)") + +# If no cleanup.sh found, exit +if [ ${#scenarios[@]} -eq 0 ]; then + echo "πŸ€·πŸ½β€β™‚οΈ No test scenarios found." + exit 1 +fi + +options=() +for d in $scenarios; do + options+=("$d ($(head -n 2 "$d/NOTES.txt" | tail -1))") +done + +# Prompt user to select a directory +if [ -z "$SCENARIO_DIR" ]; then + echo "πŸ“ Select a test scenario to uninstall:" + select opt in "${options[@]}"; do + if [[ "$REPLY" =~ ^[0-9]+$ ]]; then + dir=$(echo "$opt" | cut -d " " -f1) + + echo + echo "πŸš€ Uninstalling test scenario" $(echo "$opt" | cut -d ' ' -f1) + break + else + echo "Invalid selection. Please try again." + fi + done + SCENARIO_DIR=$dir +fi + +cd "$SCENARIO_DIR" && ./cleanup.sh && ( + echo 'βœ… Unistalled successfully!' +) || echo '❌ Failed to uninstall' diff --git a/common.sh b/common.sh new file mode 100755 index 00000000..c1582d83 --- /dev/null +++ b/common.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail + +docker=${DOCKER_PATH:-docker} + +function indent() { + sed 's/^/ /' +} + +function indent_cli() { + if [[ "$OSTYPE" == "darwin"* ]]; then + sed -l 's/^/ > /' + else + sed -u 's/^/ > /' + fi +} + +function helm_add() { + ( + (helm repo add "$1" "$2" 2>&1 >/dev/null && echo "βœ… $1 repo configured successfully") || + (echo "❌ Failed to configure repo $1" && exit 1) + ) | indent +} + +function ask() { + read -r -p "❓ Do you want to ${1}? (y/n) " yn + + case $yn in + [yY]) + "${2}" + return + ;; + [nN]) + return + ;; + *) echo invalid response ;; + esac +} + +function is_installed() { + ( + if [ -x "$(command -v "$1")" ]; then + echo "βœ… $1 is properly installed" + else + echo "❌ Install $1 before running this script" + exit 1 + fi + ) | indent +} + +function clone_repo() { + URL=$1 + NAME=$2 + BRANCH=${3:-main} + + if [ -d "${NAME}" ]; then + echo "βœ… Repository ${NAME} already present Pulling latest changes..." + (cd "$NAME" && git pull) + return + fi + + echo "🌏 Fetching 𓆱 ${BRANCH} of ${NAME}" + ( + git clone -b "${BRANCH}" "${URL}" "${NAME}" 2>&1 | indent_cli + ) || (echo "❌ Failed to clone ${NAME}" | indent && exit 1) +} diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 00000000..abe52137 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +SCENARIO_DIR=$1 +TEST_DIR=./k8s/tests + +scenarios=("$(find ${TEST_DIR} -name 'deploy.sh' -type f -exec dirname {} \;)") + +# If no deploy.sh found, exit +if [ ${#scenarios[@]} -eq 0 ]; then + echo "πŸ€·πŸ½β€β™‚οΈ No test scenarios found." + exit 1 +fi + +options=() +for d in $scenarios; do + options+=("$d ($(head -n 2 "$d/NOTES.txt" | tail -1))") +done + +if [ -z "$SCENARIO_DIR" ]; then + # Prompt user to select a directory + echo "πŸ“ Select a test scenario to deploy:" + select opt in "${options[@]}"; do + if [[ "$REPLY" =~ ^[0-9]+$ ]]; then + dir=$(echo "$opt" | cut -d " " -f1) + + echo + echo "πŸš€ Deploying test scenario" $(echo "$opt" | cut -d ' ' -f1) + echo + break + else + echo "Invalid selection. Please try again." + fi + done + + SCENARIO_DIR=$dir +fi + +echo +shift +cd "$SCENARIO_DIR" && ./deploy.sh "$@" && ( + echo 'βœ… Scenario successfully Deployed!' && ( + test -f NOTES.txt && cat NOTES.txt || echo + ) +) || echo '❌ Failed to deploy' diff --git a/ingress-proxy.sh b/ingress-proxy.sh new file mode 100755 index 00000000..f0dc1ca4 --- /dev/null +++ b/ingress-proxy.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env sh + +INGRESS_NAMESPACE=${1:-ingress-nginx} +INGRESS_SERVICE=${2:-ingress-nginx-controller} + +echo +echo "πŸ”Œ Proxying connections to ${INGRESS_NAMESPACE}/${INGRESS_SERVICE} ports 80, 443" +echo + +kubectl port-forward --namespace="${INGRESS_NAMESPACE}" service/"${INGRESS_SERVICE}" 8080:80 8443:443 diff --git a/k8s/central-component/Chart.yaml b/k8s/central-component/Chart.yaml new file mode 100644 index 00000000..c3c98eac --- /dev/null +++ b/k8s/central-component/Chart.yaml @@ -0,0 +1,7 @@ +apiVersion: v2 +name: central-component +description: Central Component services of the Science Mesh project. +type: application +version: 0.0.1 +appVersion: 2.0.1 +home: https://developer.sciencemesh.io/ diff --git a/k8s/central-component/build.sh b/k8s/central-component/build.sh new file mode 100755 index 00000000..827c1f3f --- /dev/null +++ b/k8s/central-component/build.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env sh +. ../../common.sh + +helm dependency update +helm dependency build diff --git a/k8s/central-component/templates/NOTES.txt b/k8s/central-component/templates/NOTES.txt new file mode 100644 index 00000000..b6350572 --- /dev/null +++ b/k8s/central-component/templates/NOTES.txt @@ -0,0 +1,8 @@ +----------------------------------------------------------------- +[{{ .Release.Namespace}}]: Deployed {{ .Release.Name }} +----------------------------------------------------------------- + +You can access it from: +http://{{ .Values.owncloud.owncloud.domain }}:8080/ + +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- diff --git a/k8s/central-component/templates/deployment.yaml b/k8s/central-component/templates/deployment.yaml new file mode 100644 index 00000000..161075b6 --- /dev/null +++ b/k8s/central-component/templates/deployment.yaml @@ -0,0 +1,42 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: iop-meshdirectory + project: iop-meshdirectory + name: iop-meshdirectory +spec: + replicas: 1 + selector: + matchLabels: + app: iop-meshdirectory + project: iop-meshdirectory + template: + metadata: + labels: + app: iop-meshdirectory + project: iop-meshdirectory + spec: + containers: + - command: + - yarn + args: + - run + - start + image: apps.du.cesnet.cz/meshdirectory-web:2.0.0 + imagePullPolicy: Always + name: meshdirectory + env: + - name: "IOP_HOST" + value: "sciencemesh.cesnet.cz:443" + - name: "PROVIDERS_API" + value: "https://iop.sciencemesh.uni-muenster.de/iop/mentix/cs3" + ports: + - containerPort: 3000 + protocol: TCP + resources: {} + restartPolicy: Always + securityContext: {} + terminationGracePeriodSeconds: 30 + imagePullSecrets: + - name: regcred \ No newline at end of file diff --git a/k8s/kubernetes-dashboard/dashboard-adminuser.yaml b/k8s/kubernetes-dashboard/dashboard-adminuser.yaml new file mode 100644 index 00000000..c6840e92 --- /dev/null +++ b/k8s/kubernetes-dashboard/dashboard-adminuser.yaml @@ -0,0 +1,20 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: admin-user + namespace: kubernetes-dashboard + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: admin-user +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: cluster-admin +subjects: + - kind: ServiceAccount + name: admin-user + namespace: kubernetes-dashboard diff --git a/k8s/owncloud/.helmignore b/k8s/owncloud/.helmignore new file mode 100644 index 00000000..5303e15d --- /dev/null +++ b/k8s/owncloud/.helmignore @@ -0,0 +1,2 @@ +apps +docker diff --git a/k8s/owncloud/Chart.yaml b/k8s/owncloud/Chart.yaml new file mode 100644 index 00000000..12fcdef6 --- /dev/null +++ b/k8s/owncloud/Chart.yaml @@ -0,0 +1,28 @@ +apiVersion: v2 +name: owncloud +description: Helm chart for ScienceMesh-enabled owncloud +type: application +version: 0.1.0 +appVersion: 0.1.0 +home: https://sciencemesh.io/ +sources: + - https://github.com/owncloud-docker/helm-charts + - https://github.com/cs3org/charts + - http://github.com/bitnami/charts +dependencies: + - name: revad + version: 0.1.0 + repository: 'file://../revad' + alias: gateway + # TODO: sqlite will do for now + # - name: mariadb + # repository: https://charts.bitnami.com/bitnami + # version: 11.4.6 + # alias: db + - name: redis + repository: https://charts.bitnami.com/bitnami + version: 17.7.2 + alias: cache + - name: owncloud + version: 0.4.0 + repository: https://owncloud-docker.github.io/helm-charts diff --git a/k8s/owncloud/Dockerfile b/k8s/owncloud/Dockerfile new file mode 100644 index 00000000..41ad69f3 --- /dev/null +++ b/k8s/owncloud/Dockerfile @@ -0,0 +1,47 @@ +ARG SERVER_VERSION=10.10 +ARG PHP_VERSION=20.04 + +FROM owncloud/server:${SERVER_VERSION} AS server-base +WORKDIR /var/www/owncloud + +COPY ./docker/post_install.d/ /etc/post_install.d/ +RUN chmod u+x -R /etc/post_install.d/ + +# Apply the sciencemesh sharing patch && install the app +RUN apt update && apt install -y patch +RUN curl -sL https://patch-diff.githubusercontent.com/raw/owncloud/core/pull/40577.diff | patch -p1 -t --forward --no-backup-if-mismatch || true +RUN apt remove -y patch && apt autoremove + +# Fetches the latest git master version of the sciencemesh app +FROM owncloud/php:${PHP_VERSION} AS sciencemesh-base +RUN apt update && apt install -y make git nodejs npm patch +RUN mkdir /tmp/build + +FROM sciencemesh-base AS sciencemesh-git +ARG CACHEBUST=1 +ENV SCIENCEMESH_APP_SOURCE="https://github.com/pondersource/oc-sciencemesh.git" +RUN git clone "${SCIENCEMESH_APP_SOURCE}" /tmp/build/sciencemesh +WORKDIR /tmp/build/sciencemesh +RUN ./release.sh +WORKDIR /tmp/build/sciencemesh/release +RUN tar -xzf sciencemesh.tar.gz + +FROM sciencemesh-base AS sciencemesh-dev +ARG CACHEBUST=1 +COPY ./apps/sciencemesh /tmp/build/sciencemesh +WORKDIR /tmp/build/sciencemesh +RUN ./release.sh +WORKDIR /tmp/build/sciencemesh/release +RUN tar -xzf sciencemesh.tar.gz + +FROM server-base as server-git +ARG CACHEBUST=1 +COPY --from=sciencemesh-git /tmp/build/sciencemesh/release/sciencemesh ./apps/sciencemesh +RUN find /var/www/owncloud \( \! -user www-data -o \! -group root \) -print0 | xargs -r -0 chown www-data:root +WORKDIR /var/www/owncloud + +FROM server-base as server-dev +ARG CACHEBUST=1 +COPY --from=sciencemesh-dev /tmp/build/sciencemesh/release/sciencemesh ./apps/sciencemesh +RUN find /var/www/owncloud \( \! -user www-data -o \! -group root \) -print0 | xargs -r -0 chown www-data:root +WORKDIR /var/www/owncloud diff --git a/k8s/owncloud/build.sh b/k8s/owncloud/build.sh new file mode 100755 index 00000000..7b67218a --- /dev/null +++ b/k8s/owncloud/build.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env sh +export SERVER_VERSION=10.10 +export PHP_VERSION=20.04 +export TARGET=server-dev + +. ../../common.sh + +helm dependency update +helm dependency build + +clone_repo https://github.com/pondersource/oc-sciencemesh apps/sciencemesh + +export DOCKER_BUILDKIT=1 && $docker build . \ + --target $TARGET \ + --build-arg BUILDKIT_INLINE_CACHE=1 SERVER_VERSION=$SERVER_VERSION PHP_VERSION=$PHP_VERSION \ + --tag sciencemesh-owncloud:"${SERVER_VERSION}" diff --git a/k8s/owncloud/docker/post_install.d/10-configure_extras.sh b/k8s/owncloud/docker/post_install.d/10-configure_extras.sh new file mode 100755 index 00000000..c2cd24ff --- /dev/null +++ b/k8s/owncloud/docker/post_install.d/10-configure_extras.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# Configures any extra settings that are not supported neither by the Helm chart or the owncloud/server image. + +# Read any configExtras into a variable +configExtras=$(php -r 'include("config/configmap.config.php"); echo json_encode($CONFIG);') + +# Extract the values of iopUrl and revaSharedSecret from the JSON-encoded configExtras +iopUrl=$(echo "$configExtras" | jq -r '.sciencemesh.iopUrl') +revaSharedSecret=$(echo "$configExtras" | jq -r '.sciencemesh.revaSharedSecret') + +# Switch to www-data user and set the config extras to the config db +su www-data -c "php occ config:system:set sharing.remoteShareesSearch --value 'OCA\ScienceMesh\Plugins\ScienceMeshSearchPlugin'" +su www-data -c "php occ config:app:set sciencemesh iopUrl --value $iopUrl" +su www-data -c "php occ config:app:set sciencemesh revaSharedSecret --value $revaSharedSecret" diff --git a/k8s/owncloud/templates/NOTES.txt b/k8s/owncloud/templates/NOTES.txt new file mode 100644 index 00000000..42cb1975 --- /dev/null +++ b/k8s/owncloud/templates/NOTES.txt @@ -0,0 +1,12 @@ +----------------------------------------------------------------- +[{{ .Release.Namespace}}]: Deployed {{ .Release.Name }} {{ .Values.owncloud.image.tag }} \w sciencemesh app & patches +----------------------------------------------------------------- + +You can access it from: +http://{{ .Values.owncloud.owncloud.domain }}:8080/ + +Default admin user credentials: +Username: {{ .Values.owncloud.owncloud.adminUsername }} +Password: {{ .Values.owncloud.owncloud.adminPassword }} + +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- diff --git a/k8s/owncloud/values.yaml b/k8s/owncloud/values.yaml new file mode 100644 index 00000000..c9158dba --- /dev/null +++ b/k8s/owncloud/values.yaml @@ -0,0 +1,62 @@ +# Default values for ownCloud deployment +# ====================================== + +owncloud: + image: + # Image built by ./build.sh + repository: sciencemesh-owncloud + tag: '10.10' + ingress: + enabled: true + className: nginx + service: + type: ClusterIP + owncloud: + adminPassword: oc-password + adminUsername: oc-admin + allowUserToChangeDisplayName: false + apps: + install: 'calendar contacts files_mediaviewer files_pdfviewer files_texteditor impersonate oauth2 templateeditor' + enable: 'sciencemesh' + configExtra: + allow_user_to_change_mail_address: false + # TODO: sqlite will do for now + # db: + # host: owncloud-db + # name: owncloud + # username: owncloud-db-user + # password: owncloud-db-password + # type: mysql + domain: owncloud.localdev.me + enablePreviews: true + enabledPreviewProviders: 'OC\\Preview\\PNG,OC\\Preview\\JPEG' + integrityIgnoreMissingAppSignature: 'sciencemesh' + log: + level: debug + redis: + enabled: true + host: owncloud-cache-master + password: owncloud-redis-password + secret: owncloud-secret-123 + # sharingManagerFactory: 'OCA\\ScienceMesh\\ScienceMeshProviderFactory' + timezone: 'Europe/Prague' + persistence: + enabled: false + +cache: + architecture: standalone + auth: + password: owncloud-redis-password + master: + persistence: + enabled: false +# TODO: sqlite will do for now +# db: +# auth: +# username: owncloud-db-user +# password: owncloud-db-password +# database: owncloud +# rootPassword: owncloud-mariadb-root-pw +# primary: +# persistence: +# enabled: false diff --git a/k8s/revad/.helmignore b/k8s/revad/.helmignore new file mode 100644 index 00000000..82a5fa49 --- /dev/null +++ b/k8s/revad/.helmignore @@ -0,0 +1,2 @@ +./charts +Chart.lock diff --git a/k8s/revad/Chart.yaml b/k8s/revad/Chart.yaml new file mode 100644 index 00000000..aa9bbae6 --- /dev/null +++ b/k8s/revad/Chart.yaml @@ -0,0 +1,12 @@ +apiVersion: v2 +name: revad +description: Helm chart for reva gateway deployment +type: application +version: 0.1.0 +appVersion: 0.1.0 +home: https://sciencemesh.io/ + - https://github.com/cs3org/charts +dependencies: + - name: revad + version: '1.6.0' + repository: 'https://github.com/mirekys/cs3org-charts' diff --git a/k8s/revad/build.sh b/k8s/revad/build.sh new file mode 100755 index 00000000..da09d6e0 --- /dev/null +++ b/k8s/revad/build.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. ../../common.sh + +helm dependency build diff --git a/k8s/revad/values.yaml b/k8s/revad/values.yaml new file mode 100644 index 00000000..f87b7ea3 --- /dev/null +++ b/k8s/revad/values.yaml @@ -0,0 +1,62 @@ +# Default values for Reva gateway +# =============================== +revad: + ingress: + enabled: true + services: + http: + annotations: + kubernetes.io/ingress.class: 'nginx' + grpc: + annotations: + kubernetes.io/ingress.class: 'nginx' + config: + log: + level: debug + shared: + jwt_secret: ocm-test-suite-test-123 + grpc: + services: + authprovider: + auth_manager: nextcloud + gateway: + commit_share_to_storage_grant: false + commit_share_to_storage_ref: true + transfer_expires: 6 + ocmcore: + driver: nextcloud + ocmproviderauthorizer: + drivers: + json: + verify_request_hostname: false + ocmshareprovider: + driver: nextcloud + preferences: {} + publicshareprovider: + driver: memory + storageprovider: + driver: nextcloud + expose_data_server: true + enable_home_creation: true + userprovider: + driver: nextcloud + usershareprovider: + driver: memory + http: + services: + dataprovider: + driver: nextcloud + ocdav: + prefix: ocdav + ocmd: + prefix: ocm + ocs: + prefix: ocs + prometheus: {} + sysinfo: {} + middlewares: + cors: {} + providerauthorizer: + drivers: + json: + verify_request_hostname: false diff --git a/k8s/tests/nc2oc/NOTES.txt b/k8s/tests/nc2oc/NOTES.txt new file mode 100644 index 00000000..2cd8f788 --- /dev/null +++ b/k8s/tests/nc2oc/NOTES.txt @@ -0,0 +1,13 @@ +------------------------------- +Nextcloud 25 <=> ownCloud 10.10 +------------------------------- + +# Nextcloud apps: + +- nc-sciencemesh: pondersource/master +- reva: v1.2.1 + +# ownCloud apps: + +- oc-sciencemesh: pondersource/master +- reva: v1.2.1 diff --git a/k8s/tests/nc2oc/cleanup.sh b/k8s/tests/nc2oc/cleanup.sh new file mode 100755 index 00000000..3712bdf1 --- /dev/null +++ b/k8s/tests/nc2oc/cleanup.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env sh +helm uninstall -n oc-site owncloud +helm uninstall -n nc-site nextcloud + +kubectl delete namespaces oc-site nc-site diff --git a/k8s/tests/nc2oc/deploy.sh b/k8s/tests/nc2oc/deploy.sh new file mode 100755 index 00000000..bb54fdbf --- /dev/null +++ b/k8s/tests/nc2oc/deploy.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env sh +# helm install -n nc-site --dry-run --debug --create-namespace nextcloud -f nc.yaml ../../sciencemesh-site +helm upgrade -i -n oc-site --create-namespace owncloud -f oc.yaml ../../owncloud diff --git a/k8s/tests/nc2oc/nc.yaml b/k8s/tests/nc2oc/nc.yaml new file mode 100644 index 00000000..5d90baab --- /dev/null +++ b/k8s/tests/nc2oc/nc.yaml @@ -0,0 +1,30 @@ +_: &nextcloudConf + endpoint: http://nextcloud-server/index.php/apps/sciencemesh/ + shared_secret: 'shared-secret-nc' + +gateway: + config: + shared: + jwt_secret: ocm-test-nc-123 + http: + services: + dataprovider: + drivers: + nextcloud: *nextcloudConf + grpc: + services: + authprovider: + auth_managers: + nextcloud: *nextcloudConf + ocmcore: + drivers: + nextcloud: *nextcloudConf + ocmshareprovider: + drivers: + nextcloud: *nextcloudConf + storageprovider: + drivers: + nextcloud: *nextcloudConf + userprovider: + drivers: + nextcloud: *nextcloudConf diff --git a/k8s/tests/nc2oc/oc.yaml b/k8s/tests/nc2oc/oc.yaml new file mode 100644 index 00000000..aabdd745 --- /dev/null +++ b/k8s/tests/nc2oc/oc.yaml @@ -0,0 +1,30 @@ +_: &owncloudConf + endpoint: http://owncloud-server/index.php/apps/sciencemesh/ + shared_secret: 'shared-secret-oc' + +gateway: + config: + shared: + jwt_secret: ocm-test-oc-123 + http: + services: + dataprovider: + drivers: + nextcloud: *owncloudConf + grpc: + services: + authprovider: + auth_managers: + nextcloud: *owncloudConf + ocmcore: + drivers: + nextcloud: *owncloudConf + ocmshareprovider: + drivers: + nextcloud: *owncloudConf + storageprovider: + drivers: + nextcloud: *owncloudConf + userprovider: + drivers: + nextcloud: *owncloudConf diff --git a/k8s/tests/oc2oc/NOTES.txt b/k8s/tests/oc2oc/NOTES.txt new file mode 100644 index 00000000..22428a65 --- /dev/null +++ b/k8s/tests/oc2oc/NOTES.txt @@ -0,0 +1,8 @@ +--------------------------------- +ownCloud 10.10 <=> ownCloud 10.10 +--------------------------------- + +# ownCloud apps: + +- oc-sciencemesh: pondersource/master +- reva: v1.2.1 diff --git a/k8s/tests/oc2oc/cleanup.sh b/k8s/tests/oc2oc/cleanup.sh new file mode 100755 index 00000000..1bb73fcc --- /dev/null +++ b/k8s/tests/oc2oc/cleanup.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env sh +helm uninstall -n oc-site1 owncloud +helm uninstall -n oc-site2 owncloud + +kubectl delete namespaces oc-site1 oc-site2 diff --git a/k8s/tests/oc2oc/deploy.sh b/k8s/tests/oc2oc/deploy.sh new file mode 100755 index 00000000..69f85173 --- /dev/null +++ b/k8s/tests/oc2oc/deploy.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env sh + +VALUES_DIR=$PWD + +cd ../../owncloud || exit + +if [ "$1" = "--rebuild" ]; then + echo "- Rebuilding images..." + ./build.sh +fi + +echo "- Deploying charts..." +helm upgrade -i -n oc-site1 --create-namespace owncloud -f "${VALUES_DIR}/oc1.yaml" --set-file gateway.revad.configFiles.ocm-providers\\.json="${VALUES_DIR}"/ocm-providers.json . +helm upgrade -i -n oc-site2 --create-namespace owncloud -f "${VALUES_DIR}/oc2.yaml" --set-file gateway.revad.configFiles.ocm-providers\\.json="${VALUES_DIR}"/ocm-providers.json . diff --git a/k8s/tests/oc2oc/oc1.yaml b/k8s/tests/oc2oc/oc1.yaml new file mode 100644 index 00000000..6342d956 --- /dev/null +++ b/k8s/tests/oc2oc/oc1.yaml @@ -0,0 +1,49 @@ +_: &sharedSecret shared-secret-oc1 +__: &owncloudConf + endpoint: http://owncloud:8080/index.php/apps/sciencemesh/ + shared_secret: *sharedSecret + +gateway: + revad: + ingress: + services: + http: + hostname: http.gateway1.localdev.me + grpc: + hostname: grpc.gateway1.localdev.me + config: + shared: + jwt_secret: ocm-test-oc1-123 + http: + services: + dataprovider: + drivers: + nextcloud: *owncloudConf + grpc: + services: + authprovider: + auth_managers: + nextcloud: *owncloudConf + ocmcore: + drivers: + nextcloud: *owncloudConf + ocmshareprovider: + drivers: + nextcloud: *owncloudConf + storageprovider: + drivers: + nextcloud: *owncloudConf + userprovider: + drivers: + nextcloud: *owncloudConf + +owncloud: + owncloud: + configExtra: + sciencemesh: + iopUrl: http://owncloud-revad.oc-site1.svc.cluster.local:19001/ + revaSharedSecret: *sharedSecret + domain: owncloud1.localdev.me + trustedDomains: + - owncloud1.localdev.me + - owncloud diff --git a/k8s/tests/oc2oc/oc2.yaml b/k8s/tests/oc2oc/oc2.yaml new file mode 100644 index 00000000..10da1018 --- /dev/null +++ b/k8s/tests/oc2oc/oc2.yaml @@ -0,0 +1,49 @@ +_: &sharedSecret shared-secret-oc2 +__: &owncloudConf + endpoint: http://owncloud:8080/index.php/apps/sciencemesh/ + shared_secret: *sharedSecret + +gateway: + revad: + ingress: + services: + http: + hostname: http.gateway2.localdev.me + grpc: + hostname: grpc.gateway2.localdev.me + config: + shared: + jwt_secret: ocm-test-oc2-123 + http: + services: + dataprovider: + drivers: + nextcloud: *owncloudConf + grpc: + services: + authprovider: + auth_managers: + nextcloud: *owncloudConf + ocmcore: + drivers: + nextcloud: *owncloudConf + ocmshareprovider: + drivers: + nextcloud: *owncloudConf + storageprovider: + drivers: + nextcloud: *owncloudConf + userprovider: + drivers: + nextcloud: *owncloudConf + +owncloud: + owncloud: + configExtra: + sciencemesh: + iopUrl: http://owncloud-revad.oc-site2.svc.cluster.local:19001/ + revaSharedSecret: *sharedSecret + domain: owncloud2.localdev.me + trustedDomains: + - owncloud1.localdev.me + - owncloud diff --git a/k8s/tests/oc2oc/ocm-providers.json b/k8s/tests/oc2oc/ocm-providers.json new file mode 100644 index 00000000..8f33b305 --- /dev/null +++ b/k8s/tests/oc2oc/ocm-providers.json @@ -0,0 +1,160 @@ +[ + { + "name": "Site1", + "full_name": "OCM Test Site #1", + "description": "OCM Test site #1", + "organization": "Site1", + "domain": "owncloud-revad.oc-site1.svc.cluster.local", + "homepage": "http://owncloud1.localdev.me/", + "email": "info@site1.org", + "services": [ + { + "host": "owncloud-revad.oc-site1.svc.cluster.local", + "endpoint": { + "type": { + "name": "WEBDAV", + "description": "Web Distributed Authoring and Versioning Service" + }, + "name": "WEBDAV", + "path": "http://http.gateway1.localdev.me/remote.php/webdav" + }, + "api_version": "0.1.0" + }, + { + "host": "owncloud-revad.oc-site1.svc.cluster.local", + "endpoint": { + "type": { + "name": "OCM", + "description": "OpenCloudMesh Service" + }, + "name": "OCM", + "path": "http://http.gateway1.localdev.me/ocm" + }, + "api_version": "0.1.0" + }, + { + "host": "owncloud-revad.oc-site1.svc.cluster.local", + "endpoint": { + "type": { + "name": "GATEWAY", + "description": "CS3 Gateway Service" + }, + "name": "GATEWAY", + "path": "grpc://owncloud-revad.oc-site1.svc.cluster.local:19000", + "is_monitored": true + }, + "api_version": "0.1.0" + }, + { + "host": "owncloud-revad.oc-site1.svc.cluster.local", + "endpoint": { + "type": { + "name": "REVAD", + "description": "Reva Daemon Service" + }, + "name": "REVAD", + "path": "https://http.gateway1.localdev.me/", + "is_monitored": true, + "properties": { + "API_VERSION": "0.1.0" + } + }, + "api_version": "0.1.0", + "additional_endpoints": [ + { + "type": { + "name": "METRICS", + "description": "Prometheus metrics provider" + }, + "name": "METRICS", + "path": "https://http.gateway1.localdev.me/metrics", + "is_monitored": true + } + ] + } + ], + "properties": { + "OPERATOR": "Site1", + "ORGANIZATION": "Site1" + } + }, + { + "name": "Site2", + "full_name": "OCM Test Site #2", + "description": "OCM Test site #2", + "organization": "Site2", + "domain": "owncloud-revad.oc-site2.svc.cluster.local", + "homepage": "http://owncloud2.localdev.me/", + "email": "info@site2.org", + "services": [ + { + "host": "owncloud-revad.oc-site2.svc.cluster.local", + "endpoint": { + "type": { + "name": "WEBDAV", + "description": "Web Distributed Authoring and Versioning Service" + }, + "name": "WEBDAV", + "path": "http://http.gateway2.localdev.me/remote.php/webdav" + }, + "api_version": "0.1.0" + }, + { + "host": "owncloud-revad.oc-site2.svc.cluster.local", + "endpoint": { + "type": { + "name": "OCM", + "description": "OpenCloudMesh Service" + }, + "name": "OCM", + "path": "http://http.gateway.localdev.me/ocm" + }, + "api_version": "0.1.0" + }, + { + "host": "owncloud-revad.oc-site2.svc.cluster.local", + "endpoint": { + "type": { + "name": "GATEWAY", + "description": "CS3 Gateway Service" + }, + "name": "GATEWAY", + "path": "grpc://owncloud-revad.oc-site2.svc.cluster.local:19000", + "is_monitored": true + }, + "api_version": "0.1.0" + }, + { + "host": "owncloud-revad.oc-site2.svc.cluster.local", + "endpoint": { + "type": { + "name": "REVAD", + "description": "Reva Daemon Service" + }, + "name": "REVAD", + "path": "https://http.gateway2.localdev.me/", + "is_monitored": true, + "properties": { + "API_VERSION": "0.1.0" + } + }, + "api_version": "0.1.0", + "additional_endpoints": [ + { + "type": { + "name": "METRICS", + "description": "Prometheus metrics provider" + }, + "name": "METRICS", + "path": "https://http.gateway2.localdev.me/metrics", + "is_monitored": true + } + ] + } + ], + "properties": { + "OPERATOR": "Site2", + "ORGANIZATION": "Site2" + } + } +] \ No newline at end of file diff --git a/nc-sciencemesh b/nc-sciencemesh deleted file mode 160000 index 9993eb76..00000000 --- a/nc-sciencemesh +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9993eb76977d3c6d95e589a2fac6fe8798331ac3 diff --git a/oc-sciencemesh b/oc-sciencemesh deleted file mode 160000 index 4cea63a7..00000000 --- a/oc-sciencemesh +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4cea63a75b06d1b5cdca9de9f21fdbe4c15346bf diff --git a/reva b/reva deleted file mode 160000 index 5cf20d57..00000000 --- a/reva +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5cf20d57b2da2e3eb42fa1f3f7d4465e01a753e7 diff --git a/servers/revad/revanc1.toml b/servers/revad/revanc1.toml index 8b2cb639..8d1ad04e 100644 --- a/servers/revad/revanc1.toml +++ b/servers/revad/revanc1.toml @@ -16,43 +16,44 @@ gatewaysvc = "revanc1.docker:19000" # basic = ["localhost:1234"] # publiclink = ["localhost:9876"] -[grpc] -address = "0.0.0.0:19000" -# certfile = "/etc/revad/tls/revanc1.crt" -# keyfile = "/etc/revad/tls/revanc1.key" - -[grpc.services.gateway] -authregistrysvc = "revanc1.docker:19000" -appprovidersvc = "revanc1.docker:19000" -appregistry = "revanc1.docker:19000" -storageregistrysvc = "revanc1.docker:19000" -preferencessvc = "revanc1.docker:19000" -userprovidersvc = "revanc1.docker:19000" -usershareprovidersvc = "revanc1.docker:19000" -publicshareprovidersvc = "revanc1.docker:19000" -ocmcoresvc = "revanc1.docker:19000" -ocmshareprovidersvc = "revanc1.docker:19000" -ocminvitemanagersvc = "revanc1.docker:19000" -ocmproviderauthorizersvc = "revanc1.docker:19000" -commit_share_to_storage_grant = false -datagateway = "https://revanc1.docker/data" -transfer_expires = 6 # give it a moment - -[grpc.services.authregistry] -driver = "static" +# These are the defaults +# [grpc] +# address = "0.0.0.0:19000" +# # certfile = "/etc/revad/tls/revanc1.crt" +# # keyfile = "/etc/revad/tls/revanc1.key" + +# [grpc.services.gateway] +# authregistrysvc = "revanc1.docker:19000" +# appprovidersvc = "revanc1.docker:19000" +# appregistry = "revanc1.docker:19000" +# storageregistrysvc = "revanc1.docker:19000" +# preferencessvc = "revanc1.docker:19000" +# userprovidersvc = "revanc1.docker:19000" +# usershareprovidersvc = "revanc1.docker:19000" +# publicshareprovidersvc = "revanc1.docker:19000" +# ocmcoresvc = "revanc1.docker:19000" +# ocmshareprovidersvc = "revanc1.docker:19000" +# ocminvitemanagersvc = "revanc1.docker:19000" +# ocmproviderauthorizersvc = "revanc1.docker:19000" +# commit_share_to_storage_grant = false +# datagateway = "https://revanc1.docker/data" +# transfer_expires = 6 # give it a moment + +# [grpc.services.authregistry] +# driver = "static" -[grpc.services.authregistry.drivers.static.rules] -basic = "revanc1.docker:19000" +# [grpc.services.authregistry.drivers.static.rules] +# basic = "revanc1.docker:19000" -[grpc.services.storageregistry] -driver = "static" +# [grpc.services.storageregistry] +# driver = "static" -[grpc.services.storageregistry.drivers.static] -home_provider = "/home" +# [grpc.services.storageregistry.drivers.static] +# home_provider = "/home" -[grpc.services.storageregistry.drivers.static.rules] -"/home" = {"address" = "revanc1.docker:19000"} -"123e4567-e89b-12d3-a456-426655440000" = {"address" = "revanc1.docker:19000"} +# [grpc.services.storageregistry.drivers.static.rules] +# "/home" = {"address" = "revanc1.docker:19000"} +# "123e4567-e89b-12d3-a456-426655440000" = {"address" = "revanc1.docker:19000"} [grpc.services.usershareprovider] driver = "memory" @@ -129,11 +130,11 @@ driver = "nextcloud" [grpc.services.userprovider.drivers.nextcloud] endpoint = "https://nc1.docker/index.php/apps/sciencemesh/" shared_secret = "shared-secret-1" -mock_http = false +# mock_http = false -[http] -enabled_services = ["ocmd"] -enabled_middlewares = ["providerauthorizer", "cors"] +# [http] +# enabled_services = ["ocmd"] +# enabled_middlewares = ["providerauthorizer", "cors"] address = "0.0.0.0:443" certfile = "/etc/revad/tls/revanc1.crt" keyfile = "/etc/revad/tls/revanc1.key" diff --git a/setup.sh b/setup.sh deleted file mode 100644 index 834c9ca5..00000000 --- a/setup.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -set -e -apt-get update -apt-get install -yq docker.io -docker ps -git clone https://github.com/cs3org/ocm-test-suite -cd ocm-test-suite -git checkout main -./gitpod-init.sh -/bin/bash ./debug.sh - -# There are really three ways to add a tester to the testnet, -# see debug.sh for more details.