2023-04-05 14:53:20 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-05-27 18:13:18 +00:00
|
|
|
if [ -z "$PHPVER" ]; then
|
|
|
|
PHPVER="81";
|
|
|
|
fi
|
|
|
|
|
2023-04-05 14:53:20 +00:00
|
|
|
adduser -u $uid $user
|
|
|
|
|
|
|
|
mkdir -p /home/$user/public_html
|
|
|
|
|
|
|
|
chown -R $user:$user /home/$user
|
|
|
|
chmod -R 755 /home/$user
|
|
|
|
|
2023-05-27 18:13:18 +00:00
|
|
|
/scripts/install-php$PHPVER.sh
|
|
|
|
|
2023-04-05 14:53:20 +00:00
|
|
|
/scripts/create-vhost.sh
|
|
|
|
/scripts/create-php-config.sh
|
|
|
|
|
|
|
|
/usr/sbin/httpd -k start
|
|
|
|
/usr/sbin/php-fpm -y /etc/php-fpm.conf
|
|
|
|
|
2023-04-07 00:27:02 +00:00
|
|
|
if [[ $environment == 'DEV' ]]; then
|
2023-04-05 14:53:20 +00:00
|
|
|
echo "Starting Dev Deployment"
|
2023-05-27 18:13:18 +00:00
|
|
|
dnf install -y MariaDB-server MariaDB-client memcached
|
2023-04-05 14:53:20 +00:00
|
|
|
nohup mysqld -umysql &
|
|
|
|
if [ ! -f /var/lib/mysql/creds ]; then
|
|
|
|
echo "Give MySQL a chance to finish starting..."
|
|
|
|
sleep 10
|
|
|
|
mysql_user=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 13 ; echo '')
|
|
|
|
mysql_password=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 18 ; echo '')
|
|
|
|
mysql_db=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 6 ; echo '')
|
|
|
|
mysql -e "CREATE DATABASE devdb_"$mysql_db";"
|
|
|
|
mysql -e "CREATE USER '"$mysql_user"'@'localhost' IDENTIFIED BY '"$mysql_password"';"
|
|
|
|
mysql -e "GRANT ALL PRIVILEGES ON *.* TO '"$mysql_user"'@'localhost' WITH GRANT OPTION;"
|
|
|
|
mysql -e "FLUSH PRIVILEGES;"
|
|
|
|
echo "MySQL User: "$mysql_user > /var/lib/mysql/creds
|
|
|
|
echo "MySQL Password: "$mysql_password >> /var/lib/mysql/creds
|
|
|
|
echo "MySQL Database: devdb_"$mysql_db >> /var/lib/mysql/creds
|
|
|
|
cat /var/lib/mysql/creds
|
|
|
|
fi
|
|
|
|
/usr/bin/memcached -d -u $user
|
|
|
|
fi
|
|
|
|
tail -f /etc/httpd/logs/*
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|