Modificate deploy.yml && deploy.sh #5

Merged
romanskijdev merged 1 commits from test-deploy into main 2026-06-18 10:20:59 +03:00
2 changed files with 14 additions and 23 deletions

View File

@ -202,10 +202,8 @@ jobs:
if: env.DEPLOY_MIGRATIONS == 'true' && env.SKIP_DEPLOY == 'false'
id: deploy_migrations
run: |
cd "$REPO_DIR"
echo "🗄️ Running database migrations..."
if sudo bash deploy.sh migrations; then
if sudo /usr/bin/bash "$REPO_DIR/deploy.sh" migrations; then
echo "✅ Migrations completed successfully"
echo "MIGRATIONS_DEPLOYED=true" >> $GITHUB_ENV
else
@ -221,19 +219,16 @@ jobs:
if: env.DEPLOY_TELEGRAM == 'true' && env.SKIP_DEPLOY == 'false'
id: deploy_telegram
run: |
cd "$REPO_DIR"
echo "🤖 Deploying Telegram bot..."
if sudo bash deploy.sh telegram; then
if sudo /usr/bin/bash "$REPO_DIR/deploy.sh" telegram; then
echo "✅ Telegram bot deployed"
echo "TELEGRAM_DEPLOYED=true" >> $GITHUB_ENV
sleep 3
if sudo systemctl is-active --quiet "$TELEGRAM_SERVICE"; then
if sudo /usr/bin/systemctl is-active --quiet "$TELEGRAM_SERVICE"; then
echo "✅ Telegram bot is running"
else
echo "❌ Telegram bot failed to start"
sudo journalctl -u "$TELEGRAM_SERVICE" -n 30 --no-pager
sudo /usr/bin/journalctl -u "$TELEGRAM_SERVICE" -n 30 --no-pager
exit 1
fi
else
@ -249,23 +244,20 @@ jobs:
if: env.DEPLOY_BALANCER == 'true' && env.SKIP_DEPLOY == 'false'
id: deploy_balancer
run: |
cd "$REPO_DIR"
echo "⚖️ Deploying balancer service..."
if sudo bash deploy.sh balancer; then
if sudo /usr/bin/bash "$REPO_DIR/deploy.sh" balancer; then
echo "✅ Balancer service deployed"
echo "BALANCER_DEPLOYED=true" >> $GITHUB_ENV
sleep 3
if sudo systemctl is-active --quiet "$BALANCER_SERVICE"; then
if sudo /usr/bin/systemctl is-active --quiet "$BALANCER_SERVICE"; then
echo "✅ Balancer service is running"
else
echo "❌ Balancer service failed to start"
sudo journalctl -u "$BALANCER_SERVICE" -n 30 --no-pager
sudo /usr/bin/journalctl -u "$BALANCER_SERVICE" -n 30 --no-pager
exit 1
fi
else
echo "❌ Balancer deployment failed"
echo "❌ Admin deployment failed"
echo "BALANCER_DEPLOYED=false" >> $GITHUB_ENV
exit 1
fi
@ -277,22 +269,18 @@ jobs:
if: env.DEPLOY_ADMIN == 'true' && env.SKIP_DEPLOY == 'false'
id: deploy_admin
run: |
cd "$REPO_DIR"
echo "🔧 Deploying admin service..."
if sudo bash deploy.sh admin swagger; then
if sudo /usr/bin/bash "$REPO_DIR/deploy.sh" admin swagger; then
echo "✅ Admin service deployed with Swagger"
echo "ADMIN_DEPLOYED=true" >> $GITHUB_ENV
sleep 3
if sudo systemctl is-active --quiet "$ADMIN_SERVICE"; then
if sudo /usr/bin/systemctl is-active --quiet "$ADMIN_SERVICE"; then
echo "✅ Admin service is running"
else
echo "❌ Admin service failed to start"
sudo journalctl -u "$ADMIN_SERVICE" -n 30 --no-pager
sudo /usr/bin/journalctl -u "$ADMIN_SERVICE" -n 30 --no-pager
exit 1
fi
if [ -f "$REPO_DIR/service/rest_admin_service/docs/swagger.json" ]; then
echo "✅ Swagger documentation generated"
fi

View File

@ -15,6 +15,9 @@ BLUE='\033[0;34m'
MAGENTA='\033[0;35m'
NC='\033[0m'
export GOPATH=/home/git/.go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
log_info() { echo -e "${BLUE}ℹ️ $1${NC}"; }
log_success() { echo -e "${GREEN}✅ $1${NC}"; }
log_warning() { echo -e "${YELLOW}⚠️ $1${NC}"; }