fix: buat direktori storage pada deploy pertama sebelum view:cache

This commit is contained in:
Saufi
2026-05-19 15:36:28 +08:00
parent 24bac933a8
commit e65fd77156

View File

@@ -76,13 +76,20 @@ php artisan storage:link 2>/dev/null || true
# ── 6. Cache (production sahaja) ────────────────────────────────────────────── # ── 6. Cache (production sahaja) ──────────────────────────────────────────────
if [ "${APP_ENV}" = "production" ]; then if [ "${APP_ENV}" = "production" ]; then
# Pastikan direktori storage wujud (penting bila named volume kosong pada deploy pertama)
mkdir -p /var/www/storage/framework/views \
/var/www/storage/framework/cache/data \
/var/www/storage/framework/sessions \
/var/www/storage/logs \
/var/www/storage/app/public
chown -R www-data:www-data /var/www/storage
chmod -R 775 /var/www/storage
echo "⚡ Caching config, routes, views..." echo "⚡ Caching config, routes, views..."
php artisan config:cache php artisan config:cache
php artisan route:cache php artisan route:cache
php artisan view:cache php artisan view:cache
php artisan event:cache php artisan event:cache
# Opcache: matikan validate_timestamps untuk prestasi
# (sudah dikonfigur dalam php.ini prod)
fi fi
echo "" echo ""