Generate an RPM Spec from a NodeJS package
npm install --save autorpmspec
- Generates an RPM Spec
- Creates a systemd service
The systemd service file uses the npm start
script to start your application.
{
"scripts": {
"start": "node server.js"
}
}
The following directories are used for your application:
Directory | Purpose |
---|---|
/var/lib/:projectName |
application |
/var/log/:projectName |
logs |
the spec property inside your existing package.json file. |
list the package dependencies in the requires
array:
{
"spec": {
"requires": [
"vim",
"screen"
]
}
}
{
"spec": {
"buildRequires": [
"python"
]
}
}
List files and directories that need to be executable:
{
"spec": {
"executable": [
"./other-scripts/my-script.js",
"./scripts"
]
}
}
{
"spec": {
"pre": [
"echo example"
],
"post": [
"echo example"
],
"preun": [
"echo example"
],
"postun": [
"echo example"
]
}
}
specify environment variables during startup:
{
"spec": {
"environment": {
"NODE_ENV": "production",
"NODE_INSTANCE": "%i"
}
}
}
--release
flag:
autorpmspec --release=7
--name
flag:
autorpmspec --name=my-cool-api