Laravel 第一版 移除不用的注解 20250529
This commit is contained in:
parent
0efea7c89f
commit
579c9ef9ab
@ -2,38 +2,32 @@
|
||||
|
||||
cd /var/www
|
||||
|
||||
# Remove trailing slash from APP_DOMAIN if exists
|
||||
APP_DOMAIN="${APP_DOMAIN%/}"
|
||||
|
||||
# Default Redis settings
|
||||
: "${REDIS_HOST:=redis}"
|
||||
: "${REDIS_PORT:=6379}"
|
||||
|
||||
# Clone the project (only the first time)
|
||||
if [ ! -d "html" ]; then
|
||||
if [ -n "$GIT_REPO_URL" ]; then
|
||||
echo "🔧 Cloning project from ${GIT_REPO_URL}..."
|
||||
echo "Cloning project from ${GIT_REPO_URL}..."
|
||||
git clone "$GIT_REPO_URL" html
|
||||
else
|
||||
echo "❌ GIT_REPO_URL not set. Skipping clone."
|
||||
echo "GIT_REPO_URL not set. Skipping clone."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
cd html
|
||||
|
||||
# Composer install
|
||||
echo "📦 Running composer install..."
|
||||
echo "Running composer install..."
|
||||
composer install --no-interaction --prefer-dist
|
||||
|
||||
# Copy .env file if not exists
|
||||
if [ ! -f ".env" ]; then
|
||||
echo "⚙️ Copying .env.example to .env"
|
||||
echo "Copying .env.example to .env"
|
||||
cp .env.example .env
|
||||
fi
|
||||
|
||||
# Update .env configurations
|
||||
echo "🛠 Updating .env configurations..."
|
||||
echo "Updating .env configurations..."
|
||||
|
||||
update_env_var() {
|
||||
local key=$1
|
||||
@ -54,26 +48,22 @@ update_env_var "QUEUE_CONNECTION" "$QUEUE_CONNECTION"
|
||||
update_env_var "CACHE_DRIVER" "$CACHE_DRIVER"
|
||||
update_env_var "SESSION_DRIVER" "$SESSION_DRIVER"
|
||||
|
||||
# Laravel initialization
|
||||
echo "🔑 Generating Laravel app key..."
|
||||
echo "Generating Laravel app key..."
|
||||
php artisan key:generate
|
||||
|
||||
echo "🧱 Running migrations..."
|
||||
echo "Running migrations..."
|
||||
php artisan config:clear && cache:clear
|
||||
php artisan migrate --force
|
||||
|
||||
# Install Node.js packages and build frontend
|
||||
echo "🌐 Installing npm packages..."
|
||||
echo "Installing npm packages..."
|
||||
[ ! -d "node_modules" ] && npm install
|
||||
|
||||
echo "🛠 Building front-end assets..."
|
||||
echo "Building front-end assets..."
|
||||
npm run build
|
||||
|
||||
# Add Laravel schedule to crontab (avoid duplicate entries)
|
||||
echo "⏱ Adding schedule:run to crontab..."
|
||||
echo "Adding schedule:run to crontab..."
|
||||
crontab -l 2>/dev/null | grep -q 'schedule:run' || \
|
||||
(echo "* * * * * cd /var/www/html && php artisan schedule:run >> /dev/null 2>&1" | crontab -)
|
||||
|
||||
# Start supervisord (to run queue + cron + php-fpm simultaneously)
|
||||
echo "🚀 Starting supervisord..."
|
||||
echo "Starting supervisord..."
|
||||
exec supervisord -n
|
Reference in New Issue
Block a user