如何使用 systemd 将 Node.js 个应用程序部署为单个可执行文件?

How do I deploy Node.js applications as a single executable file using systemd?

我想将我的节点应用程序部署为单个可执行文件,是否可以使用 systemd、容器。我对 systemd 和容器没有足够的了解。有知道的请帮帮我

在我工作的地方,我们使用 pm2 来 运行 NodeJS 应用程序。 它允许您 运行 一台服务器上的多个实例,监控它们并在需要时重新启动(失败时或者您可以提供内存限制)。

如果您坚持使用 systemd,则必须创建一个单元 - 一个描述您的 systemd 应用程序执行路径的文件。

通常会在 /usr/lib/systemd/system 您必须创建一个以“.service”结尾的文件

[Unit]
Description=My NodeJS App
[Service]
ExecStart=/usr/bin/node /path/to/my/app/index.js