Fix deploy.yml: Add DbMigrator to publish, remove systemd commands for Docker
ci / backend (push) Failing after 1s
ci / static (push) Failing after 7s
Build & Test with Secrets / build (push) Failing after 1s
Build & Test with Secrets / security-scan (push) Has been cancelled
Build & Test with Secrets / notification (push) Has been cancelled
Build & Test with Secrets / frontend (push) Has been cancelled
ci / publish (push) Has been cancelled
ci / frontend (push) Has been cancelled
deploy / deploy (push) Successful in 1m29s
deploy / notify (push) Successful in 1s

- Publish both Host and DbMigrator
- Skip systemd (Docker env doesn't support it)
- Provide manual post-deploy steps

Deploy workflow:
1. Gitea Actions: Build + publish to /app/kartsell
2. Manual on server: Run migrations + restart service

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-08-05 23:10:13 +09:00
parent 5e29a3192a
commit 81119c9fcf
+11 -61
View File
@@ -27,7 +27,9 @@ jobs:
- run: dotnet build KArtSell.sln --no-restore -c Release
- name: Publish Release Build
run: dotnet publish -c Release -o ./publish src/KArtSell.Host
run: |
dotnet publish -c Release -o ./publish src/KArtSell.Host
dotnet publish -c Release -o ./publish src/KArtSell.DbMigrator
- name: Deploy to Gitea server (local filesystem)
env:
@@ -63,66 +65,14 @@ jobs:
echo "✅ Files deployed successfully"
# 마이그레이션 실행
echo "🗄️ Running database migrations..."
cd "$DEPLOY_PATH/current"
export ASPNETCORE_ENVIRONMENT=Production
export KARTSELL_POSTGRES="${KARTSELL_POSTGRES}"
dotnet KArtSell.DbMigrator.dll || {
echo "⚠️ Migration completed with warnings or errors"
}
echo "✅ Migrations completed"
# systemd 서비스 생성/활성화 (첫 배포 시)
echo "🔧 Configuring systemd service..."
sudo tee /etc/systemd/system/kartsell.service > /dev/null << 'SYSTEMD_EOF'
[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..."
sleep 5
curl -f http://127.0.0.1:5002/health || {
echo "⚠️ Health check inconclusive (service may still be starting)"
}
echo "✅ Release build deployed to $DEPLOY_PATH/current"
echo ""
echo "📋 Next steps on server:"
echo " 1. SSH: ssh kjh2064@178.104.200.7"
echo " 2. Migrate: cd $DEPLOY_PATH/current && export KARTSELL_POSTGRES='$KARTSELL_POSTGRES' && dotnet KArtSell.DbMigrator.dll"
echo " 3. Restart: sudo systemctl restart kartsell"
echo " 4. Check: curl https://kartsell.taxbaik.com/"
echo ""
echo "✅ Deployment completed"
notify: