Deploy: 2026-05-21 00:47:51
This commit is contained in:
@@ -29,7 +29,16 @@ spl_autoload_register(function ($class) {
|
||||
|
||||
// 2. Load Environment Variables
|
||||
try {
|
||||
\App\Core\Env::load(APP_ROOT . '/.env');
|
||||
// Find the closest .env file path (supporting local development and CloudPanel server directories)
|
||||
$env_file = APP_ROOT . '/.env';
|
||||
if (!file_exists($env_file)) {
|
||||
if (file_exists(APP_ROOT . '/../../../.env')) {
|
||||
$env_file = APP_ROOT . '/../../../.env';
|
||||
} elseif (file_exists(APP_ROOT . '/../.env')) {
|
||||
$env_file = APP_ROOT . '/../.env';
|
||||
}
|
||||
}
|
||||
\App\Core\Env::load($env_file);
|
||||
} catch (\Exception $e) {
|
||||
// In production, log error; in development, print it
|
||||
error_log('Env Load Error: ' . $e->getMessage());
|
||||
|
||||
27
deploy.sh
27
deploy.sh
@@ -1,9 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# --- Configuration ---
|
||||
SERVER_USER="root"
|
||||
SERVER_IP="194.163.173.157"
|
||||
SERVER_PATH="/home/intaleqapp-nabeh/htdocs/nabeh.intaleqapp.com"
|
||||
GIT_BRANCH="main"
|
||||
|
||||
# Colors for terminal styling
|
||||
@@ -12,7 +9,7 @@ YELLOW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m'
|
||||
|
||||
echo -e "${GREEN}🚀 Starting Nabeh Sync & Deploy...${NC}"
|
||||
echo -e "${GREEN}🚀 Starting Nabeh Sync & Push...${NC}"
|
||||
|
||||
# 1. Commit local changes automatically (with date/time or custom message)
|
||||
if [ -n "$(git status --porcelain)" ]; then
|
||||
@@ -30,28 +27,10 @@ echo -e "${GREEN}📤 Pushing changes to remote repository (${GIT_BRANCH})...${N
|
||||
git push origin "$GIT_BRANCH"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "${RED}❌ Git Push failed! Deployment aborted.${NC}"
|
||||
echo -e "${RED}❌ Git Push failed!${NC}"
|
||||
exit 1
|
||||
fi
|
||||
echo -e "${GREEN}✅ Successfully pushed to remote repository!${NC}"
|
||||
|
||||
# 3. Connect to server via SSH and pull updates
|
||||
echo -e "${GREEN}🌐 Connecting to server and pulling updates...${NC}"
|
||||
ssh -o ConnectTimeout=5 "${SERVER_USER}@${SERVER_IP}" "
|
||||
cd ${SERVER_PATH} && \
|
||||
git pull origin ${GIT_BRANCH} && \
|
||||
if [ -f 'backend/composer.json' ]; then
|
||||
echo '📦 Updating composer dependencies on server...' && \
|
||||
cd backend && \
|
||||
composer install --no-dev --optimize-autoloader
|
||||
fi
|
||||
"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "${GREEN}==========================================${NC}"
|
||||
echo -e "✨ Nabeh deployment synced perfectly! "
|
||||
echo -e "✨ Nabeh changes pushed to Git successfully! "
|
||||
echo -e "==========================================${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ Server update failed! Check your connection or SSH setup.${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user