源文件:12-cicd-status-and-roadmap.md

# 12. CI/CD Status and Roadmap

This document records what is already implemented on this VPS and what is planned next.

# Already implemented

# Core deployment

  • multi-version Node hosting with Node 18 / 20 / 22
  • release layout with current, releases, and shared
  • explicit fnm wrapper for non-interactive shells
  • systemd-managed Node runtime
  • Nginx reverse proxy to local ports
  • SELinux directory and port labeling during site creation

# Site lifecycle helpers

  • create-node-site
  • bootstrap-node-site
  • init-node-shared-env
  • deploy-node-release
  • cicd-deploy-node-site
  • rollback-node-release
  • cleanup-node-releases
  • node-cicd-webhookd

# Documentation and migration

  • exported docs bundle under /usr/local/share/sohophp/node-cicd
  • docs website at https://docs.v4.sohophp.app
  • publish-docs-site for docs sync and republish
  • tarball + checksums + manifest verification

# Verified live references

  • node.v4.sohophp.app on Node 22
  • node20.v4.sohophp.app on Node 20
  • docs.v4.sohophp.app on Node 22
  • deploy.v4.sohophp.app as webhook endpoint

# Rollback status

Rollback has now been implemented and actually tested on docs.v4.sohophp.app by:

  1. switching from release 20260602152355
  2. back to 20260602151802
  3. passing healthcheck
  4. redeploying to a fresh latest release again

# Release cleanup status

Release cleanup has now been implemented and actually tested on docs.v4.sohophp.app by:

  1. dry-running with --keep 5 --verbose
  2. identifying 4 removable old releases
  3. pruning those 4 releases
  4. verifying exactly 5 releases remain

# Webhook deploy status

Webhook-triggered deploy has now been implemented and actually tested by:

  1. running node-cicd-webhook.service on 127.0.0.1:22103
  2. exposing it through https://deploy.v4.sohophp.app
  3. enforcing HMAC-SHA256 verification
  4. restricting the route to push on refs/heads/main
  5. posting a signed webhook request to /github/node.v4.sohophp.app
  6. deploying node.v4.sohophp.app to release 20260602162046
  7. pruning 2 old releases automatically after deploy

# Current gaps

The following CI/CD features are not yet implemented as first-class tooling:

  • deploy success/failure notifications
  • database migration hooks
  • automatic rollback policy during deploy failures
  • deploy audit ledger / richer deployment history output

# Workflow and webhook examples now available

The toolkit now includes ready-to-adapt examples:

  • examples/github-actions-node-deploy.yml.example
  • examples/gitea-actions-node-deploy.yml.example
  • examples/node-cicd-webhook.json.example

These examples show:

  • syncing the repo to /srv/git/<domain>
  • running cicd-deploy-node-site
  • optionally pruning old releases with cleanup-node-releases
  • configuring a webhook route with signed deploy triggers

# Phase 1

  • add deploy notifications
  • add database migration hook support

# Phase 2

  • add optional automatic rollback policy after failed deploy validation
  • add deploy audit ledger / richer deployment history output

# Suggested operator order

If continuing from here, the most valuable order is:

  1. notifications
  2. database migration hooks
  3. auto rollback policy
  4. deployment audit ledger