All Projects → heartsucker → Node Deb

heartsucker / Node Deb

Licence: mit
Debian packaging for Node.js projects

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Node Deb

Pieman
Script for creating custom OS images for single-board computers
Stars: ✭ 149 (-19.89%)
Mutual labels:  ubuntu, debian
Working On Gnu Linux
《 完全用 GNU/Linux 工作》
Stars: ✭ 170 (-8.6%)
Mutual labels:  ubuntu, debian
Trojan Tutor.github.io
trojan 教程 自建梯子教程 trojan教程 trojan-gfw 科学上网 代理工具 翻墙 Ubuntu Debian 小白教程 https伪装
Stars: ✭ 150 (-19.35%)
Mutual labels:  ubuntu, debian
Ugrub
Create an ultimate multiboot USB flash drive with Grub2 bootloader
Stars: ✭ 177 (-4.84%)
Mutual labels:  ubuntu, debian
Imscp
i-MSCP Main Repository
Stars: ✭ 184 (-1.08%)
Mutual labels:  ubuntu, debian
Apt Image
📦 minimal Ubuntu for containers, with curl and support for TLSv1.3
Stars: ✭ 147 (-20.97%)
Mutual labels:  ubuntu, debian
Spotcommander
The most intuitive and feature-rich remote control for Spotify for Linux
Stars: ✭ 152 (-18.28%)
Mutual labels:  ubuntu, debian
Piadvanced
This started as a custom install for my pihole!
Stars: ✭ 144 (-22.58%)
Mutual labels:  ubuntu, debian
Terrible
An Ansible playbook that apply the principle of the Infrastructure as Code on a QEMU/KVM environment.
Stars: ✭ 161 (-13.44%)
Mutual labels:  ubuntu, debian
Tmoe Linux
🍭Without any basic knowledge of linux shell,you can easily install and configure a GNU/Linux graphical desktop environment on 📱Android termux and 💻WSL .🍰You can also run VSCode on your android phone.🍹Graphical qemu manager,🐋support running docker on Android.配置WSL和安卓手机的linux容器,桌面环境,主题美化,远程桌面,音频服务,镜像源,uefi开机启动项,webdav(nginx),fcitx输入法以及qemu-system虚拟机...
Stars: ✭ 149 (-19.89%)
Mutual labels:  ubuntu, debian
Rofi
A large collection of Rofi based custom Menu, Applets, Launchers & Powermenus.
Stars: ✭ 2,907 (+1462.9%)
Mutual labels:  ubuntu, debian
Linux Kernel Utilities
👷 Utilities to compile and / or update linux kernels for Debian and derivatives (e.g. Ubuntu, LinuxMint, etc.)
Stars: ✭ 166 (-10.75%)
Mutual labels:  ubuntu, debian
Dockerfiles
Phalcon Dockerfiles used for internal purposes.
Stars: ✭ 145 (-22.04%)
Mutual labels:  ubuntu, debian
Slim themes
A Beautiful Collection Of SLiM Themes.
Stars: ✭ 148 (-20.43%)
Mutual labels:  ubuntu, debian
Oracle Java
Ansible role to install Oracle Java 8/11 on Debian and RedHat based distributions.
Stars: ✭ 144 (-22.58%)
Mutual labels:  ubuntu, debian
Flash Chip
Ready to use Flash environment for the C.H.I.P Single Board Computer
Stars: ✭ 152 (-18.28%)
Mutual labels:  ubuntu, debian
Anlinux Resources
Image and Script for LinuxOnAndroid App
Stars: ✭ 135 (-27.42%)
Mutual labels:  ubuntu, debian
Autosetup
Auto setup is a bash script compatible with Debian based distributions to install and setup necessary programs.
Stars: ✭ 140 (-24.73%)
Mutual labels:  ubuntu, debian
Apt Smart
apt-smart: Smart, automated, robust apt-get mirror selection for Debian, Ubuntu and Linux Mint
Stars: ✭ 153 (-17.74%)
Mutual labels:  ubuntu, debian
Ansipress
AnsiPress - Simple L(Linux) E(NGINX) M(MariaDB) P(PHP7) Shared Hosting Setup
Stars: ✭ 184 (-1.08%)
Mutual labels:  ubuntu, debian

node-deb

Debian packaging for Node.js projects written 100% in bash.

Simple.

Installation

npm install node-deb

or

git clone ${url} && cd node-deb && npm run node-deb && sudo dpkg -i $(find . -maxdepth 1 -type f -name '*.deb' | tail -n 1)

Usage

A simple project can be packaged with the following command.

node-deb -- index.js lib/

This command will add all of the above files and directories to a Debian package as well as generate the scripts necessary to install, uninstall, start, and stop your application. On installation, via dpkg -i $your_package_name, dedicated Unix users and groups will be created and your distribution's default init system will start and monitor the process.

node-deb uses sane defaults, so the only thing you need to add to your package.json is the app/cli entrypoint. However, if you don't like these, there are two options for overrides: command line options, or the JSON object node_deb at the top level of your package.json. A full explanation of the different options can be found by running node-deb --help.

By default, if any of the following files exist, they will be included in the Debian package: package.json, npm-shrinkwrap.json and package-lock.json.

For example, here are some sample node_deb overrides. The full list can be found by running node-deb --list-json-overrides.

{
  "name": "some-app",
  ...
  "node_deb": {
    "init": "systemd",
    "version": "1.2.3-beta",
    "entrypoints": {
      "daemon": "foo.js --config /etc/some-app/config.js"
    }
  }
}

Command line options always override values found in the node_deb object, and values found in the node_deb object always override the values found in the rest of package.json.

Examples

Ex. 1

package.json:

{
  "name": "some-app",
  "version": "1.2.3",
  "node_deb": {
    "entrypoints": {
      "daemon": "app.js arg1 arg2"
    }
  }
}

cmd: node-deb -- app.js lib/

You will get:

  • A Debian package named some-app_1.2.3_all.deb
    • Containing the files app.js & package.json and the directory lib
    • Installed via
      • apt-get install some-app
      • apt-get install some-app=1.2.3

On install, you will get.

  • An executable named some-app
    • That starts the app with the command app.js arg1 arg2 arg3
  • An upstart init script installed to /etc/init/some-app.conf
  • A systemd unit file installed to /lib/systemd/system/some-app.service
  • A sysv int script installed to /etc/init.d/some-app
  • A Unix user some-app
  • A Unix group some-app

Ex. 2

package.json:

{
  "name": "some-other-app",
  "version": "5.0.2",
  "node_deb": {
    "entrypoints": {
      "daemon": "index.js --daemon"
    }
  }
}

cmd: node-deb -u foo -g bar -v 20150826 -- index.js lib/

You will get:

  • A Debian package named some-other-app_20150826_all.deb
    • Containing the files index.js, package.json, & npm-shrinkwrap.json|package-lock.json and the directories lib & node_modules
    • Installed via
      • apt-get install some-other-app
      • apt-get install some-other-app=20150826

On install, you will get.

  • An executable named some-other-app
    • That starts the app with the command index.js --daemon
  • An upstart init script installed to /etc/init/some-other-app.conf
  • A systemd unit file installed to /lib/systemd/system/some-other-app.service
  • A sysv int script installed to /etc/init.d/some-other-app
  • A Unix user foo
  • A Unix group bar

Ex. 3

package.json:

{
  "name": "a-third-app",
  "version": "0.10.1",
  "node_deb": {
    "init": "none",
    "dependencies": "apparmor, tor",
    "templates": {
      "postinst": "my-teplates/my-postinst-template.txt"
    },
    "entrypoints": {
      "cli": "app.js"
    }
  }
}

cmd: node-deb -- app.js lib/

You will get:

  • A Debian package named a-third-app_0.10.1_all.deb
    • Containing the files index.js, package.json, & npm-shrinkwrap.json|package-lock.json and the directories lib & node_modules
    • With additional dependencies on apparmor and tor
    • Installed via
      • apt-get install a-third-app
      • apt-get install a-third-app=0.10.1
    • With the postinst script rendered from the template my-postinst-template.txt

On install, you will get.

  • An executable named a-third-app
    • That starts the app with the command app.js
  • No upstart, systemd, or sysv scripts
  • No Unix user or group

Ex. 4

package.json:

{
  "name": "a-forth-app",
  "version": "0.10.1",
  "node_deb": {
    "init": "none",
    "dependencies": "apparmor, tor, nodejs",
    "templates": {
      "postinst": "my-teplates/my-postinst-template.txt"
    },
    "entrypoints": {
      "cli": "app.js"
    }
  }
}

cmd: node-deb --no-default-package-dependencies -- app.js lib/

You will get:

  • A Debian package named a-forth-app_0.10.1_all.deb
    • Containing the files index.js, package.json, & npm-shrinkwrap.json|package-lock.json and the directories lib & node_modules
    • With dependencies on apparmor, tor and nodejs only. No default dependencies added
    • Installed via
      • apt-get install a-forth-app
      • apt-get install a-forth-app=0.10.1
    • With the postinst script rendered from the template my-postinst-template.txt

On install, you will get.

  • An executable named a-forth-app
    • That starts the app with the command app.js
  • No upstart, systemd, or sysv scripts
  • No Unix user or group

&c.

Note: Removal via apt-get purge will attempt to remove the user and group defined in the Debian package. This can have serious consequences if the user or group is shared by other applications!

node-deb can Debian-package itself. Just run npm run node-deb.

More complete examples can be found by looking at test.sh and the corresponding projects in the test directory.

Options

This section incldues addtional details about the more advanced functionality of node-deb

--install-strategy

The install strategy determines how dependencies in node_modules are included in the final Debian package.

  • auto: This attempts to take a minimal subset of package from the node_modules director using npm ls --prod. If this is not possible, it falls back to the copy method. On install, if node_modules is present, it runs npm rebuild --prod. If node_modules is not present, it runs npm install --prod. If npm is not present, it issues a warning that dependencies may be missing and continues with the Debian package installation.
  • copy: This runs a blind cp -rf on the node_modules directory and includes everything in the Debian package. No actions are taking during package installation.
  • npm-install: This option does not include the node_module in the Debian package and runs npm install --production as part of the postinst maintainer script.

Requirements

  • dpkg
  • fakeroot
  • jq

These are all available through apt and brew.

Dev Requirements

Tests are run via docker. This is also available through apt and brew.

Support

node-deb only officially supports the currently supported versions of Debian and Ubuntu (LTS). This includes both for building packages and deploying packages. At the time of this update, this translates to Debian Wheezy through Stretch and Ubuntu Trusty through Xenial. Care has been taken to ensure this packages correctly on macOS, and macOS specific issues should still be reported.

Contributing

Please make all pull requests to the develop branch.

Please make sure all pull requests pass the test suite locally.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].