Skip to content

Commit e394dd0

Browse files
MickLesktremor021
andauthored
Alpine MariaDB (#3456)
* Alpine-MariaDB * fix deps * Update install/alpine-mariadb-install.sh Co-authored-by: Slaviša Arežina <[email protected]> * space --------- Co-authored-by: Slaviša Arežina <[email protected]>
1 parent 5d50d91 commit e394dd0

File tree

3 files changed

+116
-0
lines changed

3 files changed

+116
-0
lines changed

ct/alpine-mariadb.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env bash
2+
source <(curl -fsSL 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://mariadb.org
7+
8+
APP="Alpine-MariaDB"
9+
var_tags="${var_tags:-alpine;database}"
10+
var_cpu="${var_cpu:-1}"
11+
var_ram="${var_ram:-256}"
12+
var_disk="${var_disk:-1}"
13+
var_os="${var_os:-alpine}"
14+
var_version="${var_version:-3.21}"
15+
var_unprivileged="${var_unprivileged:-1}"
16+
17+
header_info "$APP"
18+
variables
19+
color
20+
catch_errors
21+
22+
function update_script() {
23+
msg_info "Updating Alpine Packages"
24+
$STD apk update
25+
$STD apk upgrade
26+
msg_ok "Updated Alpine Packages"
27+
28+
msg_info "Updating MariaDB"
29+
$STD apk upgrade mariadb mariadb-client
30+
msg_ok "Updated MariaDB"
31+
32+
msg_info "Restarting MariaDB"
33+
$STD rc-service mariadb restart
34+
msg_ok "Restarted MariaDB"
35+
36+
exit 0
37+
}
38+
39+
start
40+
build_container
41+
description
42+
43+
msg_ok "Completed Successfully!\n"
44+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
45+
echo -e "${INFO}${YW} Access it using the following IP:${CL}"
46+
echo -e "${TAB}${GATEWAY}${BGN}${IP}:3306${CL}"

frontend/public/json/mariadb.json

Lines changed: 11 additions & 0 deletions
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-mariadb.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": {

install/alpine-mariadb-install.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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://mariadb.org/
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+
gpg \
19+
sudo
20+
msg_ok "Installed Dependencies"
21+
22+
msg_info "Installing MariaDB"
23+
$STD apk add --no-cache mariadb mariadb-client
24+
$STD rc-update add mariadb default
25+
$STD rc-service mariadb start
26+
msg_ok "Installed MariaDB"
27+
28+
msg_info "Configuring MariaDB"
29+
mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql >/dev/null 2>&1
30+
$STD rc-service mariadb restart
31+
msg_ok "MariaDB Configured"
32+
33+
read -r -p "Would you like to install Adminer with lighthttpd? <y/N>: " prompt
34+
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
35+
msg_info "Installing Adminer"
36+
$STD apk add --no-cache lighttpd php php-cgi php-mysqli php-mbstring php-zip php-gd php-json php-curl jq
37+
sed -i 's|server.modules += ( "mod_cgi" )|server.modules += ( "mod_cgi", "mod_fastcgi" )|' /etc/lighttpd/lighttpd.conf
38+
echo 'fastcgi.server += ( ".php" => (( "bin-path" => "/usr/bin/php-cgi", "socket" => "/var/run/php-cgi.sock" )))' >>/etc/lighttpd/lighttpd.conf
39+
ADMINER_VERSION=$(curl -s https://api.github.com/repos/vrana/adminer/releases/latest | jq -r '.tag_name' | sed 's/v//')
40+
wget -q -O /var/www/adminer.php "https://github.com/vrana/adminer/releases/download/v${ADMINER_VERSION}/adminer-${ADMINER_VERSION}.php"
41+
chown lighttpd:lighttpd /var/www/adminer.php
42+
chmod 755 /var/www/adminer.php
43+
msg_ok "Adminer Installed"
44+
45+
msg_info "Starting Lighttpd"
46+
$STD rc-update add lighttpd default
47+
$STD rc-service lighttpd restart
48+
msg_ok "Lighttpd Started"
49+
50+
echo -e "Adminer is available at: ${BL}http://$(hostname -I | awk '{print $1}')/adminer${CL}"
51+
else
52+
echo -e "Skipped Adminer Installation..."
53+
fi
54+
55+
motd_ssh
56+
customize
57+
58+
msg_info "Cleaning up"
59+
msg_ok "Cleaned"

0 commit comments

Comments
 (0)