fix(ci): optimize ec2 deploy script, remove slow apt-get upgrade and increase timeout
All checks were successful
Setup EC2 Tools / setup-server (push) Successful in 1m59s
All checks were successful
Setup EC2 Tools / setup-server (push) Successful in 1m59s
This commit is contained in:
parent
9f73ddc7f0
commit
bb8fcba8a3
1 changed files with 15 additions and 16 deletions
|
|
@ -19,22 +19,28 @@ jobs:
|
|||
host: ${{ secrets.BETA_EC2_HOST }}
|
||||
username: ${{ secrets.BETA_EC2_USERNAME }}
|
||||
key: ${{ secrets.BETA_EC2_SSH_KEY }}
|
||||
command_timeout: 30m
|
||||
script: |
|
||||
echo "Starting EC2 Server Setup..."
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# 1. Update package list
|
||||
# 1. Update package list and install prerequisites if missing
|
||||
sudo apt-get update -y
|
||||
sudo apt-get upgrade -y
|
||||
sudo apt-get install -y software-properties-common curl git unzip nginx supervisor redis-server
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends software-properties-common curl git unzip nginx supervisor redis-server
|
||||
|
||||
# 2. Add PHP repository and install PHP 8.4 with required extensions
|
||||
sudo add-apt-repository -y ppa:ondrej/php
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y php8.4-fpm php8.4-cli php8.4-pgsql php8.4-mbstring php8.4-xml php8.4-curl php8.4-zip php8.4-bcmath php8.4-intl php8.4-redis php8.4-gd
|
||||
if ! command -v php8.4 &> /dev/null; then
|
||||
sudo add-apt-repository -y ppa:ondrej/php
|
||||
sudo apt-get update -y
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php8.4-fpm php8.4-cli php8.4-pgsql php8.4-mbstring php8.4-xml php8.4-curl php8.4-zip php8.4-bcmath php8.4-intl php8.4-redis php8.4-gd
|
||||
fi
|
||||
|
||||
# 3. Install Node.js (required for Vite frontend assets)
|
||||
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
|
||||
sudo apt-get install -y nodejs
|
||||
# 3. Install Node.js (Node 22) if missing
|
||||
if ! command -v node &> /dev/null; then
|
||||
echo "Installing Node.js 22..."
|
||||
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs
|
||||
fi
|
||||
|
||||
# 4. Install Composer (PHP Package Manager)
|
||||
if ! command -v composer &> /dev/null; then
|
||||
|
|
@ -51,13 +57,6 @@ jobs:
|
|||
rm composer-setup.php
|
||||
fi
|
||||
|
||||
# 4. Install Node.js (v20) and NPM for building frontend assets
|
||||
if ! command -v node &> /dev/null; then
|
||||
echo "Installing Node.js..."
|
||||
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
|
||||
sudo apt-get install -y nodejs
|
||||
fi
|
||||
|
||||
# 5. Create web directory and deploy code
|
||||
sudo mkdir -p /var/www/trypost
|
||||
sudo chown -R $USER:$USER /var/www/trypost
|
||||
|
|
|
|||
Loading…
Reference in a new issue