diff --git a/pioreactor/cli/pio.py b/pioreactor/cli/pio.py index d687f9ed..ab38958b 100644 --- a/pioreactor/cli/pio.py +++ b/pioreactor/cli/pio.py @@ -393,8 +393,8 @@ def update_app( commands_and_priority.extend( [ (f"sudo rm -rf {tmp_rls_dir}", -99), - (f"unzip {source} -d {tmp_rls_dir}", 0), - (f"unzip {tmp_rls_dir}/wheels_{version_installed}.zip -d {tmp_rls_dir}/wheels", 1), + (f"unzip -o {source} -d {tmp_rls_dir}", 0), + (f"unzip -o {tmp_rls_dir}/wheels_{version_installed}.zip -d {tmp_rls_dir}/wheels", 1), (f"sudo bash {tmp_rls_dir}/pre_update.sh", 2), (f"sudo bash {tmp_rls_dir}/update.sh", 4), (f"sudo bash {tmp_rls_dir}/post_update.sh", 20), diff --git a/pioreactor/cli/pios.py b/pioreactor/cli/pios.py index c9122d1f..01e9a57e 100644 --- a/pioreactor/cli/pios.py +++ b/pioreactor/cli/pios.py @@ -188,13 +188,14 @@ def cp( units: tuple[str, ...], y: bool, ) -> None: + units = remove_leader(universal_identifier_to_all_workers(units)) + if not y: confirm = input(f"Confirm copying {filepath} onto {units}? Y/n: ").strip() if confirm != "Y": raise click.Abort() logger = create_logger("cp", unit=get_unit_name(), experiment=UNIVERSAL_EXPERIMENT) - units = remove_leader(universal_identifier_to_all_workers(units)) def _thread_function(unit: str) -> bool: logger.debug(f"Copying {filepath} to {unit}:{filepath}...") @@ -219,7 +220,6 @@ def rm( units: tuple[str, ...], y: bool, ) -> None: - logger = create_logger("rm", unit=get_unit_name(), experiment=UNIVERSAL_EXPERIMENT) units = remove_leader(universal_identifier_to_all_workers(units)) if not y: @@ -227,6 +227,8 @@ def rm( if confirm != "Y": raise click.Abort() + logger = create_logger("rm", unit=get_unit_name(), experiment=UNIVERSAL_EXPERIMENT) + def _thread_function(unit: str) -> bool: try: logger.debug(f"deleting {unit}:{filepath}...") diff --git a/update_scripts/upcoming/scripts/update_ui.sh b/update_scripts/upcoming/scripts/update_ui.sh index 0ee4c050..352316d9 100644 --- a/update_scripts/upcoming/scripts/update_ui.sh +++ b/update_scripts/upcoming/scripts/update_ui.sh @@ -19,7 +19,7 @@ trap finish EXIT # unpack source provided tar -xzf "$SRC_TAR" -C $TEMP_DIR -WORK_DIR=$(find "$TEMP_DIR" -mindepth 1 -maxdepth 1 -type d) # get the directory inside the archive, name is not predictable. +WORK_DIR=$(find "$TEMP_DIR" -mindepth 1 -maxdepth 1 -type d) # get the directory inside the archive, name is not predictable. TODO: I think I can use --strip-components for this... echo $WORK_DIR # Verify that WORK_DIR is valid diff --git a/update_scripts/upcoming/services/create_diskcache.service b/update_scripts/upcoming/services/create_diskcache.service index 49f7bfdf..8ffb8584 100644 --- a/update_scripts/upcoming/services/create_diskcache.service +++ b/update_scripts/upcoming/services/create_diskcache.service @@ -4,7 +4,6 @@ After=network.target firstboot.service Before=lighttpd.service huey.service [Service] -User=pioreactor ExecStart=/bin/bash /usr/local/bin/create_diskcache.sh ExecStartPost=pio log -m "%n successful" -n systemd --local-only Type=oneshot diff --git a/update_scripts/upcoming/update.sh b/update_scripts/upcoming/update.sh index 9094e954..1a6f2c86 100644 --- a/update_scripts/upcoming/update.sh +++ b/update_scripts/upcoming/update.sh @@ -8,8 +8,8 @@ export LC_ALL=C SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" UI_FOLDER=/var/www/pioreactorui -SYSTEMD_DIR=/lib/systemd/system/ -UI_TAG="24.9.16" # TODO +SYSTEMD_DIR=/etc/systemd/system/ +UI_TAG="24.9.17" # TODO PIO_DIR="/home/pioreactor/.pioreactor" HOSTNAME=$(hostname) @@ -20,14 +20,14 @@ LEADER_HOSTNAME=$(crudini --get "$PIO_DIR"/config.ini cluster.topology leader_ho if [ "$HOSTNAME" != "$LEADER_HOSTNAME" ]; then # worker updates - # install pioreactorui - rm -rf $UI_FOLDER - mkdir -p /var/www + # clean up from previous + rm -rf $UI_FOLDER/* + rm -rf /tmp/pioreactorui_cache/ - tar -xzf "$SCRIPT_DIR"/pioreactorui_"$UI_TAG".tar.gz - mv pioreactorui-"$UI_TAG" /var/www - mv /var/www/pioreactorui-"$UI_TAG" $UI_FOLDER + # install pioreactorui + mkdir -p "$UI_FOLDER" + tar -xzf "$SCRIPT_DIR"/pioreactorui_"$UI_TAG".tar.gz -C "$UI_FOLDER" --strip-components=1 # init .env mv $UI_FOLDER/.env.example $UI_FOLDER/.env @@ -47,7 +47,7 @@ if [ "$HOSTNAME" != "$LEADER_HOSTNAME" ]; then chmod +x $UI_FOLDER/main.fcgi # install lighttp and set up mods - unzip "$SCRIPT_DIR"/lighttpd_packages.zip -d "$SCRIPT_DIR"/lighttpd_packages + unzip -o "$SCRIPT_DIR"/lighttpd_packages.zip -d "$SCRIPT_DIR"/lighttpd_packages sudo chown -R pioreactor:pioreactor "$SCRIPT_DIR"/lighttpd_packages # required so this can be deleted by pioreactor user if needed to run again. dpkg -i "$SCRIPT_DIR"/lighttpd_packages/*.deb @@ -77,8 +77,6 @@ if [ "$HOSTNAME" != "$LEADER_HOSTNAME" ]; then lighttpd -h flask --help - - # we need to restart the monitor jobs on the worker so that the new table (pio_job_metadata) and db exist first systemctl restart pioreactor_startup_run@monitor.service sleep 5 @@ -91,7 +89,7 @@ if [ "$HOSTNAME" != "$LEADER_HOSTNAME" ]; then systemctl start lighttpd.service systemctl start huey.service - sleep 1 + sleep 2 # test: curl -LI localhost/unit_api/jobs/running