@0x4447/hotpepper 中文文档教程

发布于 6年前 浏览 25 项目主页 更新于 3年前

Hot Pepper

我们创建了 Hot Pepper,通过根据 package.json 文件的内容和执行 CLI 的位置设置自定义配置文件,快速将 NodeJS 服务器添加到 SystemD。

我们更喜欢使用 SystemD,因为它内置于 Debian 中,负责进程的生命周期,并且比当今市场上的其他解决方案使用更少的资源。 因此,您的应用程序可以获得更多的 CPU 和 RAM。 更不用说整个服务器将设置为自动启动。 这样,当您启动服务器/计算机时,添加到 SystemD 的所有服务器始终准备就绪。

此外,您还可以节省时间,因为您无需为给定项目中的数十个微服务手动创建 .service

How to install

] sudo npm install -g @0x4447/hotpepper

How to use

] sudo hotpepper -s .

Where to get help

] hotpepper -h

What to Expect

在包含项目的目录中运行命令。 如果所有必要的数据都存在于 package.json 文件中,则该工具……

  • Generates a .service file saved in the correct SystemD directory
  • The app forces SystemD to reload the service files
  • The app starts your server
  • The app tells SystemD to start your server every time the system boots

Sample of a .service file:

[Unit]
Description=example.com
Documentation=https://github.com/user/example.com
After=network.target

[Service]
EnvironmentFile=/home/admin/example.com/.env
Type=simple
User=admin
Group=admin
WorkingDirectory=/home/admin/example.com
ExecStart=/usr/bin/node bin/server
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=example.com
Restart=on-failure
RestartSec=3
KillMode=process
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

完成后,该应用程序会通知您该过程是否成功。

Where are the logs?

运行此命令以查看服务器日志:sudo tail -f /var/log/syslog。 每个日志条目都附有项目的名称。

The End

如果您喜欢这个项目,请考虑给它一个????。 并查看我们的 0x4447 GitHub 帐户,其中包含您可能会觉得有用或有趣的其他资源。

该项目由 0x4447 LLC 提供,这是一家专门在 AWS 上构建自定义解决方案的软件公司。 点击此链接了解更多信息:https://0x4447.com。 或者,发送电子邮件至 hello@0x4447.email

???? Hot Pepper

We created Hot Pepper to quickly add a NodeJS server to SystemD by setting up a custom configuration file based on the content of the package.json file and the location in which the CLI was executed.

We prefer to use SystemD, because it's built into Debian, takes care of the lifetime of the process, and uses fewer resources than other solutions on today's market. Thus, you get more CPU and RAM for your app. Not to mention that the entire server will be set to Auto Start. This way, all the servers added to SystemD are always ready when you start your server/computer.

In addition, you'll save time because you won't be hand-creating a .service for the dozens of micro services within a given project.

How to install

] sudo npm install -g @0x4447/hotpepper

How to use

] sudo hotpepper -s .

Where to get help

] hotpepper -h

What to Expect

Run the command in the directory that contains your project. If all necessary data is present in the package.json file, the tool…

  • Generates a .service file saved in the correct SystemD directory
  • The app forces SystemD to reload the service files
  • The app starts your server
  • The app tells SystemD to start your server every time the system boots

Sample of a .service file:

[Unit]
Description=example.com
Documentation=https://github.com/user/example.com
After=network.target

[Service]
EnvironmentFile=/home/admin/example.com/.env
Type=simple
User=admin
Group=admin
WorkingDirectory=/home/admin/example.com
ExecStart=/usr/bin/node bin/server
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=example.com
Restart=on-failure
RestartSec=3
KillMode=process
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

Once complete, the app lets you know whether the process was successful.

Where are the logs?

Run this command to view the server logs: sudo tail -f /var/log/syslog. Each log entry has the name of the project attached.

The End

If you enjoyed this project, please consider giving it a ????. And check out our 0x4447 GitHub account, which contains additional resources you might find useful or interesting.

This project is brought to you by 0x4447 LLC, a software company specializing in building custom solutions on top of AWS. Follow this link to learn more: https://0x4447.com. Alternatively, send an email to hello@0x4447.email.

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文