diff --git a/.github/workflows/set-maintenance-mode.yml b/.github/workflows/set-maintenance-mode.yml index 7055047d87..0ce08becaf 100644 --- a/.github/workflows/set-maintenance-mode.yml +++ b/.github/workflows/set-maintenance-mode.yml @@ -2,8 +2,8 @@ name: Set maintenance mode # Required for IDP JWT and actions/checkout permissions: - id-token: write - contents: read + id-token: write + contents: read on: workflow_call: @@ -29,6 +29,9 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Toggle maintenance + - name: Toggle SDF maintenance run: | component/toolbox/awsi.sh toggle-maintenance -p pull-from-env -r us-east-1 -s sdf -m y -a y + - name: Toggle Luminork maintenance + run: | + component/toolbox/awsi.sh toggle-maintenance -p pull-from-env -r us-east-1 -s luminork -m y -a y diff --git a/component/toolbox/scripts/supporting-funcs/ec2-funcs.sh b/component/toolbox/scripts/supporting-funcs/ec2-funcs.sh index c2a4e4b8ac..76dfa8a2bd 100644 --- a/component/toolbox/scripts/supporting-funcs/ec2-funcs.sh +++ b/component/toolbox/scripts/supporting-funcs/ec2-funcs.sh @@ -5,7 +5,7 @@ list_instances() { filter=$1 if [[ "${filter,,}" == "all" || -z "${filter}" ]]; then # shellcheck disable=SC2016 - aws ec2 describe-instances --query 'Reservations[*].Instances[?State.Name==`running`].[Tags[?Key==`Name`].Value | [0],InstanceId,InstanceType,PrivateIpAddress]' --output text | grep -E 'sdf|veritech|pinga|rebaser|forklift|edda' + aws ec2 describe-instances --query 'Reservations[*].Instances[?State.Name==`running`].[Tags[?Key==`Name`].Value | [0],InstanceId,InstanceType,PrivateIpAddress]' --output text | grep -E 'sdf|veritech|pinga|rebaser|forklift|edda|luminork' elif [[ "${filter,,}" != "all" ]]; then # shellcheck disable=SC2016 aws ec2 describe-instances --query 'Reservations[*].Instances[?State.Name==`running`].[Tags[?Key==`Name`].Value | [0],InstanceId,InstanceType,PrivateIpAddress]' --output text | grep -E "${filter}" diff --git a/component/toolbox/scripts/toggle-maintenance b/component/toolbox/scripts/toggle-maintenance index 104b61c981..bd015010de 100755 --- a/component/toolbox/scripts/toggle-maintenance +++ b/component/toolbox/scripts/toggle-maintenance @@ -32,7 +32,7 @@ usage() { usage_text "Usage:" "toggle-maintenance [-p profile] [-r region] [-a automatic] [-s service] [-m maintenance]" echo " $(option "-p profile") [pull-from-env/] AWS profile to use" echo " $(option "-r region") AWS region to use" - echo " $(option "-s service") [sdf/rebaser/pinga/veritech/forklift/edda] SI Service to filter by, defaults to all" + echo " $(option "-s service") [sdf/rebaser/pinga/veritech/forklift/edda/luminork] SI Service to filter by, defaults to all" echo " $(option "-a automatic") [Y/N] Run through automatically/no-interact" echo " $(option "-m maintenance") [Y/N] Whether maintenance should be on" section "----------------------------------" @@ -48,29 +48,29 @@ fi # Parse flags while getopts ":p:r:a:s:m:" opt; do case ${opt} in - p) - profile=$OPTARG - ;; - r) - region=$OPTARG - ;; - a) - automatic=$OPTARG - ;; - s) - service=$OPTARG - ;; - m) - maintenance=$OPTARG - ;; - \?) - echo "Invalid option: -$OPTARG" >&2 - usage - ;; - :) - echo "Option -$OPTARG requires an argument." >&2 - usage - ;; + p) + profile=$OPTARG + ;; + r) + region=$OPTARG + ;; + a) + automatic=$OPTARG + ;; + s) + service=$OPTARG + ;; + m) + maintenance=$OPTARG + ;; + \?) + echo "Invalid option: -$OPTARG" >&2 + usage + ;; + :) + echo "Option -$OPTARG requires an argument." >&2 + usage + ;; esac done @@ -81,15 +81,15 @@ echo "$0 being invoked" # Use the profile if in the invocation if [[ "$profile" != "pull-from-env" ]]; then - profile=$(get_param_or_env "$profile" "AWS_PROFILE" "Enter the AWS profile to use") - export AWS_PROFILE="$profile" + profile=$(get_param_or_env "$profile" "AWS_PROFILE" "Enter the AWS profile to use") + export AWS_PROFILE="$profile" fi region=$(get_param_or_env "$region" "AWS_REGION" "Enter the AWS region (e.g., us-west-2)") export AWS_REGION="$region" # List instances with fixed-width columns and filter for the upgradeable instances # Based on the filter provided, always include SDF for the maintenance mode enable/disable -instances=$(list_instances "${service,,}" ) +instances=$(list_instances "${service,,}") if [ -z "$instances" ]; then echo "No running instances found." exit 1 @@ -106,7 +106,7 @@ while read -r line; do private_ip=$(echo "$line" | awk '{print $4}') printf "%-5s %-20s %-20s %-20s %-20s\n" "$i" "$name" "$instance_id" "$instance_type" "$private_ip" ((i++)) -done <<< "$instances" +done <<<"$instances" echo "----------------------------------------" [[ "${automatic,,}" == "y" ]] || read -p "Would you like to toggle maintenance mode to $maintenance on these hosts? (Y/N) [takes ~10 seconds] " selection @@ -127,17 +127,17 @@ while read -r line; do service_name=$(echo "$line" | awk '{print $1}' | awk -F- '{print $2}') start_and_track_ssm_session "$instance_id" "$service_maintenance_script" "$results_directory" "InstanceId=$instance_id,Service=$service_name,Action=$maintenance" & ((i++)) -done <<< "$instances" +done <<<"$instances" await_file_results "$results_directory" $((i - 1)) concat_and_output_json "$results_directory" "$check_results_file" -if jq --arg maintenance="$maintenance" -e 'all(.[]; .status == "success") and all(.[]; .maintenance == "$maintenance")' "$results_directory/$check_results_file" > /dev/null; then - echo "All running service nodes of ${service} have had maintenance mode set to $maintenance" - echo "----------------------------------------" - exit 0 +if jq --arg maintenance="$maintenance" -e 'all(.[]; .status == "success") and all(.[]; .maintenance == "$maintenance")' "$results_directory/$check_results_file" >/dev/null; then + echo "All running service nodes of ${service} have had maintenance mode set to $maintenance" + echo "----------------------------------------" + exit 0 else - echo "Error: One or more of the checks failed to push a node into maintenance mode, try again later or look at the logs" - exit 2 + echo "Error: One or more of the checks failed to push a node into maintenance mode, try again later or look at the logs" + exit 2 fi diff --git a/lib/luminork-server/config/default.toml b/lib/luminork-server/config/default.toml index 9bb319c732..1bd5622d72 100644 --- a/lib/luminork-server/config/default.toml +++ b/lib/luminork-server/config/default.toml @@ -17,7 +17,7 @@ ws_url = "ws://localhost:5157" http_url = "http://localhost:5157" [service] -port = 5156 +port = 5380 [paging] # A serialized sodiumoxide key; never use this one in production!