Fix deploy.yml: Add sudo, create systemd service, set correct port 5002
ci / backend (push) Failing after 1s
ci / static (push) Failing after 6s
Build & Test with Secrets / build (push) Failing after 1s
Build & Test with Secrets / security-scan (push) Has been cancelled
Build & Test with Secrets / frontend (push) Has been cancelled
Build & Test with Secrets / notification (push) Has been cancelled
ci / publish (push) Has been cancelled
ci / frontend (push) Has been cancelled
deploy / deploy (push) Failing after 1m6s
deploy / notify (push) Successful in 1s
ci / backend (push) Failing after 1s
ci / static (push) Failing after 6s
Build & Test with Secrets / build (push) Failing after 1s
Build & Test with Secrets / security-scan (push) Has been cancelled
Build & Test with Secrets / frontend (push) Has been cancelled
Build & Test with Secrets / notification (push) Has been cancelled
ci / publish (push) Has been cancelled
ci / frontend (push) Has been cancelled
deploy / deploy (push) Failing after 1m6s
deploy / notify (push) Successful in 1s
Changes: - Create /app/kartsell with proper permissions - Backup previous version - Generate systemd kartsell.service with environment variables - Start service on port 5002 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
+49
-10
@@ -42,19 +42,24 @@ jobs:
|
|||||||
|
|
||||||
echo "📦 Deploying to $DEPLOY_PATH..."
|
echo "📦 Deploying to $DEPLOY_PATH..."
|
||||||
|
|
||||||
# 배포 디렉토리 생성
|
# 배포 디렉토리 생성 (sudo 사용)
|
||||||
mkdir -p "$DEPLOY_PATH"
|
if [ ! -d "$DEPLOY_PATH" ]; then
|
||||||
|
sudo mkdir -p "$DEPLOY_PATH"
|
||||||
|
sudo chown -R $USER:$USER "$DEPLOY_PATH"
|
||||||
|
echo "✅ Created $DEPLOY_PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
# 기존 백업
|
# 기존 백업
|
||||||
if [ -d "$DEPLOY_PATH/current" ]; then
|
if [ -d "$DEPLOY_PATH/current" ]; then
|
||||||
BACKUP_DIR="$DEPLOY_PATH/backup-$(date +%s)"
|
BACKUP_DIR="$DEPLOY_PATH/backup-$(date +%s)"
|
||||||
mv "$DEPLOY_PATH/current" "$BACKUP_DIR"
|
sudo mv "$DEPLOY_PATH/current" "$BACKUP_DIR"
|
||||||
echo "✅ Backed up previous version to $BACKUP_DIR"
|
echo "✅ Backed up previous version to $BACKUP_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 새 버전 배포
|
# 새 버전 배포
|
||||||
cp -r ./publish "$DEPLOY_PATH/current"
|
sudo cp -r ./publish "$DEPLOY_PATH/current"
|
||||||
chmod +x "$DEPLOY_PATH/current/KArtSell.Host"
|
sudo chown -R $USER:$USER "$DEPLOY_PATH/current"
|
||||||
|
sudo chmod +x "$DEPLOY_PATH/current/KArtSell.Host"
|
||||||
|
|
||||||
echo "✅ Files deployed successfully"
|
echo "✅ Files deployed successfully"
|
||||||
|
|
||||||
@@ -71,11 +76,45 @@ jobs:
|
|||||||
|
|
||||||
echo "✅ Migrations completed"
|
echo "✅ Migrations completed"
|
||||||
|
|
||||||
# systemd 서비스 재시작
|
# systemd 서비스 생성/활성화 (첫 배포 시)
|
||||||
echo "🔄 Restarting service..."
|
echo "🔧 Configuring systemd service..."
|
||||||
sudo systemctl restart kartsell || {
|
sudo tee /etc/systemd/system/kartsell.service > /dev/null << 'SYSTEMD_EOF'
|
||||||
echo "⚠️ Service restart completed"
|
[Unit]
|
||||||
}
|
Description=K-ArtSell Aegis - Financial Advisory System
|
||||||
|
After=network-online.target
|
||||||
|
Wants=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=notify
|
||||||
|
User=$USER
|
||||||
|
WorkingDirectory=$DEPLOY_PATH/current
|
||||||
|
ExecStart=/usr/bin/dotnet KArtSell.Host.dll
|
||||||
|
Restart=always
|
||||||
|
RestartSec=10
|
||||||
|
StandardOutput=journal
|
||||||
|
StandardError=journal
|
||||||
|
|
||||||
|
Environment="ASPNETCORE_ENVIRONMENT=Production"
|
||||||
|
Environment="ASPNETCORE_URLS=http://127.0.0.1:5002"
|
||||||
|
Environment="KARTSELL_POSTGRES=$KARTSELL_POSTGRES"
|
||||||
|
Environment="KRX_OPENAPI=$KRX_OPENAPI"
|
||||||
|
Environment="OPENDART_API=$OPENDART_API"
|
||||||
|
Environment="KIS_APP_KEY=$KIS_APP_KEY"
|
||||||
|
Environment="KIS_APP_SECRET=$KIS_APP_SECRET"
|
||||||
|
|
||||||
|
NoNewPrivileges=true
|
||||||
|
PrivateTmp=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
SYSTEMD_EOF
|
||||||
|
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
sudo systemctl enable kartsell
|
||||||
|
|
||||||
|
# 서비스 시작/재시작
|
||||||
|
echo "🔄 Starting service..."
|
||||||
|
sudo systemctl restart kartsell
|
||||||
|
|
||||||
# 헬스체크
|
# 헬스체크
|
||||||
echo "🏥 Health check..."
|
echo "🏥 Health check..."
|
||||||
|
|||||||
Reference in New Issue
Block a user