Compare commits
No commits in common. "7d988b338c70aaba736a8efb90d4bbe2e63bdae4" and "565482764d0747a3aae38630cd7400a0e64ee418" have entirely different histories.
7d988b338c
...
565482764d
15
local-dev.sh
15
local-dev.sh
@ -36,19 +36,16 @@ if [ -z "$name" ]; then
|
|||||||
echo "Name not set, please set it with -n"
|
echo "Name not set, please set it with -n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$phpver" ]; then
|
|
||||||
phpver=83;
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Building Docker Image..."
|
echo "Building Docker Image..."
|
||||||
user=$(whoami)
|
user=$(whoami)
|
||||||
uid=$(id -u)
|
uid=$(id -u)
|
||||||
|
if [ ! -d "$root_path/db" ]; then
|
||||||
|
mkdir -p "$root_path/db";
|
||||||
|
fi
|
||||||
if [ ! -d "$root_path/web" ]; then
|
if [ ! -d "$root_path/web" ]; then
|
||||||
mkdir -p "$root_path/web";
|
mkdir -p "$root_path/web";
|
||||||
fi
|
fi
|
||||||
$check_docker volume create "$name-mysql"
|
$check_docker run -d -p "$http_port":80 -p "$https_port":443 -e PHPVER="$phpver":83 -e environment=DEV --mount type=bind,source="$root_path"/web,target=/home/"$user"/public_html --mount type=bind,source="$root_path"/db,target=/var/lib/mysql -e uid="$uid" -e user="$user" -e domain="$name-local.dev" --name "$name" repo.anhonesthost.net/cloud-hosting-platform/cac:latest
|
||||||
$check_docker run --pull=always -d -p "$http_port":80 -p "$https_port":443 -e PHPVER=$phpver -e environment=DEV --mount type=bind,source="$root_path"/web,target=/home/"$user"/public_html -v"$name-mysql":/var/lib/mysql -e uid="$uid" -e user="$user" -e domain="$name-local.dev" --name "$name" repo.anhonesthost.net/cloud-hosting-platform/cac:latest
|
|
||||||
echo "Creating management scripts in root directory..."
|
echo "Creating management scripts in root directory..."
|
||||||
echo "#!/usr/bin/env bash" > "$root_path/instance_start"
|
echo "#!/usr/bin/env bash" > "$root_path/instance_start"
|
||||||
echo "docker start $name" >> "$root_path/instance_start"
|
echo "docker start $name" >> "$root_path/instance_start"
|
||||||
@ -59,8 +56,8 @@ echo "docker exec $name bash -c 'tail -f /etc/httpd/logs/*'" >> "$root_path/inst
|
|||||||
echo "#!/usr/bin/env bash" > "$root_path/instance_db_info"
|
echo "#!/usr/bin/env bash" > "$root_path/instance_db_info"
|
||||||
echo "docker exec $name cat /var/lib/mysql/creds" >> "$root_path/instance_db_info"
|
echo "docker exec $name cat /var/lib/mysql/creds" >> "$root_path/instance_db_info"
|
||||||
chmod +x $root_path/instance_*
|
chmod +x $root_path/instance_*
|
||||||
echo "Waiting 160 seconds for setup to finish"
|
echo "Waiting 120 seconds for setup to finish"
|
||||||
sleep 160;
|
sleep 120;
|
||||||
echo "Installing WordPress..."
|
echo "Installing WordPress..."
|
||||||
wpdbuser=$(docker exec $name cat /var/lib/mysql/creds |grep User| awk -F ": " {'print $2'})
|
wpdbuser=$(docker exec $name cat /var/lib/mysql/creds |grep User| awk -F ": " {'print $2'})
|
||||||
wpdbpass=$(docker exec $name cat /var/lib/mysql/creds |grep Password| awk -F ": " {'print $2'})
|
wpdbpass=$(docker exec $name cat /var/lib/mysql/creds |grep Password| awk -F ": " {'print $2'})
|
||||||
|
@ -21,9 +21,6 @@ chmod -R 755 /home/$user
|
|||||||
|
|
||||||
if [[ $environment == 'DEV' ]]; then
|
if [[ $environment == 'DEV' ]]; then
|
||||||
echo "Starting Dev Deployment"
|
echo "Starting Dev Deployment"
|
||||||
dnf install -y cronie
|
|
||||||
/usr/sbin/crond
|
|
||||||
mkdir -p /home/$user/public_html/_db_backups
|
|
||||||
dnf install -y MariaDB-server MariaDB-client memcached
|
dnf install -y MariaDB-server MariaDB-client memcached
|
||||||
nohup mysqld -umysql &
|
nohup mysqld -umysql &
|
||||||
if [ ! -f /var/lib/mysql/creds ]; then
|
if [ ! -f /var/lib/mysql/creds ]; then
|
||||||
@ -36,18 +33,12 @@ if [[ $environment == 'DEV' ]]; then
|
|||||||
mysql -e "CREATE USER '"$mysql_user"'@'localhost' IDENTIFIED BY '"$mysql_password"';"
|
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 "GRANT ALL PRIVILEGES ON *.* TO '"$mysql_user"'@'localhost' WITH GRANT OPTION;"
|
||||||
mysql -e "FLUSH PRIVILEGES;"
|
mysql -e "FLUSH PRIVILEGES;"
|
||||||
dt=$(date +%y%m%d-%T)
|
|
||||||
echo "*/15 * * * * root /usr/bin/mysqldump $mysql_db > /home/$user/public_html/_db_backups/$mysql_db.$dt.sql" >> /etc/crontab
|
|
||||||
echo "*/30 * * * * root /usr/bin/find /home/$user/public_html/_db_backups/ -type f -mmin +360 -delete" >> /etc/crontab
|
|
||||||
-type f -mmin +360
|
|
||||||
echo "MySQL User: "$mysql_user > /var/lib/mysql/creds
|
echo "MySQL User: "$mysql_user > /var/lib/mysql/creds
|
||||||
echo "MySQL Password: "$mysql_password >> /var/lib/mysql/creds
|
echo "MySQL Password: "$mysql_password >> /var/lib/mysql/creds
|
||||||
echo "MySQL Database: devdb_"$mysql_db >> /var/lib/mysql/creds
|
echo "MySQL Database: devdb_"$mysql_db >> /var/lib/mysql/creds
|
||||||
cat /var/lib/mysql/creds
|
cat /var/lib/mysql/creds
|
||||||
|
|
||||||
fi
|
fi
|
||||||
/usr/bin/memcached -d -u $user
|
/usr/bin/memcached -d -u $user
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $environment == 'PROD' ]]; then
|
if [[ $environment == 'PROD' ]]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user