DevOps
Learn how devops work in SPCBot and how to configure them for your team.
Visual Guide
Drop real screenshots into the paths below. This grid is rendered by src/app/docs/components/image-placeholder.tsx.
Dashboard Overview
Main dashboard with stats and recent deployments
public/docs/images/dashboard-overview.pngServer List
Connected servers and their health status
public/docs/images/servers-list.pngDeployment View
Live deployment logs and progress
public/docs/images/deployment-view.pngAutomated testing, building, and deployment using GitHub Actions.
Workflow Overview
Lint, type-check, unit tests, and E2E tests on every PR
Build and push Docker images to GitHub Container Registry
Auto-deploy to port 9027 on staging_18 branch
Auto-deploy to port 9003 on 18.0 branch with backup
Workflow Files
| Workflow | File | Trigger | Purpose |
|---|---|---|---|
| CI | .github/workflows/ci.yml | Every PR | Test + Lint + Type-check |
| Build | .github/workflows/build.yml | Push to main/staging/18.0 | Build Docker images |
| Deploy Staging | .github/workflows/deploy-staging.yml | staging_18 branch | Deploy to staging server |
| Deploy Production | .github/workflows/deploy-production.yml | 18.0 branch | Deploy to production server |
Environment Setup (Same Server)
| Environment | Web Port | API Port | Directory |
|---|---|---|---|
| Staging | 9027 | 9028 | /opt/spcbot-staging |
| Production | 9003 | 9004 | /opt/spcbot-production |
Required GitHub Secrets
STAGING_SSH_KEY # SSH private key STAGING_HOST # 172.20.0.189 STAGING_USER # root PRODUCTION_SSH_KEY # Same key as staging PRODUCTION_HOST # 172.20.0.189 PRODUCTION_USER # root NEXT_PUBLIC_API_URL # http://172.20.0.189:9004
Docker Compose Files
docker-compose.staging.yml- Staging environment (ports 9027/9028)docker-compose.production.yml- Production environment (ports 9003/9004)docker-compose.prod.yml- Legacy production file
Testing Suite
Comprehensive unit and E2E testing for critical paths
Unit Tests (Jest)
Core service tests with mocked dependencies:
auth.service.spec.ts- Authentication & authorizationservers.service.spec.ts- Server managementprojects.service.spec.ts- Project operationsenvironments.service.spec.ts- Environment CRUDdeployment.worker.spec.ts- Background job processing
Jest Configuration
// apps/api/jest.config.js
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
roots: ['/src'],
testMatch: ['**/*.spec.ts'],
setupFilesAfterEnv: ['/test/setup.ts'],
collectCoverageFrom: ['src/**/*.ts', '!src/**/*.d.ts'],
}
E2E Tests (Playwright)
Full browser automation testing:
# Run E2E tests cd apps/web pnpm test:e2e # Run with UI pnpm test:e2e --ui
Running Tests
# All tests pnpm test # API tests only pnpm --filter @spcbot/api test # With coverage report pnpm test:coverage
Test Scripts (package.json)
"scripts": {
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"test:e2e": "playwright test"
}