graphql-docker-api

module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2017 License: MIT

README

GraphQL Docker API

pipeline status coverage report Go Report Card License

Docker Pulls Docker Pulls

Logo

A GraphQL Server for the Docker API, written in Golang.

GraphQL Schema

  • Schema files can be found here.
  • You can check the query-ready fields in the TODO list

Note: It's important to keep this schema synced with the types implemented in the wrapper, best efforts are made in order to keep it so. That being said, You need to know this schema is subject to change as the time goes by and new changes are introduced in the Docker API and this wrapper as well.

Getting Started

Building from source
  • Get the package: go get -d gitlab.com/klud/graphql-docker-api/cmd/gql-dkr
  • Dependencies
    • Not using dep. Go to the project folder with cd $GOPATH/src/gitlab.com/klud/graphql-docker-api/cmd/gql-dkr and go get ./, this will download the depedencies needed, once that's done build the package with go build.
    • Using dep. Go to the project folder with cd $GOPATH/src/gitlab.com/klud/graphql-docker-api, and run dep install, now get to $GOPATH/src/gitlab.com/klud/graphql-docker-api/cmd/gql-dkr and build the package with go build.

That's pretty much it. Congrats now You have GraphQL Docker API on your system.

Docker image
Local socket
docker run -d \
--name docker-gql \
-p 8080:8080 \
-e API_ENDPOINT="/api" \
-v /var/run/docker.sock:/var/run/docker.sock \
klud/docker-gql

Note: The -v /var/run/docker.sock:/var/run/docker.sock option can be used in Linux environments only.

Remote host
HTTP
docker run -d \
--name docker-gql \
-p 8080:8080 \
-e API_ENDPOINT="/api" \
-e DOCKER_HOST="http://<host>:<port>" \
klud/docker-gql
HTTPS
docker run -d \
--name docker-gql \
-p 8080:8080 \
-e API_ENDPOINT="/api" \
-e DOCKER_HOST="https://<host>:<port>" \
-v /path/to/folder/containing/the/docker/certs:/etc/docker \
klud/docker-gql

Environment variables

  • API_ENDPOINT: Endpoint the API will work on (default: "/graphql").
  • DOCKER_CERT_PATH: When using safe connection to Docker Remote API.
  • DOCKER_HOST: Host the API will retrieve information from (default: "/var/run/docker.sock").
  • GQL_PORT: Port the API will listen on (default: ":8080").
Notes
  • If using a Docker Remote API, this must be specified with the either HTTP or HTTPS protocols (e.g,: DOCKER_HOST="http://<host>:<port>").
  • When using HTTPS, the TLS certs must be placed in /etc/docker or the /path/to/folder/containing/the/docker/certs must be mounted under /etc/docker inside the running container, and must follow the semantics behind the DOCKER_CERT_PATH env var.

TODO

  • GraphQL Queries
    • Map to endpoints of the Docker API
      • Containers
      • Images
      • Swarm
        • Services
        • Stacks
      • System
      • Volumes
      • Secrets
      • Tasks
  • GraphQL Mutations
  • GraphQL Subscriptions if possible, especially for Docker events
  • GraphQL Descriptions
  • Authentication / Authorization
  • Makefile for local build
    • Binary
    • Docker image
  • CI integration
  • Build from source how-to
  • Docker image how-to

Open-Source libraries and tools


Inspired by rm3l/docker-api-graphql

forthebadge forthebadge

Directories

Path Synopsis
cmd
gql-dkr command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL