merge PostgreSQL to tools.func Installer (#4752)

* Update tools.func

* Merge PostgreSQL to tools.func Installer
This commit is contained in:
CanbiZ
2025-05-27 15:28:05 +02:00
committed by GitHub
parent 8708980786
commit 58586cbfc8
7 changed files with 23 additions and 33 deletions

View File

@@ -15,25 +15,26 @@ update_os
msg_info "Installing Dependencies"
$STD apt-get install -y \
postgresql \
apache2 \
libapache2-mod-php \
php-{pgsql,dom}
apache2 \
libapache2-mod-php \
php-{pgsql,dom}
msg_ok "Installed Dependencies"
msg_info "Setting up PostgreSQL"
PG_VERSION="16" install_postgresql
msg_info "Setting up PostgreSQL Database"
DB_NAME=baikal
DB_USER=baikal
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER TEMPLATE template0;"
{
echo "Baikal Credentials"
echo "Baikal Database User: $DB_USER"
echo "Baikal Database Password: $DB_PASS"
echo "Baikal Database Name: $DB_NAME"
echo "Baikal Credentials"
echo "Baikal Database User: $DB_USER"
echo "Baikal Database Password: $DB_PASS"
echo "Baikal Database Name: $DB_NAME"
} >>~/baikal.creds
msg_ok "Set up PostgreSQL"
msg_ok "Set up PostgreSQL Database"
msg_info "Installing Baikal"
RELEASE=$(curl -fsSL https://api.github.com/repos/sabre-io/Baikal/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')