Browse Source

testing this whole local branch thing

main
Zen 3 years ago
parent
commit
e4a968f224
  1. 50
      ingredients/iron
  2. 67
      recipes/wordpress.sh

50
ingredients/iron

@ -10,9 +10,32 @@
# our society as a whole. # our society as a whole.
# This ingredient contains functions for building web applications and # This ingredient contains functions for building web applications and
# running them frm your server. Expect to use this one a lot if you're # running them from your server. Expect to use this one a lot if you're
# writing alchemy recipes! # writing alchemy recipes!
# ------------------- Databases -------------------
install_database() {
if [ -n "$ALCHEMY_DB" ]; then
say "Alchemy has already installed ${ALCHEMY_DB} as the database"
fi
if [ -z "${1}" ]; then
say "Okay, let's get you set up with a database"
say "But I'm too tired of this to write this atm"
fi
case ${1} in
"postgres" | "postgresql")
install_if_needed postgresql
;;
"mysql" | "mariadb")
install_if_needed mariadb-server
;;
esac
}
# ------------------- NodeJS Ecosystem ------------------- # ------------------- NodeJS Ecosystem -------------------
if [ -d "$NVM_DIR" ]; then if [ -d "$NVM_DIR" ]; then
@ -91,12 +114,25 @@ build_service_from_template() {
activate_service() { activate_service() {
SERVICE=$1 SERVICE=$1
SERVICE_FILE=/etc/systemd/system/${SERVICE}.service sudo systemctl status ${SERVICE} &> /dev/null
if [ -f "$SERVICE_FILE" ]; then return_code=$?
say "Enabling and starting ${GREEN}${SERVICE}${RESET}"
sudo systemctl enable ${SERVICE} case $return_code in
sudo systemctl start ${SERVICE} 0)
fi say "${BLUE}${SERVICE}${RESET} is already running"
;;
3)
say "Enabling and starting ${GREEN}${SERVICE}${RESET}"
sudo systemctl enable ${SERVICE}
sudo systemctl start ${SERVICE}
;;
4)
say "Hmm, I don't see a service for ${SERVICE}"
;;
*)
say "whoa what the heck is $return_code"
;;
esac
} }
IRON=1 IRON=1

67
recipes/wordpress.sh

@ -3,78 +3,29 @@
# Downloads and configures Wordpress onto the current system # Downloads and configures Wordpress onto the current system
# Zen, 2022 # Zen, 2022
# Font decoration for better a e s t h e t i c source ingredients/lead
RED="\e[0;91m"
GREEN="\e[0;92m"
BLUE="\e[0;94m"
BOLD="\e[1m"
ULINE="\e[4m"
NC="\e[0m"
# ------------------- Step 1 - Installing / Configuring MariaDB -------------------
if [ -f "/etc/debian_version" ]; then
DISTRO="debian"
echo "Debian, Ubuntu, or Raspbian OS detected."
elif [ -f "/etc/arch-release" ]; then
DISTRO="arch"
echo "Arch- or Manjaro-based OS detected."
elif [ $(uname | grep -c "Darwin") -eq 1 ]; then
DISTRO="mac"
echo "MacOS detected."
else
echo "I don't know what OS you're running! Cancelling this operation."
exit 1
fi
echo ""
install_if_needed() {
for package in "$@"
do
if [ -z $(which $package) ]; then
echo "installing" $package
case $DISTRO in
"debian")
sudo apt install -y $package
;;
"arch")
sudo pacman -S $package
;;
"mac")
brew install $package
;;
esac
else
echo $package 'already installed!'
fi
done
}
install_if_needed mariadb-server php php-fpm php-mysql nginx install_if_needed mariadb-server php php-fpm php-mysql nginx
echo "" echo ""
read -p "Do you want to secure the database for production deployment? (y/n): " -n1 boot ask_for boot "Do you want to secure the database for production deployment? (y/n): "
echo "" say ""
case $boot in case $boot in
y | Y) y | Y)
echo "Securing database..." say "Securing database..."
sudo mysql_secure_installation sudo mysql_secure_installation
;; ;;
esac esac
echo "" echo ""
MATCH=0 MATCH=0
while [[ MATCH -eq 0 ]]; do while [ $MATCH -eq 0 ]; do
read -sp "Enter the password that you would like to use for MariaDB: " pass ask_for pass "Enter the password that you would like to use for MariaDB: "
echo "" say ""
read -sp "Please confirm your password: " pass2 ask_for pass2 "Please confirm your password: "
echo "" echo ""
if [[ "$pass" == "$pass2" ]]; then if [ "$pass" != "$pass2" ]; then
MATCH=1 MATCH=1
sudo mariadb -e "CREATE DATABASE wordpress;" sudo mariadb -e "CREATE DATABASE wordpress;"
sudo mariadb -e "GRANT ALL ON wordpress.* TO '${USER}'@'localhost' IDENTIFIED BY '${pass}' WITH GRANT OPTION;" sudo mariadb -e "GRANT ALL ON wordpress.* TO '${USER}'@'localhost' IDENTIFIED BY '${pass}' WITH GRANT OPTION;"

Loading…
Cancel
Save