Core boiler plate code to run node application as a service in both windows or linux with auto-update.
Find a file
2022-01-28 11:47:55 +00:00
.circleci circleci: Fix bugs and other stuff, switch to 7zip for core 2021-12-02 12:26:36 +00:00
app Fixed last few issues and bugs 2020-09-12 20:31:36 +00:00
bin Moved binaries to its own folder 2022-01-11 16:51:27 +00:00
core Fix a bug in db test, finished application update. Fixed a few bugs and did some refactoring. Started on application.run() functionality 2022-01-28 11:47:55 +00:00
manage Lots of dev 2020-09-07 00:47:53 +00:00
service Add 7zip decompress binaries. Removed some windows service stuff. Fixed uninstall 2021-12-02 11:01:45 +00:00
test Fix a bug in db test, finished application update. Fixed a few bugs and did some refactoring. Started on application.run() functionality 2022-01-28 11:47:55 +00:00
.gitignore Application almost done 2022-01-27 18:25:33 +00:00
.npmrc Mode development. Boilerplate finished 2020-09-01 17:31:38 +00:00
appveyor.yml Another attempt to fix permission error in appveyor 2022-01-27 18:32:43 +00:00
config.json Finished implementing service-core 1.0.0 2020-09-13 04:36:33 +00:00
install.bat Fixed last few issues and bugs 2020-09-12 20:31:36 +00:00
lib.mjs Implemented basic service core support 2020-09-09 15:41:05 +00:00
npminstall.bat build also app zip file for quick deploy, fix github release bugs 2020-12-08 14:04:29 +00:00
package.json Application almost done 2022-01-27 18:25:33 +00:00
README.md Update Readme 2022-01-10 08:49:01 +00:00
runner.mjs Finished implementing service-core 1.0.0 2020-09-13 04:36:33 +00:00
uninstall.bat Add 7zip decompress binaries. Removed some windows service stuff. Fixed uninstall 2021-12-02 11:01:45 +00:00

service-core

Service-Core is a project to faciliate running a node application in (semi-)production environment on a windows machine. Using Windows Services, Service-Core will register itself and autostart on startup and make sure the application is running. In addition it will take care of maintaining the application including auto updating it seamlessly.

Notice, linux support is coming soon.

The Core

The core provides methods for updating applications as well as taking care of restarting and installing and everything needed to have a pleasent experience running a node application in Windows. It auto checks github for new releases based on the repository specified in config.json.

The core supports running two applications by default (specified in config.json file):

  • The manage app: Designated UI node app to provide UI interface on top of service-core. Not needed as service-core already does everything by itself but nice to have to remotely read logs and manually trigger updates among other things
  • The main app: The main application service-core is designated to run.

Both the main app and manage app get regular update checks and will automatically be installed if a new version is detected.

API

To build a service-core application I recomennd checking out hello world app but in short, all service core applications require the following things:

  • index.mjs that exposes a function called start(config, db, log, core, http, port)
  • The application in question must use the passed on http parameter to call .createServer(). Otherwise service-core has no way of shutting it down to provide seamless updates among other things.

The start() function gets called with following parameters:

  • config: JSON object containing the entirety of config.json
  • db: A lowdb database available for the application to use. Also used internally in service-core to manage versions.
  • log: A bunyan logger for logging.
    • log.event.info,warn,error(message): Write a log message to the windows event viewer.
  • core: The internal core. Exposes multiple methods for managing service-core
  • http: A wrapped internal node http to call .createServer(). Allows service-core to monitor the server in question.
  • port: The port the application should be listening to.