Skip to content

Commit 37b7894

Browse files
authored
Extension: Redis Alpine Installation (#3367)
* Extension: Redis Alpine Installation * change website note
1 parent c9b5579 commit 37b7894

File tree

3 files changed

+119
-1
lines changed

3 files changed

+119
-1
lines changed

ct/alpine-redis.sh

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/usr/bin/env bash
2+
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: MickLesk (CanbiZ)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://redis.io/
7+
8+
APP="Alpine-Redis"
9+
var_tags="alpine;database"
10+
var_cpu="1"
11+
var_ram="256"
12+
var_disk="1"
13+
var_os="alpine"
14+
var_version="3.21"
15+
var_unprivileged="1"
16+
17+
header_info "$APP"
18+
variables
19+
color
20+
catch_errors
21+
22+
function update_script() {
23+
if ! apk -e info newt >/dev/null 2>&1; then
24+
apk add -q newt
25+
fi
26+
LXCIP=$(ip a s dev eth0 | awk '/inet / {print $2}' | cut -d/ -f1)
27+
while true; do
28+
CHOICE=$(
29+
whiptail --backtitle "Proxmox VE Helper Scripts" --title "Redis Management" --menu "Select option" 11 58 3 \
30+
"1" "Update Redis" \
31+
"2" "Allow 0.0.0.0 for listening" \
32+
"3" "Allow only ${LXCIP} for listening" 3>&2 2>&1 1>&3
33+
)
34+
exit_status=$?
35+
if [ $exit_status == 1 ]; then
36+
clear
37+
exit-script
38+
fi
39+
header_info
40+
case $CHOICE in
41+
1)
42+
msg_info "Updating Redis"
43+
apk update && apk upgrade redis
44+
rc-service redis restart
45+
msg_ok "Redis updated successfully!"
46+
exit
47+
;;
48+
2)
49+
msg_info "Setting Redis to listen on all interfaces"
50+
sed -i 's/^bind .*/bind 0.0.0.0/' /etc/redis.conf
51+
rc-service redis restart
52+
msg_ok "Redis now listens on all interfaces!"
53+
exit
54+
;;
55+
3)
56+
msg_info "Setting Redis to listen only on ${LXCIP}"
57+
sed -i "s/^bind .*/bind ${LXCIP}/" /etc/redis.conf
58+
rc-service redis restart
59+
msg_ok "Redis now listens only on ${LXCIP}!"
60+
exit
61+
;;
62+
esac
63+
done
64+
}
65+
66+
start
67+
build_container
68+
description
69+
70+
msg_ok "Completed Successfully!\n"
71+
echo -e "${APP} should be reachable on port 6379.
72+
${BL}redis-cli -h ${IP} -p 6379${CL} \n"

frontend/public/json/redis.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@
2424
"os": "debian",
2525
"version": "12"
2626
}
27+
},
28+
{
29+
"type": "alpine",
30+
"script": "ct/alpine-redis.sh",
31+
"resources": {
32+
"cpu": 1,
33+
"ram": 256,
34+
"hdd": 1,
35+
"os": "alpine",
36+
"version": "3.21"
37+
}
2738
}
2839
],
2940
"default_credentials": {
@@ -32,7 +43,7 @@
3243
},
3344
"notes": [
3445
{
35-
"text": "Redis Configuration: `nano /etc/redis/redis.conf`",
46+
"text": "Redis Configuration: `nano /etc/redis/redis.conf` or in Alpine: `nano /etc/redis.conf`",
3647
"type": "info"
3748
}
3849
]

install/alpine-redis-install.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: MickLesk (CanbiZ)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://redis.io/
7+
8+
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apk add \
18+
newt \
19+
curl \
20+
openssh \
21+
nano \
22+
mc \
23+
gpg
24+
25+
msg_ok "Installed Dependencies"
26+
27+
msg_info "Installing Redis"
28+
$STD apk add redis
29+
$STD sed -i 's/^bind .*/bind 0.0.0.0/' /etc/redis.conf
30+
$STD rc-update add redis default
31+
$STD rc-service redis start
32+
msg_ok "Installed Redis"
33+
34+
motd_ssh
35+
customize

0 commit comments

Comments
 (0)