Update alpine-postgresql-install.sh

This commit is contained in:
CanbiZ 2025-04-08 16:03:59 +02:00
parent d5a34b9948
commit afe927269d

View File

@ -36,50 +36,37 @@ sed -i '/^host\s\+all\s\+all\s\+127.0.0.1\/32\s\+md5/ s/.*/host all all 0.0.0.0\
rc-service postgresql restart
msg_ok "Configured and Restarted PostgreSQL"
read -p "Do you want to install Adminer with Lighttpd? (y/N): " install_adminer
if [[ "$install_adminer" =~ ^[Yy]$ ]]; then
msg_info "Installing Adminer with Lighttpd"
apk add --no-cache php php-pdo_pgsql php-session php-json php-mbstring lighttpd
msg_ok "Installed Lighttpd and PHP"
read -r -p "Would you like to install Adminer with lighttpd? <y/N>: " prompt
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
msg_info "Installing Adminer and dependencies"
$STD apk add --no-cache \
lighttpd \
lighttpd-openrc \
php83 \
php83-cgi \
php83-common \
php83-curl \
php83-gd \
php83-mbstring \
php83-mysqli \
php83-mysqlnd \
php83-openssl \
php83-zip \
php83-session \
jq
msg_info "Downloading Adminer"
mkdir -p /var/www/adminer
curl -fsSL "https://www.adminer.org/latest.php" -o /var/www/adminer/index.php
chown -R lighttpd:lighttpd /var/www/adminer
msg_ok "Installed Adminer"
sed -i 's|# *include "mod_fastcgi.conf"|include "mod_fastcgi.conf"|' /etc/lighttpd/lighttpd.conf
mkdir -p /var/www/localhost/htdocs
ADMINER_VERSION=$(curl -fsSL https://api.github.com/repos/vrana/adminer/releases/latest | jq -r '.tag_name' | sed 's/^v//')
curl -fsSL "https://github.com/vrana/adminer/releases/download/v${ADMINER_VERSION}/adminer-${ADMINER_VERSION}.php" -o /var/www/localhost/htdocs/adminer.php
chown lighttpd:lighttpd /var/www/localhost/htdocs/adminer.php
chmod 755 /var/www/localhost/htdocs/adminer.php
msg_ok "Adminer Installed"
msg_info "Configuring Lighttpd"
echo 'server.modules = (
"mod_access",
"mod_alias",
"mod_fastcgi"
)
server.document-root = "/var/www/adminer"
server.port = 9000
server.bind = "0.0.0.0"
index-file.names = ("index.php")
fastcgi.server = ( ".php" => ((
"bin-path" => "/usr/bin/php-cgi",
"socket" => "/var/run/php-fcgi.sock"
)))
server.dir-listing = "disable"
accesslog.filename = "/var/log/lighttpd/access.log"
server.errorlog = "/var/log/lighttpd/error.log"
include "modules.conf"' >/etc/lighttpd/lighttpd.conf
rc-update add lighttpd default
msg_ok "Configured Lighttpd"
msg_info "Starting Lighttpd"
service lighttpd start
msg_ok "Started Lighttpd (Adminer available on Port 8080)"
else
msg_ok "Skipped Adminer and Lighttpd installation."
msg_info "Starting Lighttpd"
$STD rc-update add lighttpd default
$STD rc-service lighttpd restart
msg_ok "Lighttpd Started"
fi
motd_ssh