From a71340511f2a97af44793e68bc2b3228175e6d2c Mon Sep 17 00:00:00 2001 From: Jim Grady Date: Thu, 19 Sep 2024 10:42:08 -0400 Subject: [PATCH] Standalone installer improvements (#3360) * Generate charts from templates before packaging images * Remove venv tarball from the installer * Update installer README.md --- deploy/scripts/combine_charts.py | 2 +- deploy/scripts/install-combine.sh | 35 +++++++++++++++-------------- deploy/scripts/package_images.py | 3 +++ installer/README.md | 1 + installer/make-combine-installer.sh | 8 ------- 5 files changed, 23 insertions(+), 26 deletions(-) diff --git a/deploy/scripts/combine_charts.py b/deploy/scripts/combine_charts.py index 4e9f6baa37..6e5750af6a 100755 --- a/deploy/scripts/combine_charts.py +++ b/deploy/scripts/combine_charts.py @@ -70,6 +70,6 @@ def generate(version: str, aws_login_version: str = default_aws_login_version) - if __name__ == "__main__": - """Allow calling from the command line for testing, etc.""" + """Allow calling from the command line.""" args = parse_args() generate(args.version, args.aws) diff --git a/deploy/scripts/install-combine.sh b/deploy/scripts/install-combine.sh index 6237790930..2a969c4f39 100755 --- a/deploy/scripts/install-combine.sh +++ b/deploy/scripts/install-combine.sh @@ -56,18 +56,12 @@ create-python-venv () { ##### # Setup Python virtual environment echo "Setting up venv in ${DEPLOY_DIR}" - if [ -f "./venv.tar.gz" ] ; then - tar xzf ./venv.tar.gz - sed -i "s|%%VENV_DIR%%|${DEPLOY_DIR}/venv|g" ${DEPLOY_DIR}/venv/bin/* - source venv/bin/activate - else - python3 -m venv venv - source venv/bin/activate - echo "Install pip and pip-tools" - python -m pip install --upgrade pip pip-tools - echo "Install dependencies" - python -m piptools sync requirements.txt - fi + python3 -m venv venv + source venv/bin/activate + echo "Install pip and pip-tools" + python -m pip install --upgrade pip pip-tools + echo "Install dependencies" + python -m piptools sync requirements.txt } # Install Kubernetes engine and other supporting @@ -204,6 +198,7 @@ DEPLOY_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd CONFIG_DIR=${HOME}/.config/combine mkdir -p ${CONFIG_DIR} SINGLE_STEP=0 +IS_SERVER=0 # See if we need to continue from a previous install STATE_FILE=${CONFIG_DIR}/install-state @@ -226,6 +221,9 @@ while (( "$#" )) ; do restart) next-state "Pre-reqs" ;; + server) + IS_SERVER=1 + ;; single-step) SINGLE_STEP=1 ;; @@ -313,11 +311,14 @@ while [ "$STATE" != "Done" ] ; do next-state "Shutdown-combine" ;; Shutdown-combine) - # Shut down the combine services - combinectl stop - # Disable combine services from starting at boot time - sudo systemctl disable create_ap - sudo systemctl disable k3s + # If not being installed as a server, + if [[ $IS_SERVER != 1 ]] ; then + # Shut down the combine services + combinectl stop + # Disable combine services from starting at boot time + sudo systemctl disable create_ap + sudo systemctl disable k3s + fi # Print the current status combinectl status next-state "Done" diff --git a/deploy/scripts/package_images.py b/deploy/scripts/package_images.py index 5df10cac8f..858f518122 100755 --- a/deploy/scripts/package_images.py +++ b/deploy/scripts/package_images.py @@ -15,6 +15,7 @@ import re from typing import Any, Dict, List +import combine_charts from utils import init_logging, run_cmd import yaml @@ -132,6 +133,8 @@ def package_middleware( def package_thecombine(tag: str, image_dir: Path) -> None: logging.info(f"Packaging The Combine version {tag}.") + logging.debug("Create helm charts from templates") + combine_charts.generate(tag) logging.debug(" - Get template for The Combine.") results = run_cmd( [ diff --git a/installer/README.md b/installer/README.md index 5e94689c23..1548a635ec 100644 --- a/installer/README.md +++ b/installer/README.md @@ -173,6 +173,7 @@ To run `combine-installer.run` with options, the option list must be started wit | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | clean | Remove the previously saved environment (AWS Access Key, admin user info) before performing the installation. | | restart | Run the installation from the beginning; do not resume a previous installation. | +| server | Install _The Combine_ in a server environment so that _The Combine_ is always running by default. | | timeout TIMEOUT | Use a different timeout when installing. The default timeout is 5 minutes. With slow internet connections, it is helpful to extend the timeout. See for timeout formats. | | uninstall | Remove software installed by this script. | | update | Update _The Combine_ to the version number provided. This skips installing the support software that was installed previously. | diff --git a/installer/make-combine-installer.sh b/installer/make-combine-installer.sh index 9a3bbf9942..938dd20e58 100755 --- a/installer/make-combine-installer.sh +++ b/installer/make-combine-installer.sh @@ -57,14 +57,6 @@ if [[ $NET_INSTALL == 0 ]] ; then ./package_images.py ${COMBINE_VERSION} ${TEMP_DIR} INSTALLER_NAME="combine-installer.run" popd - # create tarball for venv - # - # replace the current directory in the venv files with a string - # that can be used to relocate the venv - VENV_DIR=`pwd`/venv - echo "VENV_DIR == ${VENV_DIR}" - sed -i "s|${VENV_DIR}|%%VENV_DIR%%|g" venv/bin/* - tar czf ${TEMP_DIR}/venv.tar.gz venv rm -rf venv else # Package the Combine for network installation