Add deployment steps to clone code and set up Laravel
All checks were successful
Setup EC2 Tools / setup-server (push) Successful in 40s

This commit is contained in:
vickytechkey 2026-09-08 20:36:51 +05:30
parent 8732e33e97
commit aedd786edd

View file

@ -54,10 +54,31 @@ jobs:
sudo apt-get install -y nodejs
fi
# 5. Create web directory and set basic permissions
# 5. Create web directory and deploy code
sudo mkdir -p /var/www/trypost
sudo chown -R $USER:$USER /var/www/trypost
# Clone or pull the latest code
if [ ! -d "/var/www/trypost/.git" ]; then
git clone http://16.113.106.152:3000/vignesh/trypost.git /var/www/trypost
else
cd /var/www/trypost && git pull origin main
fi
# Install PHP dependencies and set permissions
cd /var/www/trypost
composer install --no-interaction --prefer-dist --optimize-autoloader
# Ensure storage and bootstrap/cache directories exist and have proper permissions for Nginx/PHP-FPM
mkdir -p storage bootstrap/cache
sudo chown -R www-data:www-data storage bootstrap/cache
sudo chmod -R 775 storage bootstrap/cache
# Setup Laravel environment file and key
if [ ! -f .env ]; then
cp .env.example .env
php artisan key:generate
fi
# 6. Configure Nginx for socialmedia.tradhox.com
echo "Configuring Nginx..."
sudo tee /etc/nginx/sites-available/socialmedia.tradhox.com > /dev/null << 'EOF'