harga pada beranda terhubung ke manage plans di dashboard admin
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m27s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 31s
Build, Push and Deploy / deploy-production (push) Has been skipped

This commit is contained in:
triagungbiantoro
2026-04-25 21:57:25 +07:00
parent f25542ea0d
commit 417b7b7453
21707 changed files with 179493 additions and 328 deletions

92
entrypoint.sh Normal file → Executable file
View File

@@ -63,6 +63,24 @@ EOF
fi
fi
# LOAD environment variables from .env for use in this script
if [ -f .env ]; then
echo "Loading environment variables from .env..."
# Read .env file line by line and export each variable
while IFS= read -r line || [ -n "$line" ]; do
# Remove carriage return if present (Windows style)
line=$(echo "$line" | sed 's/\r$//')
# Skip comments and empty lines
case "$line" in
"#"*) continue ;;
"") continue ;;
esac
# Remove quotes from value and export
export "$(echo "$line" | sed 's/["'\'']//g')" 2>/dev/null || true
done < .env
fi
# Generate key if not present (only if APP_KEY is empty or missing)
echo "Checking .env for APP_KEY..."
if ! grep -E "APP_KEY=.{10,}" .env; then
@@ -111,12 +129,22 @@ if [ ! -f config/scribe.php ]; then
php artisan vendor:publish --tag=scribe-config --force
fi
# Skip Scribe generation if docs already exist to save time on restart
if [ -d resources/views/scribe ] && [ "$FORCE_REGENERATE_DOCS" != "true" ]; then
echo "✅ Scribe docs already exist, skipping generation..."
SKIP_SCRIBE=true
fi
# Generate OpenAPI/Swagger documentation
if [ "$APP_ENV" != "production" ] || [ "$AUTO_GENERATE_API_DOCS" = "true" ]; then
echo "Generating API documentation..."
# Generate Scribe documentation
php artisan scribe:generate --no-interaction || echo "⚠️ Scribe generation failed, check your API routes"
if [ "$SKIP_SCRIBE" != "true" ]; then
echo "Generating Scribe documentation..."
php artisan scribe:generate --no-interaction || echo "⚠️ Scribe generation failed, check your API routes"
fi
# For OpenAPI/Swagger UI specifically
if [ -f public/docs/openapi.yaml ] || [ -f public/docs/collection.json ]; then
@@ -136,10 +164,14 @@ if [ -d vendor/knuckleswtf/scribe/dist ]; then
ln -sf ../vendor/knuckleswtf/scribe/dist public/vendor/scribe 2>/dev/null || true
fi
# FIX: Ensure all generated/downloaded files are fully readable and executable
echo "Setting correct ownership for web server..."
chown -R www-data:www-data vendor
chmod -R 755 vendor
# FIX: Ensure storage and bootstrap are writable (these are small)
echo "Setting correct ownership for storage and bootstrap..."
chown -R www-data:www-data storage bootstrap/cache
chmod -R 775 storage bootstrap/cache
# Note: We skip recursive chown on vendor because it's very slow on mounted volumes
# and usually not necessary for runtime.
# Verify vendor integrity at PHP level
echo "Checking vendor visibility and READABILITY for PHP..."
@@ -167,17 +199,51 @@ fi
if [ -f public/build/manifest.json ]; then
echo "✅ Vite manifest found at public/build/manifest.json"
else
echo "⚠️ Warning: Vite manifest not found! Assets may not load correctly."
echo "Current contents of public/build:"
ls -la public/build/ 2>/dev/null || echo "public/build directory does not exist"
echo "⚠️ Vite manifest not found! Attempting to build assets..."
if command -v npm >/dev/null 2>&1; then
if [ ! -d node_modules ]; then
echo "📦 node_modules missing. Installing..."
npm install --legacy-peer-deps --no-audit || echo "❌ npm install failed!"
fi
npm run build || echo "❌ npm run build failed!"
else
echo "❌ npm not found, cannot build assets automatically."
fi
if [ ! -f public/build/manifest.json ]; then
echo "⚠️ Still no Vite manifest! Assets may not load correctly."
echo "Current contents of public/build:"
ls -la public/build/ 2>/dev/null || echo "public/build directory does not exist"
fi
fi
# Optional: Run migrations if needed (with safety for production)
# if [ "$AUTO_MIGRATE" = "true" ] || [ "$APP_ENV" != "production" ]; then
# echo "Running migrations..."
# php artisan migrate --force
# fi
if [ "$AUTO_MIGRATE" = "true" ] || [ "$APP_ENV" != "production" ]; then
echo "Running migrations..."
php artisan migrate --force
# Optional: Seed if needed, but we have converted.sql
# php artisan db:seed --force
# Check if database has data (e.g., check users table)
# We use PGPASSWORD to avoid interactive prompt
export PGPASSWORD=$DB_PASSWORD
echo "Checking if database needs data import..."
USER_COUNT=$(psql -h $DB_HOST -U $DB_USERNAME -d $DB_DATABASE -t -c "SELECT count(*) FROM users;" 2>/dev/null | tr -d '[:space:]' || echo "0")
if [ "$USER_COUNT" = "0" ] || [ -z "$USER_COUNT" ]; then
if [ -f converted.sql ]; then
echo "📦 Database is empty. Importing data from converted.sql..."
psql -h $DB_HOST -U $DB_USERNAME -d $DB_DATABASE -f converted.sql > /dev/null
echo "✅ Data import complete."
else
echo "⚠️ converted.sql not found, skipping data import."
fi
else
echo "✅ Database already has data ($USER_COUNT users)."
fi
unset PGPASSWORD
fi
echo "========================================"
echo "Setup complete. Starting application..."