diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 7e29739d..b66593b8 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -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: