Node.js: 多环境部署

本文件是Node.js 快速部署指南指南的一部分。您可以在这里查看完整指南:快速安全地在 Stackhero 上部署 Node.js。

👋 欢迎来到 Stackhero 文档!

Stackhero 提供即开即用的 Node.js cloud 环境,助您加速开发进程:

  • 几秒钟内部署到生产环境,只需简单的 git push,无需额外工具或手动配置。
  • 支持自定义域名,并自动配置 HTTPS 证书,让您的应用安全无忧,无需额外设置。
  • 自动备份、一键更新以及可预测的定价,让您专注于功能开发,基础设施交由 Stackhero 管理。
  • 基于专属私有基础设施,确保性能稳定和高安全性。

节省时间,降低运维负担:只需几分钟,您的应用即可在 Stackhero 的 Node.js cloud hosting 上运行。

如需管理生产和预发布等多个环境,可先将当前远程仓库重命名为 stackhero-staging:

git remote rename stackhero stackhero-staging

然后在控制台新建 Node.js 服务,并添加为 stackhero-production:

git remote add stackhero-production ssh://stackhero@<XXXXXX>.stackhero-network.com:222/project.git

之后即可分别部署到不同环境:

git push stackhero-production main

或

git push stackhero-staging main