update entrypoint and apache conf

This commit is contained in:
Debian
2026-06-04 08:01:48 +07:00
parent 3ab142ab21
commit fa66476685
2 changed files with 23 additions and 21 deletions
+21 -21
View File
@@ -1,43 +1,43 @@
#!/bin/bash
set -e
cd /var/www/aigo
# Ensure storage directories exist (volume mount may hide image-created dirs)
# Ensure storage directories exist
mkdir -p storage/framework/{cache/sessions,cache/data,views,testing} \
storage/logs \
bootstrap/cache
chown -R www-data:www-data storage bootstrap/cache
bootstrap/cache 2>/dev/null || true
chown -R www-data:www-data storage bootstrap/cache 2>/dev/null || true
# Generate app key if missing (required by Laravel)
php artisan key:generate --force 2>/dev/null || true
# Wait for database
if [ -n "$DB_HOST" ]; then
echo "Waiting for database connection..."
for i in $(seq 1 30); do
if php -r "
DB_OK=
for i in $(seq 1 15); do
php -r "
try {
new PDO('mysql:host=$DB_HOST;port=${DB_PORT:-3306}', '$DB_USERNAME', '$DB_PASSWORD');
echo 'ok';
exit(0);
} catch (PDOException \$e) {
exit(1);
}
" 2>/dev/null; then
echo "Database connected."
break
fi
" 2>/dev/null && DB_OK=1 && break
echo "Waiting for database... attempt $i"
sleep 2
done
if [ -n "$DB_OK" ]; then
echo "Database connected."
php artisan storage:link --force 2>/dev/null || true
php artisan migrate --force 2>/dev/null || true
else
echo "Warning: Database not available. Skipping migrations."
fi
fi
# Create storage symlink
php artisan storage:link --force
# Run migrations
php artisan migrate --force
# Cache
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan config:cache 2>/dev/null || true
php artisan route:cache 2>/dev/null || true
php artisan view:cache 2>/dev/null || true
exec "$@"
+2
View File
@@ -1,3 +1,5 @@
ServerName localhost
<VirtualHost *:80>
DocumentRoot /var/www/aigo/public