´óÏó´«Ã½

  • Generates an RPM Spec file for your project

  • Creates a service definition file

  • Supports configuration using your existing package.json

  • Currently supports CentOS 7

UsageCopy heading link to clipboard

Let's start with a simple Node.js project:

Code Snippet
my-cool-api
├── package.json
└── server.js

0 directories, 2 files

First run npm install to install your dependencies:

Code Snippet
npm install

This creates the node_modules directory:

Code Snippet
my-cool-api
├── node_modules
├── package.json
└── server.js

1 directory, 2 files

Run the speculate command from inside the project directory:

Code Snippet
speculate

You've now got an RPM Spec file and a systemd service definition for your project. You'll also notice that your application has been packaged into a tar.gz archive, ready to be built with an RPM building tool like or :

Code Snippet
my-cool-api
├── SOURCES
│   └── my-cool-api.tar.gz
├── SPECS
│   └── my-cool-api.spec
├── node_modules
├── my-cool-api.service
├── package.json
└── server.js

3 directories, 5 files

Speculate is designed to be used at build time, just before you package your application into an RPM. Because of this, we recommend adding the generated files to your .gitignore file:

Code Snippet
*.service
SOURCES
SPECS