源文件:05-migrate-to-another-vps.md

# 05. Migrate to Another VPS

This document explains how to move the Node toolkit to a fresh VPS.

# What can be copied directly

From the generated bundle:

  • scripts under scripts/
  • templates under templates/
  • docs under docs/
  • examples for reference

# What must be recreated or adapted

  • installed packages (nginx, certbot, rsync, SELinux tools, etc.)
  • users/groups (git, cicd, webread, webwrite)
  • fnm install for the git user
  • installed Node versions
  • /etc/sudoers.d/ policy
  • Nginx base config
  • systemd daemon reload/enable actions
  • DNS and certificates

# Suggested migration order

# 1. Base packages

Install at minimum:


sudo dnf install -y nginx certbot rsync policycoreutils-python-utils curl jq git unzip tar


# 2. Users and groups

Create or align:

  • git
  • cicd
  • webread
  • webwrite

Ensure Nginx can read deployed code via webread.

# 3. Install fnm for git

Install fnm into:

  • /home/git/.local/share/fnm

Then install the required Node versions.

# 4. Copy scripts/templates

Copy exported files from the bundle into:

  • /usr/local/bin/
  • /etc/systemd/system/
  • /etc/nginx/snippets/
  • /etc/sudoers.d/

Set executable bits and validate syntax.

# 5. Reload system components


sudo systemctl daemon-reload


sudo nginx -t


sudo visudo -c


# 6. Recreate one test site first

Recommended first site:

  • a non-critical test domain
  • or reproduce node.v4.sohophp.app as a smoke test

# 7. Validate SELinux

Confirm:

  • httpd_can_network_connect is enabled
  • chosen Node ports are labeled http_port_t
  • site roots are labeled httpd_sys_content_t

# 8. Only then migrate production sites

Do not bulk-migrate all sites before one end-to-end test works.

Treat this bundle as a reference toolkit, not a full OS image.

The fastest path on a new VPS is:

  1. install base packages
  2. copy the bundle
  3. install scripts/templates
  4. install fnm + Node versions
  5. create one test site
  6. validate
  7. migrate real repos and domains

# Files to inspect first on a new VPS

  • docs/01-overview-and-architecture.md
  • docs/02-script-reference.md
  • docs/04-cicd-and-sudoers.md
  • examples/node.v4.sohophp.app.env.example
  • examples/node.v4.sohophp.app.nginx.conf.example