72 lines
1.8 KiB
Bash
72 lines
1.8 KiB
Bash
#!/bin/sh
|
|
|
|
cd /app
|
|
|
|
# Install dependency jika belum ada vendor/
|
|
if [ ! -d vendor ]; then
|
|
echo "Installing dependencies..."
|
|
composer install --no-interaction --prefer-dist --optimize-autoloader
|
|
fi
|
|
|
|
# Jika file .env tidak ada, copy dari slack.env
|
|
if [ ! -f .env ]; then
|
|
echo "Copying slack.env to .env"
|
|
cp slack.env .env
|
|
fi
|
|
|
|
php artisan cache:table
|
|
php artisan migrate
|
|
|
|
# Generate app key jika belum ada
|
|
if ! grep -q "APP_KEY=" .env || [ -z "$(php artisan key:generate --show 2>/dev/null)" ]; then
|
|
echo "Generating app key..."
|
|
php artisan key:generate
|
|
fi
|
|
# echo "Generating app key..."
|
|
# php artisan key:generate
|
|
|
|
# # Cek apakah database sudah terhubung
|
|
# if ! php artisan migrate:status > /dev/null 2>&1; then
|
|
# echo "Database connection failed. Please check your .env file."
|
|
# exit 1
|
|
# fi
|
|
|
|
# # Cek apakah optimize sudah bersih
|
|
# if ! php artisan optimize:clear > /dev/null 2>&1; then
|
|
# echo "Clearing optimize..."
|
|
# php artisan optimize:clear || {
|
|
# echo "Optimize clear failed. Please check your Laravel setup."
|
|
# exit 1
|
|
# }
|
|
# fi
|
|
|
|
# Cek apakah config sudah bersih
|
|
# if ! php artisan config:clear > /dev/null 2>&1; then
|
|
# echo "Clearing config cache..."
|
|
# php artisan config:clear || {
|
|
# echo "Config clear failed. Please check your Laravel setup."
|
|
# exit 1
|
|
# }
|
|
# fi
|
|
|
|
# Cek apakah route sudah bersih
|
|
# if ! php artisan route:clear > /dev/null 2>&1; then
|
|
# echo "Clearing route cache..."
|
|
# php artisan route:clear || {
|
|
# echo "Route clear failed. Please check your Laravel setup."
|
|
# exit 1
|
|
# }
|
|
# fi
|
|
|
|
# Jalankan migrasi
|
|
echo "Running migrations..."
|
|
#php artisan migrate --force || true
|
|
php artisan migrate:fresh --seed --force || true
|
|
|
|
echo "Seeding database..."
|
|
php artisan db:seed --force || true
|
|
|
|
# Start server
|
|
echo "Starting Laravel server..."
|
|
exec frankenphp php-server --root public
|