update entrypoint and apache conf
This commit is contained in:
+21
-21
@@ -1,43 +1,43 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
|
||||||
|
|
||||||
cd /var/www/aigo
|
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} \
|
mkdir -p storage/framework/{cache/sessions,cache/data,views,testing} \
|
||||||
storage/logs \
|
storage/logs \
|
||||||
bootstrap/cache
|
bootstrap/cache 2>/dev/null || true
|
||||||
chown -R www-data:www-data storage bootstrap/cache
|
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
|
# Wait for database
|
||||||
if [ -n "$DB_HOST" ]; then
|
if [ -n "$DB_HOST" ]; then
|
||||||
echo "Waiting for database connection..."
|
echo "Waiting for database connection..."
|
||||||
for i in $(seq 1 30); do
|
DB_OK=
|
||||||
if php -r "
|
for i in $(seq 1 15); do
|
||||||
|
php -r "
|
||||||
try {
|
try {
|
||||||
new PDO('mysql:host=$DB_HOST;port=${DB_PORT:-3306}', '$DB_USERNAME', '$DB_PASSWORD');
|
new PDO('mysql:host=$DB_HOST;port=${DB_PORT:-3306}', '$DB_USERNAME', '$DB_PASSWORD');
|
||||||
echo 'ok';
|
exit(0);
|
||||||
} catch (PDOException \$e) {
|
} catch (PDOException \$e) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
" 2>/dev/null; then
|
" 2>/dev/null && DB_OK=1 && break
|
||||||
echo "Database connected."
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
echo "Waiting for database... attempt $i"
|
echo "Waiting for database... attempt $i"
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
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
|
fi
|
||||||
|
|
||||||
# Create storage symlink
|
php artisan config:cache 2>/dev/null || true
|
||||||
php artisan storage:link --force
|
php artisan route:cache 2>/dev/null || true
|
||||||
|
php artisan view:cache 2>/dev/null || true
|
||||||
# Run migrations
|
|
||||||
php artisan migrate --force
|
|
||||||
|
|
||||||
# Cache
|
|
||||||
php artisan config:cache
|
|
||||||
php artisan route:cache
|
|
||||||
php artisan view:cache
|
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
ServerName localhost
|
||||||
|
|
||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
DocumentRoot /var/www/aigo/public
|
DocumentRoot /var/www/aigo/public
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user