carpenterd-worker
The carpenterd
worker process for executing builds.
Install
npm install carpenterd-worker --save
Usage
const carpenterd = require('carpenterd-worker');
const app = new Map();
app.rootDir = require('path').join(__dirname);
carpenterd(app)
.start(carpenterd.worker);
Description
carpenterd-worker
is responsible for receiving job messages from carpenterd
, fetching the fully built npm
tarball from a place like amazon s3, execute thewebpack
/browserify
/babel
build using workers-factory
.
Dependencies
nsq
for job distribution to all the workers in given cluster.- amazon s3 or an s3 like store for storing built assets and for fetching tarballs stored by
carpenterd
. - A
cassandra
cluster that is storing the warehouse.ai
system data.
Configuration
See the example config config.example.json
in this repo.
notes
nsq
config option is for a fork of nsq.js
that has kubernetes support but otherwise has the same options.
- There is an additional configuration option
statusTopic
for setting the nsq topic that should be written to for status updates.
assets.prefix
in the config is the bucket name for where the public CDN assets are uploaded.http
is the http port the healhcheck listens on.npm-tars
the npm tarball bucket to fetch from.datastar
the configuration for cassandra that gets passed directly to datastar
.
Status-Api
Carpenterd-worker supports posting messages to the [warehouse.ai] status-api via NSQ.
It will post messages to the nsq topic configured at:
{
"nsq": {
"statusTopic": "an-nsq-topic",
},
}
The NSQ payloads will be object that take the form:
{
eventType: "event|error|complete",
name: "package-name",
env: "dev",
version: "1.2.3",
locale: "en-US",
buildType: "webpack",
message: "Description of what happened"
}
Event Types
In the status-api NSQ payload there is a field called eventType
. The possible values that carpenterd-worker will send are:
event
- Used for interim statuses that a user might care about, but doesn't affect/progress the overall build statuscomplete
- Used to indicate that the build is completederror
- Used to indicate that carpenterd-worker
encountered an error and wasn't able to complete the build