Workbench API. Handles these endpoints:
/v1/datasets/{workflow_id}-{workflow_slug}/datapackage.json/v1/datasets/{workflow_id}-{workflow_slug}/r{revision}/datapackage.json/v1/datasets/{workflow_id}-{workflow_slug}/r{revision}/README.md/v1/datasets/{workflow_id}-{workflow_slug}/r{revision}/data/{table}.{csv|json|parquet}
We're gung-ho on Docker. This server runs on NodeJS, but you needn't install Node. Just use Docker.
We don't respect your node-modules/ directory; our tooling leaves it empty.
Each time you want to modify deps, you must rebuild package-lock.json from
scratch:
- Edit dependencies in
package.json(optionally, usenpm install) rm -rf node_modules/if the directory exists.- Run
bin/refresh-package-lock.sh. All deps will be re-found from scratch.
You never need to npm update. bin/refresh-package-lock.sh updates all
transient dependencies.
Run bin/test. It'll run Jest atop a mock database and mock storage
systems.
If you modify dependencies, Ctrl+C and restart.
- Choose a unique test-case ID and a slug: e.g.,
123-test-wrong-slug. - Add files to
test/data/wf-123/datapackage.json. See other files for examples. - Optionally (depending on what you're testing), add
test/data/wf-123/r1/datapackage.jsonandtest/data/wf-123/r1/data/*. - Add SQL to
test/sql/123-test-wrong-slug.sql. See other files for examples. - Add test to
test/*.ts. Be sure the test name incluess test-case ID: e.g.,test('123. something something something', async () => {...}).
Being consistent about test IDs lets us easily detect unused files so we can delete them.
For developing: use cjworkbench's
bin/dev start.
If you want to test this dev server before committing, in your cjworkbench
development environment, disable the cjworkbench-included api and run this
one instead.
bin/dev start --scale api=0
../cjworkbench-api/bin/run-in-cjworkbench-bin/dev/environment.shWhen deploying, consider all these:
PGHOST,PGUSER,PGPASSWORD,PGDATABASE: database parametersCJW_STORAGE_ENGINE:gcsors3CJW_STORAGE_ENDPOINT: e.g.,https://s3.us-east-1.amazonaws.comCJW_STORAGE_BUCKET: something likedatasets.workbenchdata.comGOOGLE_APPLICATION_CREDENTIALS,AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY, etc.: we rely on S3 and Google Storage libraries to read authentication info from your environment. They can use these environment variables; they can use your Kubernetes pod's metadata service; and so on.
GET /healthz should return 200 OK with {"database":"ok","storage":"ok"}.
Copyright (c) 2021 Tables, Inc. Released under the AGPL-3.0 license. See
LICENSE.