| garciadeblas | cf603f5 | 2025-06-04 11:57:28 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | # |
| 15 | |
| 16 | set -e -o pipefail |
| 17 | |
| 18 | HERE=$(dirname "$(readlink --canonicalize "$BASH_SOURCE")") |
| 19 | source "${HERE}/../library/functions.sh" |
| 20 | source "${HERE}/../library/trap.sh" |
| 21 | source "${HERE}/../library/logging" |
| 22 | source "${HERE}/../library/track" |
| 23 | |
| garciadeblas | 2b4cd1f | 2025-08-08 10:02:01 +0200 | [diff] [blame] | 24 | source "${HERE}/00-default-install-options.rc" |
| 25 | [ ! -f "${OSM_HOME_DIR}/user-install-options.rc" ] || source "${OSM_HOME_DIR}/user-install-options.rc" |
| 26 | |
| garciadeblas | cf603f5 | 2025-06-04 11:57:28 +0200 | [diff] [blame] | 27 | echo "INSTALL_MINIO=$INSTALL_MINIO" |
| 28 | |
| 29 | pushd $HOME |
| 30 | |
| 31 | export DEBIAN_FRONTEND=noninteractive |
| 32 | sudo apt-get update |
| 33 | |
| 34 | # Install git, curl, tar |
| 35 | sudo DEBIAN_FRONTEND=noninteractive apt-get install -y git curl tar |
| 36 | |
| 37 | # Helm |
| 38 | HELM_VERSION="v3.15.1" |
| 39 | # Helm releases can be found here: https://github.com/helm/helm/releases |
| 40 | if ! [[ "$(helm version --short 2>/dev/null)" =~ ^v3.* ]]; then |
| 41 | # Helm is not installed. Install helm |
| 42 | echo "Helm3 is not installed, installing ..." |
| 43 | curl https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz -o helm-${HELM_VERSION}.tar.gz |
| 44 | tar -zxvf helm-${HELM_VERSION}.tar.gz |
| 45 | sudo mv linux-amd64/helm /usr/local/bin/helm |
| 46 | rm -r linux-amd64 |
| 47 | rm helm-${HELM_VERSION}.tar.gz |
| 48 | else |
| 49 | echo "Helm3 is already installed. Skipping installation..." |
| 50 | fi |
| 51 | helm version || FATAL_TRACK k8scluster "Could not obtain helm version. Maybe helm client was not installed" |
| 52 | helm repo add stable https://charts.helm.sh/stable || FATAL_TRACK k8scluster "Helm repo stable could not be added" |
| 53 | helm repo update || FATAL_TRACK k8scluster "Helm repo stable could not be updated" |
| 54 | echo "helm installed" |
| 55 | |
| 56 | # Install kubectl client |
| 57 | K8S_CLIENT_VERSION="v1.29.3" |
| 58 | curl -LO "https://dl.k8s.io/release/${K8S_CLIENT_VERSION}/bin/linux/amd64/kubectl" |
| 59 | sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl |
| 60 | rm kubectl |
| 61 | echo "kubectl installed" |
| 62 | |
| 63 | # Install `gnupg` and `gpg` - Typically pre-installed in Ubuntu |
| 64 | sudo DEBIAN_FRONTEND=noninteractive apt-get install gnupg gpg -y |
| 65 | echo "gnupg and gpg installed" |
| 66 | |
| 67 | # Install `sops` |
| 68 | curl -LO https://github.com/getsops/sops/releases/download/v3.8.1/sops-v3.8.1.linux.amd64 |
| 69 | sudo mv sops-v3.8.1.linux.amd64 /usr/local/bin/sops |
| 70 | sudo chmod +x /usr/local/bin/sops |
| 71 | echo "sops client installed" |
| 72 | |
| 73 | # Install `envsubst` |
| 74 | sudo DEBIAN_FRONTEND=noninteractive apt-get install gettext-base -y |
| 75 | echo "envsubst installed" |
| 76 | |
| 77 | # Install `age` |
| 78 | AGE_VERSION="v1.1.0" |
| 79 | curl -LO https://github.com/FiloSottile/age/releases/download/${AGE_VERSION}/age-${AGE_VERSION}-linux-amd64.tar.gz |
| 80 | tar xvfz age-${AGE_VERSION}-linux-amd64.tar.gz |
| 81 | sudo mv age/age age/age-keygen /usr/local/bin/ |
| 82 | sudo chmod +x /usr/local/bin/age* |
| 83 | rm -rf age age-${AGE_VERSION}-linux-amd64.tar.gz |
| 84 | echo "age installed" |
| 85 | |
| 86 | # (Only for Gitea) Install `apg` |
| 87 | sudo DEBIAN_FRONTEND=noninteractive apt-get install apg -y |
| 88 | echo "apg installed" |
| 89 | |
| 90 | # # (Only for Minio) `kubectl minio` plugin and Minio Client |
| 91 | MINIO_CLIENT_VERSION="5.0.12" |
| 92 | if [ -n "${INSTALL_MINIO}" ]; then |
| 93 | curl https://github.com/minio/operator/releases/download/v${MINIO_CLIENT_VERSION}/kubectl-minio_${MINIO_CLIENT_VERSION}_linux_amd64 -Lo kubectl-minio |
| 94 | curl https://dl.min.io/client/mc/release/linux-amd64/mc -o minioc |
| 95 | chmod +x kubectl-minio minioc |
| 96 | sudo mv kubectl-minio minioc /usr/local/bin/ |
| 97 | # (Only for HTTPS Ingress for Minio tenant) Install `openssl` |
| 98 | sudo DEBIAN_FRONTEND=noninteractive apt-get install openssl -y |
| 99 | fi |
| 100 | echo "minio client installed" |
| 101 | |
| 102 | # Flux client |
| 103 | FLUX_CLI_VERSION="2.4.0" |
| 104 | curl -s https://fluxcd.io/install.sh | sudo FLUX_VERSION=${FLUX_CLI_VERSION} bash |
| 105 | # Autocompletion |
| 106 | . <(flux completion bash) |
| 107 | echo "flux client installed" |
| 108 | |
| 109 | # Argo client |
| 110 | ARGO_VERSION="v3.5.7" |
| 111 | curl -sLO https://github.com/argoproj/argo-workflows/releases/download/${ARGO_VERSION}/argo-linux-amd64.gz |
| 112 | gunzip argo-linux-amd64.gz |
| 113 | chmod +x argo-linux-amd64 |
| 114 | sudo mv ./argo-linux-amd64 /usr/local/bin/argo |
| 115 | echo "argo client installed" |
| 116 | |
| 117 | # Kustomize |
| 118 | KUSTOMIZE_VERSION="5.4.3" |
| 119 | curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash -s -- ${KUSTOMIZE_VERSION} |
| 120 | sudo install -o root -g root -m 0755 kustomize /usr/local/bin/kustomize |
| 121 | rm kustomize |
| 122 | echo "kustomized installed" |
| 123 | |
| 124 | # yq |
| 125 | VERSION=v4.33.3 |
| 126 | BINARY=yq_linux_amd64 |
| 127 | curl -L https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY} -o yq |
| 128 | sudo mv yq /usr/local/bin/yq |
| 129 | sudo chmod +x /usr/local/bin/yq |
| 130 | echo "yq installed" |
| 131 | |
| 132 | # OSM client |
| 133 | OSM_CLIENT_VERSION=${OSM_CLIENT_VERSION:-"master"} |
| 134 | OSM_IM_VERSION=${OSM_IM_VERSION:-"master"} |
| garciadeblas | 6d5444e | 2025-12-18 22:43:02 +0100 | [diff] [blame] | 135 | sudo DEBIAN_FRONTEND=noninteractive apt-get install -y python3 python3-setuptools python3-dev python3-pip python3-venv |
| 136 | sudo DEBIAN_FRONTEND=noninteractive apt-get install -y libmagic1t64 |
| garciadeblas | cf603f5 | 2025-06-04 11:57:28 +0200 | [diff] [blame] | 137 | sudo DEBIAN_FRONTEND=noninteractive apt-get install -y make |
| garciadeblas | 6d5444e | 2025-12-18 22:43:02 +0100 | [diff] [blame] | 138 | |
| 139 | python3 -m venv venv |
| 140 | source venv/bin/activate |
| 141 | python -m pip install -U pip |
| 142 | |
| garciadeblas | cf603f5 | 2025-06-04 11:57:28 +0200 | [diff] [blame] | 143 | # Install OSM IM and its dependencies via pip |
| garciadeblas | 6d5444e | 2025-12-18 22:43:02 +0100 | [diff] [blame] | 144 | pip install -r "https://osm.etsi.org/gitweb/?p=osm/IM.git;a=blob_plain;f=requirements.txt;hb=${OSM_IM_VERSION}" |
| garciadeblas | cf603f5 | 2025-06-04 11:57:28 +0200 | [diff] [blame] | 145 | # Path needs to include $HOME/.local/bin in order to use pyang |
| 146 | [ "$(which pyang)" = "$HOME/.local/bin/pyang" ] || export PATH=$HOME/.local/bin:${PATH} |
| garciadeblas | 6d5444e | 2025-12-18 22:43:02 +0100 | [diff] [blame] | 147 | #pip install "git+https://osm.etsi.org/gerrit/osm/IM.git@${OSM_IM_VERSION}#egg=osm-im" --upgrade |
| garciadeblas | 7d3c4e6 | 2025-10-30 10:04:38 +0100 | [diff] [blame] | 148 | TMP_DIR=$(mktemp -d) |
| 149 | git clone https://osm.etsi.org/gerrit/osm/IM.git "$TMP_DIR/IM" |
| garciadeblas | 884533a | 2025-11-03 12:54:51 +0100 | [diff] [blame] | 150 | git -C "$TMP_DIR/IM" fetch "https://osm.etsi.org/gerrit/osm/IM" refs/changes/15/15515/1 && git -C "$TMP_DIR/IM" checkout FETCH_HEAD |
| garciadeblas | 6d5444e | 2025-12-18 22:43:02 +0100 | [diff] [blame] | 151 | pip install "$TMP_DIR/IM" |
| 152 | pip install -r "https://osm.etsi.org/gitweb/?p=osm/osmclient.git;a=blob_plain;f=requirements.txt;hb=${OSM_CLIENT_VERSION}" |
| 153 | pip install git+https://osm.etsi.org/gerrit/osm/osmclient.git@${OSM_CLIENT_VERSION}#egg=osmclient |
| 154 | mkdir -p $HOME/.local/bin |
| 155 | ln -s $HOME/venv/bin/osm $HOME/.local/bin/osm |
| garciadeblas | cf603f5 | 2025-06-04 11:57:28 +0200 | [diff] [blame] | 156 | echo "OSM client installed" |
| 157 | |
| 158 | popd |