1.0.0-alpha • Published 5 years ago

@flaki/daemon v1.0.0-alpha

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

Dǣmon

For a moment I wanted to call this "Me-tlify", but I would rather not unleash the wrath of trademark rights lawyers, however it does illustrate pretty well what this tool is for.

Dǣmon lets you create self-hosted (for now, static) site deployments that react and respond to code repository changes. You can have multiple static sites deployed under various "environments", which react automatically to repo changes (e.g. pushes).

Currently only GitHub webhooks supported, but anything else should be fairly easy to implement (Gitlab is on the roadmap). Well, there's no actuall roadmap, but I'm thinking about it anyway.

Installation & use

npx @flaki/daemon <configfile.conf>

Debugging

DEBUG=1, DEBUG=verbose

Logging incoming webhooks.

Configuration

The configuration file follows the .env file format, uppercase alphanumeric keys followed by = and the value, one value one row.

The following keys may be used in the configfile:

KeyValue
PORTPort to listen for incoming webhooks, default: 9999
HMAC_KEYThe HMAC-SHA-256 digest secret used for signing incoming webhook payloads
WORKDIRThe direrctory where the git repo resides, Dǣmon will pull & run commands in this repo
REPOThe repository name to operate on, needed so that Dǣmon does not get confused by noise from other webhooks referencing events in other repositories
ENVSThe branches Dǣmon should handle, comma separated list of branchname:port values, where port is the port number where the generated site for this branch will be served from
OUTDIRDefaults to _deploy. Dǣmon passes this and the branch in the environment variable OUTPUT_DIR to BUILDCMD, e.g.: OUTPUT_DIR=_deploy/mybranch npm run build
BUILDCMDThe command to execute after a successful pull, defaults to npm run build
LOGSDIREnable logging incoming webhook payloads in the given folder, ideal for debugging and feature development (default: no logging)

Q & A

Is this Serverless™?!

Au contraire, this is Server-YES! Dǣmon runs as a Node.js application, listens to incoming webhooks, and serves the generated websites (branches) on different ports as a static server, so it requires to be run, somewhat unsurprisingly, as a daemon.

Only works with static sites?

Yes, albeit this might change in the future. In all practicality you can bend Dǣmon to your will through configuration even today, but the currently intended primary use case is static sites.

npm keeps screaming about critical vulnerabilities

Dǣmon has (intentionally) few dependencies, node-static is currently the only one. I am currently waiting for a maintainer change to realize, at which point these issues shall be fixed. If that doesn't happen in due time I'll look into replacing the dependency with a fork or in its entirety.

1.2.3

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago

1.0.0-beta2

5 years ago

1.0.0-beta3

5 years ago

1.0.0-beta4

5 years ago

1.0.0-beta

5 years ago

1.0.0-alpha

5 years ago

0.1.0-rc2

5 years ago

0.1.0-rc1

5 years ago