From b2cf9e1d7d04621c32cca4b93ed43a256cce8858 Mon Sep 17 00:00:00 2001 From: pshankinclarke Date: Mon, 1 Dec 2025 18:18:43 -0800 Subject: [PATCH 1/2] test memory tuning --- ct/valkey.sh | 2 +- install/valkey-install.sh | 12 ++++++++++++ misc/build.func | 22 +++++++++++----------- misc/install.func | 8 ++++---- 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/ct/valkey.sh b/ct/valkey.sh index 2c1506e9c31..efd410cebe6 100644 --- a/ct/valkey.sh +++ b/ct/valkey.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +source <(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/build.func) # Copyright (c) 2021-2025 community-scripts ORG # Author: pshankinclarke (lazarillo) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE diff --git a/install/valkey-install.sh b/install/valkey-install.sh index 3d1be73fb50..d855eac5bb7 100644 --- a/install/valkey-install.sh +++ b/install/valkey-install.sh @@ -17,10 +17,22 @@ msg_info "Installing Valkey" $STD apt update $STD apt install -y valkey openssl sed -i 's/^bind .*/bind 0.0.0.0/' /etc/valkey/valkey.conf + PASS="$(openssl rand -base64 48 | tr -dc 'a-zA-Z0-9' | head -c32)" echo "requirepass $PASS" >> /etc/valkey/valkey.conf echo "$PASS" >~/valkey.creds chmod 600 ~/valkey.creds + +MEMTOTAL_MB=$(free -m | grep ^Mem: | awk '{print $2}') +# reserve 25% of a node type's maxmemory value for system use +MAXMEMORY_MB=$((MEMTOTAL_MB * 75 / 100)) + +echo "" >> /etc/valkey/valkey.conf +echo "# Memory-optimized settings for small-scale deployments" >> /etc/valkey/valkey.conf +echo "maxmemory ${MAXMEMORY_MB}mb" >> /etc/valkey/valkey.conf +echo "maxmemory-policy allkeys-lru" >> /etc/valkey/valkey.conf +echo "maxmemory-samples 10" >> /etc/valkey/valkey.conf + systemctl enable -q --now valkey-server systemctl restart valkey-server msg_ok "Installed Valkey" diff --git a/misc/build.func b/misc/build.func index d895d3c8d81..0ed58df3ca8 100644 --- a/misc/build.func +++ b/misc/build.func @@ -15,13 +15,13 @@ variables() { CT_TYPE=${var_unprivileged:-$CT_TYPE} } -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) +source <(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/api.func) if command -v curl >/dev/null 2>&1; then - source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func) + source <(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/core.func) load_functions elif command -v wget >/dev/null 2>&1; then - source <(wget -qO- https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func) + source <(wget -qO- https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/core.func) load_functions fi # This function enables error handling in the script by setting options and defining a trap for the ERR signal. @@ -32,7 +32,7 @@ catch_errors() { # This function is called when an error occurs. It receives the exit code, line number, and command that caused the error, and displays an error message. error_handler() { - source /dev/stdin <<<$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) + source /dev/stdin <<<$(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/api.func) printf "\e[?25h" local exit_code="$?" local line_number="$1" @@ -994,7 +994,7 @@ install_script() { header_info echo -e "${INFO}${HOLD} ${GN}Using Config File on node $PVEHOST_NAME${CL}" METHOD="config_file" - source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/config-file.func) + source <(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/config-file.func) config_file break ;; @@ -1065,7 +1065,7 @@ check_container_storage() { } start() { - source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/tools.func) + source <(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/tools.func) if command -v pveversion >/dev/null 2>&1; then install_script else @@ -1127,9 +1127,9 @@ build_container() { TEMP_DIR=$(mktemp -d) pushd "$TEMP_DIR" >/dev/null if [ "$var_os" == "alpine" ]; then - export FUNCTIONS_FILE_PATH="$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/alpine-install.func)" + export FUNCTIONS_FILE_PATH="$(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/alpine-install.func)" else - export FUNCTIONS_FILE_PATH="$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/install.func)" + export FUNCTIONS_FILE_PATH="$(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/install.func)" fi export DIAGNOSTICS="$DIAGNOSTICS" @@ -1164,7 +1164,7 @@ build_container() { $PW " # This executes create_lxc.sh and creates the container and .conf file - bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/create_lxc.sh)" $? + bash -c "$(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/create_lxc.sh)" $? LXC_CONFIG="/etc/pve/lxc/${CTID}.conf" @@ -1358,7 +1358,7 @@ EOF' fi msg_ok "Customized LXC Container" - lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/install/${var_install}.sh)" + lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/install/${var_install}.sh)" } # This function sets the description of the container. @@ -1370,7 +1370,7 @@ description() { cat < - Logo + Logo

${APP} LXC

diff --git a/misc/install.func b/misc/install.func index bd51cde15c1..110894c67bd 100644 --- a/misc/install.func +++ b/misc/install.func @@ -9,7 +9,7 @@ if ! command -v curl >/dev/null 2>&1; then apt-get update >/dev/null 2>&1 apt-get install -y curl >/dev/null 2>&1 fi -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func) +source <(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/core.func) load_functions # This function enables IPv6 if it's not disabled and sets verbose mode verb_ip6() { @@ -37,7 +37,7 @@ catch_errors() { # This function handles errors error_handler() { - source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) + source <(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/api.func) printf "\e[?25h" local exit_code="$?" local line_number="$1" @@ -155,7 +155,7 @@ EOF rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED msg_ok "Updated Container OS" - source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/tools.func) + source <(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/tools.func) } # This function modifies the message of the day (motd) and SSH settings @@ -205,7 +205,7 @@ EOF systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//') msg_ok "Customized Container" fi - echo "bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/${app}.sh)\"" >/usr/bin/update + echo "bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/ct/${app}.sh)\"" >/usr/bin/update chmod +x /usr/bin/update if [[ -n "${SSH_AUTHORIZED_KEY}" ]]; then From dce557d41687e8db4aab83b63321c1621138e3e3 Mon Sep 17 00:00:00 2001 From: pshankinclarke Date: Mon, 1 Dec 2025 19:04:22 -0800 Subject: [PATCH 2/2] revert urls to upstream --- ct/valkey.sh | 2 +- misc/build.func | 22 +++++++++++----------- misc/install.func | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ct/valkey.sh b/ct/valkey.sh index efd410cebe6..2c1506e9c31 100644 --- a/ct/valkey.sh +++ b/ct/valkey.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/build.func) +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) # Copyright (c) 2021-2025 community-scripts ORG # Author: pshankinclarke (lazarillo) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE diff --git a/misc/build.func b/misc/build.func index 0ed58df3ca8..d895d3c8d81 100644 --- a/misc/build.func +++ b/misc/build.func @@ -15,13 +15,13 @@ variables() { CT_TYPE=${var_unprivileged:-$CT_TYPE} } -source <(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/api.func) +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) if command -v curl >/dev/null 2>&1; then - source <(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/core.func) + source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func) load_functions elif command -v wget >/dev/null 2>&1; then - source <(wget -qO- https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/core.func) + source <(wget -qO- https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func) load_functions fi # This function enables error handling in the script by setting options and defining a trap for the ERR signal. @@ -32,7 +32,7 @@ catch_errors() { # This function is called when an error occurs. It receives the exit code, line number, and command that caused the error, and displays an error message. error_handler() { - source /dev/stdin <<<$(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/api.func) + source /dev/stdin <<<$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) printf "\e[?25h" local exit_code="$?" local line_number="$1" @@ -994,7 +994,7 @@ install_script() { header_info echo -e "${INFO}${HOLD} ${GN}Using Config File on node $PVEHOST_NAME${CL}" METHOD="config_file" - source <(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/config-file.func) + source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/config-file.func) config_file break ;; @@ -1065,7 +1065,7 @@ check_container_storage() { } start() { - source <(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/tools.func) + source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/tools.func) if command -v pveversion >/dev/null 2>&1; then install_script else @@ -1127,9 +1127,9 @@ build_container() { TEMP_DIR=$(mktemp -d) pushd "$TEMP_DIR" >/dev/null if [ "$var_os" == "alpine" ]; then - export FUNCTIONS_FILE_PATH="$(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/alpine-install.func)" + export FUNCTIONS_FILE_PATH="$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/alpine-install.func)" else - export FUNCTIONS_FILE_PATH="$(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/install.func)" + export FUNCTIONS_FILE_PATH="$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/install.func)" fi export DIAGNOSTICS="$DIAGNOSTICS" @@ -1164,7 +1164,7 @@ build_container() { $PW " # This executes create_lxc.sh and creates the container and .conf file - bash -c "$(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/create_lxc.sh)" $? + bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/create_lxc.sh)" $? LXC_CONFIG="/etc/pve/lxc/${CTID}.conf" @@ -1358,7 +1358,7 @@ EOF' fi msg_ok "Customized LXC Container" - lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/install/${var_install}.sh)" + lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/install/${var_install}.sh)" } # This function sets the description of the container. @@ -1370,7 +1370,7 @@ description() { cat < - Logo + Logo

${APP} LXC

diff --git a/misc/install.func b/misc/install.func index 110894c67bd..bd51cde15c1 100644 --- a/misc/install.func +++ b/misc/install.func @@ -9,7 +9,7 @@ if ! command -v curl >/dev/null 2>&1; then apt-get update >/dev/null 2>&1 apt-get install -y curl >/dev/null 2>&1 fi -source <(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/core.func) +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func) load_functions # This function enables IPv6 if it's not disabled and sets verbose mode verb_ip6() { @@ -37,7 +37,7 @@ catch_errors() { # This function handles errors error_handler() { - source <(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/api.func) + source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) printf "\e[?25h" local exit_code="$?" local line_number="$1" @@ -155,7 +155,7 @@ EOF rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED msg_ok "Updated Container OS" - source <(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/misc/tools.func) + source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/tools.func) } # This function modifies the message of the day (motd) and SSH settings @@ -205,7 +205,7 @@ EOF systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//') msg_ok "Customized Container" fi - echo "bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVE/refs/heads/valkey-mem/ct/${app}.sh)\"" >/usr/bin/update + echo "bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/${app}.sh)\"" >/usr/bin/update chmod +x /usr/bin/update if [[ -n "${SSH_AUTHORIZED_KEY}" ]]; then