Skip to content

Commit

Permalink
Standalone installer improvements (#3360)
Browse files Browse the repository at this point in the history
* Generate charts from templates before packaging images
* Remove venv tarball from the installer
* Update installer README.md
  • Loading branch information
jmgrady authored Sep 19, 2024
1 parent b964bca commit a713405
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 26 deletions.
2 changes: 1 addition & 1 deletion deploy/scripts/combine_charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
35 changes: 18 additions & 17 deletions deploy/scripts/install-combine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -226,6 +221,9 @@ while (( "$#" )) ; do
restart)
next-state "Pre-reqs"
;;
server)
IS_SERVER=1
;;
single-step)
SINGLE_STEP=1
;;
Expand Down Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions deploy/scripts/package_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import re
from typing import Any, Dict, List

import combine_charts
from utils import init_logging, run_cmd
import yaml

Expand Down Expand Up @@ -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(
[
Expand Down
1 change: 1 addition & 0 deletions installer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://pkg.go.dev/time#ParseDuration> 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. |
Expand Down
8 changes: 0 additions & 8 deletions installer/make-combine-installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a713405

Please sign in to comment.