Skip to content
Configuration as Code with ECMAScript
Branch: master
Clone or download
dlespiau Merge pull request #218 from miklosp/logo
Added adjusted new logo
Latest commit c0da9af Jun 13, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
build build: Bump go to version 1.12.1 Mar 22, 2019
docs added new logo Jun 13, 2019
examples examples: Update the list of objects created by micro-service.js Jun 12, 2019
pkg Support HCL in unparse May 30, 2019
std build: Bump the std package version to 0.2.7 Jun 11, 2019
tests Support HCL in unparse May 30, 2019
.dockerignore dockerignore: Minimize the context to send to the docker daemon Nov 12, 2018
.gitignore added new logo Jun 13, 2019
.travis.yml Revert "build: Use a more recent libstd++ to run jk in the deploy step" Apr 25, 2019
LICENSE LICENSE: Fill in the blanks Mar 1, 2019
Makefile Rename std.js to index.js May 1, 2019
README.md fix run-in-docker instructions Apr 16, 2019
RELEASING.md build: Add a release checklist Jun 12, 2019
completion.go doc(cli): zsh completion Mar 15, 2019
generate.go generate: Fix importing generate script not in cwd May 13, 2019
go.mod vm: Internalize waiting for flush and emiting dependencies May 10, 2019
go.sum vm: Internalize waiting for flush and emiting dependencies May 10, 2019
jk.go jk: Silence errors and usage coming from cobra Feb 13, 2019
kubernetes.js Implement module loading Oct 24, 2018
nginx.js all: Use @jkcfg/std instead of std Apr 19, 2019
params_option.go jk: Factor out a vm object from run May 10, 2019
run-in-docker.sh jk: Rename the github org to jkcfg Dec 14, 2018
run-release.sh build: Remove the subshell when pushing Jun 11, 2019
run-tests.sh tests: Run eslint on examples May 14, 2019
run.go generate: Introduce a generate command May 11, 2019
rx.js Make module resolution deal with relative paths Oct 28, 2018
version.go version: Add a version command Dec 13, 2018
vm.go vm: Fix help text of the -p option May 13, 2019

README.md

jk

Build Status

jk is still in very early stages. The standard library API isn't frozen and will most likely change. Feedback is most definitely welcome!

jk - configuration as code

jk is a data templating tool designed to help writing structured configuration files.

The main idea behind jk is to use a general purpose language for this task. They offer mature tooling, great runtimes, a well established ecosystem and many learning resources. jk uses Javascript and a runtime tailored for configuration.

Quick start

A good way to start with jk is to read our introduction tutorial.

More complex examples

Architecture & design

v8

jk itself is a Javascript runtime written in Go and embedding v8. It uses Ryan Dahl's v8worker2 to embed v8 and flatbuffers for the v8 ⟷ Go communication.

Hermeticity

While a general purpose language is great, configuration code can be made more maintainable by restricting what it can do. A nice property jk has to offer is being hermetic: if you clone a git repository and execute a jk script, the resulting files should be the same on any machine. To give concrete examples, this means the jk standard library doesn't support environment variables nor has any networking capability.

Library support

jk provides an unopinionated data templating layer. On top of the jk runtime, libraries provide APIs for users to write configuration.

  • mixins: build and compose configuration objects
  • kubernetes: build Kubernetes objects

Roadmap

This project is still in early stages but future (exciting!) plans include:

  • Reach the state of having Kubernetes examples working and well documented.
  • Work on hermeticity. (eg. #110, #44, topic/hermeticity).
  • Native typescript support (#54).
  • HCL support (#94).

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue with the owners of this repository before making a change.

Setup

The jk executable itself is written in Go, but the JavaScript part of this project requires NodeJS.

Prerequisites:

  • go 1.11.4 or later (modules support)
  • nodejs, npm
  • make

First off, clone this repository:

$ git clone https://github.com/jkcfg/jk.git
# or with hub:
$ hub clone jkcfg/jk

$ cd ./jk

Then pull most of the dependencies using the Makefile:

$ make dep

jk is linked against v8worker2. As building V8 takes ~30 minutes, prebuilt versions are provided for linux/amd64 and darwin/amd64. This also includes flatc from flatbuffers:

# download the prebuilt artifacts from GitHub:
$ git clone https://github.com/jkcfg/prebuilt.git
$ cd ./prebuilt

# x64 Linux:
$ make install-linux-amd64

# x64 macOS:
$ make install-darwin-amd64

Building

After setting up the environment, the jk binary can be built:

$ make jk
$ ./jk --help # confirm it works

Additionally, on Linux, it's possible to use a docker container to build the project instead of installing the prebuilt libraries and binaries:

$ ./run-in-docker.sh make dep jk
You can’t perform that action at this time.