mariadb/install.sh
2024-09-21 04:01:05 +05:00

28 lines
763 B
Bash

#!/bin/bash
if [ "$(id -u)" != "0" ]; then
echo -e "\033[31mThis script requires superuser rights.\033[0m"
exit 0
fi
trap 'echo -e "\033[31minstall.sh: Something went wrong\033[0m"; exit 1' ERR
set -e
export DEBIAN_FRONTEND=noninteractive
echo "Install mariadb..."
cd /data/utils
bash global-env.sh MARIADB_USER admin
bash global-env.sh MARIADB_DB mariadb
sudo bash env-gen.sh MARIADB_ROOT_PASSWORD
MARIADBPASSWORD=$(pwgen -s 20 1);
sudo bash env-gen.sh MARIADB_PASSWORD $MARIADBPASSWORD
sudo bash env-gen.sh WORDPRESS_DB_PASSWORD $MARIADBPASSWORD
sudo bash env-gen.sh WP_ADMIN_PASSWORD
mkdir -p /data/appdata/mariadb
sudo chown -R 1001:1001 /data/appdata/mariadb
cd /data/mariadb
sudo docker compose up -d
trap - ERR
echo "Install postgres complete"