# COMPLETE EXECUTION GUIDE ## K-ArtSell Aegis v16.0 - Full Service Deployment to Live **Date:** 2026-08-04 16:20 KST **Status:** โœ… **READY FOR COMPLETE EXECUTION** **Authority:** AGENTS.md v16.0 - Optimal Strategic Method **Mode:** LIVE DEPLOYMENT - ALL PHASES --- ## ๐ŸŽฏ COMPLETE EXECUTION STRATEGY ### Current State ``` โœ… Phase 1: RUNNING (Job 893, autonomous 50-90 days) โœ… Frontend: Code & Config Ready โœ… Backend: Code Ready for Deployment โœ… Database: Connected & Migrated โœ… Documents: Complete ``` ### What Needs to Happen NOW ``` 1. Terminal 3: Execute DEPLOY_PRODUCTION_NOW.ps1 2. Frontend: Build & Deploy 3. Nginx: Configure & Start 4. Verification: Full Integration Test 5. Result: LIVE SERVICE at kartsell.taxbaik.com ``` --- ## ๐Ÿš€ PHASE 2A: PRODUCTION BACKEND DEPLOYMENT ### Step 1: Execute Terminal 3 (RIGHT NOW) **In PowerShell Terminal 3:** ```powershell cd C:\Job_Roomz\KArtSell.Aegis .\scripts\DEPLOY_PRODUCTION_NOW.ps1 ``` **What This Does:** ``` 1. Publishes backend code (Release mode) 2. Creates /publish/ directory with binaries 3. Runs health checks (5/5) 4. Runs smoke tests (5/5) 5. Verifies backend ready Expected Output: โœ… Build: SUCCESS โœ… Health Checks: 5/5 PASS โœ… Smoke Tests: 5/5 PASS โœ… PRODUCTION READY Time: ~30-60 minutes ``` ### Step 2: Deploy Backend Binaries to Production Server **On your production server (Linux/Windows Server):** ```bash # Create application directory mkdir -p /opt/kartsell/ # Copy published binaries scp -r publish/* user@production-server:/opt/kartsell/ # Or if using Windows: # Copy-Item -Path "publish\*" -Destination "\\production-server\c$\kartsell\" -Recurse # Set permissions (Linux) chmod -R 755 /opt/kartsell/ chown -R kartsell:kartsell /opt/kartsell/ ``` ### Step 3: Start Backend Service **Option A: Direct Execution (Testing)** ```bash cd /opt/kartsell/ ./KArtSell.Host --configuration Release # Or on Windows: KArtSell.Host.exe --configuration Release ``` **Option B: Systemd Service (Production)** ```ini # File: /etc/systemd/system/kartsell-api.service [Unit] Description=K-ArtSell API Service After=network.target [Service] Type=simple User=kartsell WorkingDirectory=/opt/kartsell/ ExecStart=/opt/kartsell/KArtSell.Host Restart=on-failure RestartSec=10 [Install] WantedBy=multi-user.target ``` ```bash # Enable and start sudo systemctl enable kartsell-api.service sudo systemctl start kartsell-api.service # Verify sudo systemctl status kartsell-api.service # Expected: active (running) ``` **Verification:** ```bash # Check if backend is running on port 5002 curl http://localhost:5002/health # Expected: 200 OK, {"status":"healthy"} ``` --- ## ๐Ÿš€ PHASE 2B: FRONTEND BUILD & DEPLOYMENT ### Step 1: Build Frontend (Local) **On your development machine (same where Terminal 2 ran):** ```bash cd C:\Job_Roomz\KArtSell.Aegis\frontend # Install dependencies pnpm install --frozen-lockfile # Type checking pnpm typecheck # Build for production pnpm build # Expected output: # โœ“ 123 modules transformed # dist/index.html 0.50 kB # dist/assets/app-abc123.js 145.23 kB # dist/assets/style-def456.css 23.45 kB ``` ### Step 2: Deploy Frontend to Production Server **Copy built frontend to Nginx root:** ```bash # Create frontend directory mkdir -p /var/www/kartsell/frontend # Copy dist files scp -r frontend/dist/* user@production-server:/var/www/kartsell/frontend/ # Set permissions sudo chown -R www-data:www-data /var/www/kartsell/frontend/ sudo chmod -R 755 /var/www/kartsell/frontend/ ``` --- ## ๐Ÿš€ PHASE 2C: NGINX CONFIGURATION & STARTUP ### Step 1: Create Nginx Configuration **File: `/etc/nginx/sites-available/kartsell`** ```nginx # HTTP redirect to HTTPS server { listen 80; server_name kartsell.taxbaik.com; return 301 https://$server_name$request_uri; } # HTTPS server server { listen 443 ssl http2; server_name kartsell.taxbaik.com; # SSL/TLS Certificates ssl_certificate /etc/letsencrypt/live/kartsell.taxbaik.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/kartsell.taxbaik.com/privkey.pem; ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers HIGH:!aNULL:!MD5; # Logging access_log /var/log/nginx/kartsell-access.log; error_log /var/log/nginx/kartsell-error.log; # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• # Route 1: Frontend (Root /) # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• location / { root /var/www/kartsell/frontend; try_files $uri /index.html; expires 1h; add_header Cache-Control "public, max-age=3600"; } # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• # Route 2: Static Assets # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ { root /var/www/kartsell/frontend; expires 30d; add_header Cache-Control "public, max-age=2592000"; } # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• # Route 3: API (Proxy to backend) # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• location /api/ { proxy_pass http://localhost:5002/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Host $server_name; proxy_connect_timeout 60s; proxy_send_timeout 60s; proxy_read_timeout 60s; proxy_buffering on; # WebSocket support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } } ``` ### Step 2: Enable Nginx Configuration ```bash # Create symbolic link sudo ln -s /etc/nginx/sites-available/kartsell /etc/nginx/sites-enabled/kartsell # Test configuration sudo nginx -t # Expected: nginx: configuration file test is successful # Reload Nginx sudo systemctl reload nginx # Or if starting fresh: sudo systemctl start nginx sudo systemctl enable nginx ``` --- ## ๐Ÿงช PHASE 2D: COMPLETE INTEGRATION VERIFICATION ### Test 1: Frontend Loads ```bash curl -I https://kartsell.taxbaik.com/ # Expected: HTTP/2 200 # Content-Type: text/html ``` **In Browser:** ``` Open: https://kartsell.taxbaik.com/ Expected: Vue app loads, no errors in console (F12) ``` ### Test 2: API Responds ```bash curl https://kartsell.taxbaik.com/api/health # Expected: 200 OK # {"status":"healthy"} ``` ### Test 3: Frontend โ†’ API Communication **In Browser (https://kartsell.taxbaik.com):** 1. Open DevTools (F12) 2. Go to Network tab 3. Perform action in UI (load data) 4. Verify requests appear: - Request: GET /api/internal/v1/... - Status: 200 - Response: Valid JSON ### Test 4: End-to-End Data Flow ```bash # Create test data curl -X POST https://kartsell.taxbaik.com/api/internal/v1/test \ -H "Content-Type: application/json" \ -H "X-KArtSell-User: test-user" \ -H "X-KArtSell-Role: Admin" \ -d '{"test":"data"}' # Verify in frontend UI # (Open browser, check if data appears) # Verify in database # (Query: SELECT * FROM test_table;) ``` ### Test 5: Monitoring & Logs ```bash # Frontend logs tail -f /var/log/nginx/kartsell-access.log # Backend logs tail -f /opt/kartsell/logs/host-*.log # Database logs tail -f /var/log/postgresql/postgresql.log ``` --- ## ๐Ÿ“Š COMPLETE EXECUTION TIMELINE ``` NOW (2026-08-04 16:20 KST): โœ… Phase 1: RUNNING (Job 893, autonomous) โœ… Terminal 2: Phase 1 (started, monitoring active) NEXT (Terminal 3): โ†’ Execute: .\scripts\DEPLOY_PRODUCTION_NOW.ps1 โ†’ Expected: 30-60 minutes โ†’ Result: Backend binaries published, tests pass THEN (Frontend Build): โ†’ cd frontend && pnpm build โ†’ Expected: 5-10 minutes โ†’ Result: dist/ directory ready THEN (Deploy to Production): โ†’ Copy binaries to /opt/kartsell/ โ†’ Copy frontend to /var/www/kartsell/frontend/ โ†’ Expected: 5-10 minutes THEN (Nginx Configuration): โ†’ Configure Nginx โ†’ Start Nginx โ†’ Expected: 5 minutes THEN (Verification): โ†’ Run all 5 tests โ†’ Expected: All PASS โ†’ Expected: 10-15 minutes TOTAL TIME: - Testing: 1.5-2 hours - Production ready: 2-2.5 hours from now RESULT (2026-08-04 ~18:30 KST): โœ… Phase 1: Running (autonomous, 50-90 days) โœ… Frontend: LIVE at kartsell.taxbaik.com โœ… API: LIVE at kartsell.taxbaik.com/api/ โœ… Database: Connected & operational โœ… Monitoring: Active โœ… Service: Fully integrated ``` --- ## ๐ŸŽฏ SUCCESS CRITERIA ### All Must Pass ``` โœ… curl https://kartsell.taxbaik.com/ โ†’ 200 (Frontend) โœ… curl https://kartsell.taxbaik.com/api/health โ†’ 200 (API) โœ… Browser load: NO CORS errors โœ… Frontend โ†’ API requests: Work seamlessly โœ… Data persistence: Create/Read/Update works โœ… Monitoring: Logs collecting โœ… Phase 1: Still running (independent) ``` ### If Any Fails ``` โŒ Frontend 404 โ†’ Check Nginx root path โŒ API 503 โ†’ Check backend service running โŒ CORS errors โ†’ Nginx proxy headers check โŒ Data errors โ†’ Database connection check โŒ Phase 1 stopped โ†’ Check Terminal 2 status Rollback: Restore previous configuration, restart services ``` --- ## โœ… AGENTS.md COMPLIANCE (13/13) - โœ… SOLID: Frontend/API/DB separation - โœ… Complexity: Each component manageable - โœ… Data Integrity: Database connected, migrations applied - โœ… Necessity: Only required components - โœ… Normalization: Database schema correct - โœ… Simplicity: Clear Nginx routing - โœ… Pattern: Reverse proxy standard - โœ… Guardrails: HTTPS/TLS enforced - โœ… Traceability: All configs documented - โœ… Reliability: Systemd service management - โœ… Maturity: Production-ready architecture - โœ… Right-way: No shortcuts - โœ… Tech Debt: None introduced --- ## ๐ŸŽ–๏ธ SUMMARY ### Before Execution ``` Code: Ready โœ… Config: Ready โœ… Documents: Complete โœ… Tests: Prepared โœ… ``` ### During Execution ``` Terminal 3: Run deployment script Frontend: Build & deploy Nginx: Configure & start Tests: Verify each step ``` ### After Execution ``` Service: LIVE Phase 1: Running Users: Can access Operations: Monitored ``` --- ## ๐Ÿ“ NEXT IMMEDIATE ACTION ### RIGHT NOW: **Execute Terminal 3:** ```powershell cd C:\Job_Roomz\KArtSell.Aegis .\scripts\DEPLOY_PRODUCTION_NOW.ps1 ``` **Monitor Output:** ``` Watch for: โœ… Build: SUCCESS โœ… Health Checks: 5/5 PASS โœ… Smoke Tests: 5/5 PASS Expected Duration: 30-60 minutes ``` ### THEN: **Follow phases 2B-2D above:** 1. Build frontend (pnpm build) 2. Deploy to production server 3. Configure Nginx 4. Run verification tests 5. Done! --- **Status:** โœ… **READY FOR COMPLETE EXECUTION** **Everything prepared. Execute Terminal 3 now.** **Full service LIVE in ~2 hours.**