diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 43ac5c3..6fdcc55 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -52,7 +52,7 @@ jobs: with: context: ./ push: true - platforms: linux/amd64 #,linux/arm64 + platforms: linux/amd64,linux/arm64 build-args: | VERSION_ARG=${{ github.ref_name }} tags: | diff --git a/.github/workflows/canary-release.yml b/.github/workflows/canary-release.yml index 825cffb..fdd0863 100644 --- a/.github/workflows/canary-release.yml +++ b/.github/workflows/canary-release.yml @@ -52,7 +52,7 @@ jobs: with: context: ./ push: true - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64 #,linux/arm64 build-args: | VERSION_ARG=canary-${{ github.run_number }} tags: | diff --git a/setup/setup-canary.sh b/setup/setup-canary.sh new file mode 100644 index 0000000..bb2831e --- /dev/null +++ b/setup/setup-canary.sh @@ -0,0 +1,178 @@ +#!/bin/bash + +# curl -sfL https://get.quickstack.dev/setup-canary.sh | sh - + +select_network_interface() { + if [ -z "$INSTALL_K3S_INTERFACE" ]; then + interfaces_with_ips=$(ip -o -4 addr show | awk '!/^[0-9]*: lo:/ {print $2, $4}' | cut -d'/' -f1) + + echo "Available network interfaces:" + echo "$interfaces_with_ips" + echo "" + echo "*******************************************************************************************************" + echo "" + echo "If you plan to use QuickStack in a cluster using multiple servers in multiple Networks (private/public)," + echo "choose the network Interface you want to use for the communication between the servers." + echo "" + echo "If you plan to use QuickStack in a single server setup, choose the network Interface with the public IP." + echo "" + + i=1 + echo "$interfaces_with_ips" | while read -r iface ip; do + printf "%d) %s (%s)\n" "$i" "$iface" "$ip" + i=$((i + 1)) + done + + printf "Please enter the number of the interface to use: " + # Change read to use /dev/tty explicitly + read -r choice &1) + + # Checks if there are no resources found --> Kubernetes ist still starting up + if echo "$OUTPUT" | grep -q "No resources found"; then + echo "Kubernetes is still starting up..." + else + # Extracts the STATUS column from the kubectl output and filters out the values "Running" and "Completed". + STATUS=$(echo "$OUTPUT" | awk '{print $4}' | grep -vE '^(Running|Completed)$') + + # If the STATUS variable is empty, all pods are running and the loop can be exited. + if [ -z "$STATUS" ]; then + echo "Pods started successfully." + break + else + echo "Waiting for all pods to come online..." + fi + fi + + # Waits for X seconds before checking the pod status again. + sleep 10 + done + + # Waits another 5 seconds to make sure all pods are ready. + sleep 5 + + sudo kubectl get node + sudo kubectl get pods -A +} + +# Prompt for network interface +select_network_interface + +# install nfs-common and open-iscsi +echo "Installing nfs-common..." +sudo apt-get update +sudo apt-get install open-iscsi nfs-common -y + +# Installation of k3s +#curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--node-ip=192.168.1.2 --advertise-address=192.168.1.2 --node-external-ip=188.245.236.232 --flannel-iface=enp7s0" INSTALL_K3S_VERSION="v1.31.3+k3s1" sh - + +echo "Installing k3s with --flannel-iface=$selected_iface" +curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--flannel-iface=$selected_iface" INSTALL_K3S_VERSION="v1.31.3+k3s1" sh - +# Todo: Check for Ready node, takes ~30 seconds +sudo k3s kubectl get node + +echo "Waiting for Kubernetes to start..." +wait_until_all_pods_running + +# Installation of Longhorn +sudo kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.7.2/deploy/longhorn.yaml +echo "Waiting for Longhorn to start..." +wait_until_all_pods_running + +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +# THIS MUST BE INSTALLED ON ALL NODES --> https://longhorn.io/docs/1.7.2/deploy/install/#installing-nfsv4-client +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +#sudo kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.6.0/deploy/prerequisite/longhorn-nfs-installation.yaml +#wait_until_all_pods_running + +# Installation of Cert-Manager +sudo kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.16.1/cert-manager.yaml +echo "Waiting for Cert-Manager to start..." +wait_until_all_pods_running +sudo kubectl -n cert-manager get pod + +# Checking installation of Longhorn +sudo apt-get install jq -y +sudo curl -sSfL https://raw.githubusercontent.com/longhorn/longhorn/v1.7.2/scripts/environment_check.sh | bash + +joinTokenForOtherNodes=$(sudo cat /var/lib/rancher/k3s/server/node-token) + +# deploy QuickStack +cat <quickstack-setup-job.yaml +apiVersion: v1 +kind: Namespace +metadata: + name: quickstack +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: qs-service-account + namespace: quickstack +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: qs-role-binding +subjects: + - kind: ServiceAccount + name: qs-service-account + namespace: quickstack +roleRef: + kind: ClusterRole + name: cluster-admin + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: quickstack-setup-job + namespace: quickstack +spec: + ttlSecondsAfterFinished: 3600 + template: + spec: + serviceAccountName: qs-service-account + containers: + - name: quickstack-container + image: quickstack/quickstack:canary + env: + - name: START_MODE + value: "setup" + - name: K3S_JOIN_TOKEN + value: "$joinTokenForOtherNodes" + imagePullPolicy: Always + restartPolicy: Never + backoffLimit: 0 +EOF +sudo kubectl apply -f quickstack-setup-job.yaml +rm quickstack-setup-job.yaml +wait_until_all_pods_running +sudo kubectl logs -f job/quickstack-setup-job -n quickstack + +# evaluate url to add node to cluster +# echo "To add an additional node to the cluster, run the following command on the worker node:" +# echo "curl -sfL https://get.quickstack.dev/setup-worker.sh | K3S_URL=https://:6443 JOIN_TOKEN=$joinTokenForOtherNodes sh -" diff --git a/setup/setup-worker.sh b/setup/setup-worker.sh index d1a7b75..93d2cc4 100644 --- a/setup/setup-worker.sh +++ b/setup/setup-worker.sh @@ -35,7 +35,7 @@ select_network_interface() { i=$((i + 1)) done - printf "Please enter the number of the interface to use (1-%d): " "$((i-1))" + printf "Please enter the number of the interface to use: " # Change read to use /dev/tty explicitly read -r choice @@ -25,6 +26,12 @@ export const registerUser = async (prevState: any, inputData: RegisterFormInputS // ignore console.error('Failes to evaluate public ip address', e); } + try { + await traefikMeDomainStandaloneService.updateTraefikMeCertificate(); + } catch (e) { + // ignore + console.error('Failed to update traefik me certificate', e); + } if (validatedData.qsHostname) { const url = new URL(validatedData.qsHostname.includes('://') ? validatedData.qsHostname : `https://${validatedData.qsHostname}`); await paramService.save({ diff --git a/src/server/services/app-template.service.ts b/src/server/services/app-template.service.ts index a9dea3e..3fc2383 100644 --- a/src/server/services/app-template.service.ts +++ b/src/server/services/app-template.service.ts @@ -57,6 +57,13 @@ class AppTemplateService { }); })); + const savedFileMounts = await Promise.all(template.appFileMounts.map(async x => { + return await appService.saveFileMount({ + ...x, + appId: createdApp.id + }); + })); + const savedPorts = await Promise.all(template.appPorts.map(async x => { return await appService.savePort({ ...x,