package datakit-bridge-github

  1. Overview
  2. Docs
A bi-directional bridge between the GitHub API and Datakit

Install

Dune Dependency

Authors

Maintainers

Sources

datakit-0.9.0.tbz
md5=46e4fcd1e9c05e4587ae1663518a8c74

Description

The package provides a bi-directional bridge between the GitHub API and Datakit, so you can talk to the GitHub API using filesystem and Git-like commands only. The datakit-github programs can start a webhook server to listen for GitHub events in real time, and project it into a Git repository. It also monitors that Git repository for user-provided changes, and translate them into GitHub API calls.

Published: 15 Feb 2017

README

DataKit -- Orchestrate applications using a Git-like dataflow

DataKit is a tool to orchestrate applications using a Git-like dataflow. It revisits the UNIX pipeline concept, with a modern twist: streams of tree-structured data instead of raw text. DataKit allows you to define complex build pipelines over version-controlled data.

DataKit is currently used as the coordination layer for HyperKit, the hypervisor component of Docker for Mac and Windows, and for the DataKitCI continuous integration system.

There are several components in this repository:

  • src contains the main DataKit service. This is a Git-like database to which other services can connect.

  • ci contains DataKitCI, a continuous integration system that uses DataKit to monitor repositories and store build results.

  • ci/self-ci is the CI configuration for DataKitCI that tests DataKit itself.

  • bridge/github is a service that monitors repositories on GitHub and syncs their metadata with a DataKit database. e.g. when a pull request is opened or updated, it will commit that information to DataKit. If you commit a status message to DataKit, the bridge will push it to GitHub.

  • bridge/local is a drop-in replacement for bridge/github that just monitors a local Git repository. This is useful for local testing.

Quick Start

The easiest way to use DataKit is to start both the server and the client in containers.

To expose a Git repository as a 9p endpoint on port 5640 on a private network, run:

$ docker network create datakit-net # create a private network
$ docker run -it --net datakit-net --name datakit -v <path/to/git/repo>:/data docker/datakit

Note: The --name datakit option is mandatory. It will allow the client to connect to a known name on the private network.

You can then start a DataKit client, which will mount the 9p endpoint and expose the database as a filesystem API:

# In an other terminal
$ docker run -it --privileged --net datakit-net docker/datakit:client
$ ls /db
branch     remotes    snapshots  trees

Note: the --privileged option is needed because the container will have to mount the 9p endpoint into its local filesystem.

Now you can explore, edit and script /db. See the Filesystem API for more details.

Building

The easiest way to build the DataKit project is to use docker, (which is what the start-datakit.sh script does under the hood):

docker build -t docker/datakit:server -f Dockerfile.server .
docker build -t docker/datakit -f Dockerfile .
docker run -p 5640:5640 -it --rm docker/datakit --listen-9p=tcp://0.0.0.0:5640

These commands will expose the database's 9p endpoint on port 5640.

If you want to build the project from source without Docker, you will need to install ocaml and opam. Then write:

$ make depends
$ make && make test

For information about command-line options:

$ datakit --help

Prometheus metric reporting

Run with --listen-prometheus 9090 to expose metrics at http://*:9090/metrics.

Note: there is no encryption and no access control. You are expected to run the database in a container and to not export this port to the outside world. You can either collect the metrics by running a Prometheus service in a container on the same Docker network, or front the service with nginx or similar if you want to collect metrics remotely.

Language bindings

  • Go bindings are in the api/go directory.

  • OCaml bindings are in the api/ocaml directory. See examples/ocaml-client for an example.

Licensing

DataKit is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

Dependencies (23)

  1. github >= "2.1.0" & < "3.0.0"
  2. github-hooks >= "0.1.1" & < "0.2.0"
  3. datakit-client >= "0.9.0" & < "0.10.0"
  4. datakit-server >= "0.9.0" & < "0.10.0"
  5. datakit-github >= "0.9.0" & < "0.10.0"
  6. protocol-9p >= "0.8.0"
  7. uri >= "1.8.0"
  8. prometheus-app
  9. conduit
  10. nocrypto
  11. hex
  12. hvsock >= "0.8.1" & < "0.14.0"
  13. win-eventlog
  14. asl
  15. mtime < "1.0.0"
  16. fmt
  17. logs
  18. lwt >= "2.7.0"
  19. cmdliner < "1.0.0"
  20. topkg build
  21. ocamlbuild build
  22. ocamlfind build
  23. ocaml

Dev Dependencies (1)

  1. datakit with-test & < "0.10.0"

Used by

None

Conflicts

None