Fixing script to add more time for startup and add backup crons for database

This commit is contained in:
2024-10-02 13:21:49 -07:00
parent 565482764d
commit b3e284a547
2 changed files with 18 additions and 6 deletions

View File

@@ -36,16 +36,19 @@ if [ -z "$name" ]; then
echo "Name not set, please set it with -n"
exit 1
fi
if [ -z "$phpver" ]; then
phpver=83;
fi
echo "Building Docker Image..."
user=$(whoami)
uid=$(id -u)
if [ ! -d "$root_path/db" ]; then
mkdir -p "$root_path/db";
fi
if [ ! -d "$root_path/web" ]; then
mkdir -p "$root_path/web";
fi
$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 volume create "$name-mysql"
$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 "#!/usr/bin/env bash" > "$root_path/instance_start"
echo "docker start $name" >> "$root_path/instance_start"
@@ -56,8 +59,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 "docker exec $name cat /var/lib/mysql/creds" >> "$root_path/instance_db_info"
chmod +x $root_path/instance_*
echo "Waiting 120 seconds for setup to finish"
sleep 120;
echo "Waiting 160 seconds for setup to finish"
sleep 160;
echo "Installing WordPress..."
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'})