Add Alpine-Valkey LXC support

This commit is contained in:
pshankinclarke 2025-12-01 21:41:21 -08:00
parent 70791715d5
commit 7465fc1044
3 changed files with 28 additions and 28 deletions

View File

@ -1,11 +1,11 @@
#!/usr/bin/env bash #!/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/ProxmoxVED/refs/heads/valkey-alpine/misc/build.func)
# Copyright (c) 2021-2025 community-scripts ORG # Copyright (c) 2021-2025 community-scripts ORG
# Author: MickLesk (CanbiZ) # Author: pshankinclarke (lazarillo)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://redis.io/ # Source: https://valkey.io/
APP="Alpine-Redis" APP="Alpine-Valkey"
var_tags="${var_tags:-alpine;database}" var_tags="${var_tags:-alpine;database}"
var_cpu="${var_cpu:-1}" var_cpu="${var_cpu:-1}"
var_ram="${var_ram:-256}" var_ram="${var_ram:-256}"
@ -26,8 +26,8 @@ function update_script() {
LXCIP=$(ip a s dev eth0 | awk '/inet / {print $2}' | cut -d/ -f1) LXCIP=$(ip a s dev eth0 | awk '/inet / {print $2}' | cut -d/ -f1)
while true; do while true; do
CHOICE=$( CHOICE=$(
whiptail --backtitle "Proxmox VE Helper Scripts" --title "Redis Management" --menu "Select option" 11 58 3 \ whiptail --backtitle "Proxmox VE Helper Scripts" --title "Valkey Management" --menu "Select option" 11 58 3 \
"1" "Update Redis" \ "1" "Update Valkey" \
"2" "Allow 0.0.0.0 for listening" \ "2" "Allow 0.0.0.0 for listening" \
"3" "Allow only ${LXCIP} for listening" 3>&2 2>&1 1>&3 "3" "Allow only ${LXCIP} for listening" 3>&2 2>&1 1>&3
) )
@ -39,24 +39,24 @@ function update_script() {
header_info header_info
case $CHOICE in case $CHOICE in
1) 1)
msg_info "Updating Redis" msg_info "Updating Valkey"
apk update && apk upgrade redis apk update && apk upgrade valkey
rc-service redis restart rc-service valkey restart
msg_ok "Updated successfully!" msg_ok "Updated successfully!"
exit exit
;; ;;
2) 2)
msg_info "Setting Redis to listen on all interfaces" msg_info "Setting Valkey to listen on all interfaces"
sed -i 's/^bind .*/bind 0.0.0.0/' /etc/redis.conf sed -i 's/^bind .*/bind 0.0.0.0/' /etc/valkey/valkey.conf
rc-service redis restart rc-service valkey restart
msg_ok "Redis now listens on all interfaces!" msg_ok "Valkey now listens on all interfaces!"
exit exit
;; ;;
3) 3)
msg_info "Setting Redis to listen only on ${LXCIP}" msg_info "Setting Valkey to listen only on ${LXCIP}"
sed -i "s/^bind .*/bind ${LXCIP}/" /etc/redis.conf sed -i "s/^bind .*/bind ${LXCIP}/" /etc/valkey/valkey.conf
rc-service redis restart rc-service valkey restart
msg_ok "Redis now listens only on ${LXCIP}!" msg_ok "Valkey now listens only on ${LXCIP}!"
exit exit
;; ;;
esac esac
@ -69,4 +69,4 @@ description
msg_ok "Completed Successfully!\n" msg_ok "Completed Successfully!\n"
echo -e "${APP} should be reachable on port 6379. echo -e "${APP} should be reachable on port 6379.
${BL}redis-cli -h ${IP} -p 6379${CL} \n" ${BL}valkey-cli -h ${IP} -p 6379${CL} \n"

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Copyright (c) 2021-2025 community-scripts ORG # Copyright (c) 2021-2025 community-scripts ORG
# Author: MickLesk (CanbiZ) # Author: pshankinclarke (lazarillo)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://redis.io/ # Source: https://valkey.io/
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color color
@ -13,12 +13,12 @@ setting_up_container
network_check network_check
update_os update_os
msg_info "Installing Redis" msg_info "Installing Valkey"
$STD apk add redis $STD apk add valkey valkey-openrc
$STD sed -i 's/^bind .*/bind 0.0.0.0/' /etc/redis.conf $STD sed -i 's/^bind .*/bind 0.0.0.0/' /etc/valkey/valkey.conf
$STD rc-update add redis default $STD rc-update add valkey default
$STD rc-service redis start $STD rc-service valkey start
msg_ok "Installed Redis" msg_ok "Installed Valkey"
motd_ssh motd_ssh
customize customize

View File

@ -2825,7 +2825,7 @@ EOF'
set +Eeuo pipefail # Disable ALL error handling temporarily set +Eeuo pipefail # Disable ALL error handling temporarily
trap - ERR # Remove ERR trap completely trap - ERR # Remove ERR trap completely
lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/install/${var_install}.sh)" lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVED/refs/heads/valkey-alpine/install/${var_install}.sh)"
local lxc_exit=$? local lxc_exit=$?
set -Eeuo pipefail # Re-enable error handling set -Eeuo pipefail # Re-enable error handling
@ -2909,7 +2909,7 @@ EOF'
if [[ "${DEV_MODE_MOTD:-false}" == "true" ]]; then if [[ "${DEV_MODE_MOTD:-false}" == "true" ]]; then
echo -e "${TAB}${HOLD}${DGN}Setting up MOTD and SSH for debugging...${CL}" echo -e "${TAB}${HOLD}${DGN}Setting up MOTD and SSH for debugging...${CL}"
if pct exec "$CTID" -- bash -c " if pct exec "$CTID" -- bash -c "
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/install.func) source <(curl -fsSL https://raw.githubusercontent.com/pshankinclarke/ProxmoxVED/refs/heads/valkey-alpine/misc/install.func)
declare -f motd_ssh >/dev/null 2>&1 && motd_ssh || true declare -f motd_ssh >/dev/null 2>&1 && motd_ssh || true
" >/dev/null 2>&1; then " >/dev/null 2>&1; then
local ct_ip=$(pct exec "$CTID" ip a s dev eth0 2>/dev/null | awk '/inet / {print $2}' | cut -d/ -f1) local ct_ip=$(pct exec "$CTID" ip a s dev eth0 2>/dev/null | awk '/inet / {print $2}' | cut -d/ -f1)