Community maintained Docker config for the knot server
Dockerfile 49.5%
HCL 18.5%
Shell 7.1%
Other 24.9%
35 2 0

Clone this repository

https://tangled.org/psychedeli.ca/knot-docker
git@tangled.org:psychedeli.ca/knot-docker

For self-hosted knots, clone URLs may differ based on your setup.

readme.md

Knot Docker#

IMPORTANT This is a community maintained repository, support is not guaranteed.

Docker container and compose setup to run a Tangled knot and spindle, hosting your own repository data and CI.

Pre-built Images#

There is a repository of pre-built images for tags starting at v1.8.0-alpha if you prefer.

docker pull tngl/knot:v1.10.0-alpha
docker pull tngl/spindle:v1.10.0-alpha

Note that these are not official images, you use them at your own risk.

Building The Images#

Both the knot and spindle images are built using the same Dockerfile, since they're sourced from the same codebase and can therefore share a lot of the build steps (such as go mod download), caching results between them. You can build the images locally by running docker bake:

docker bake

Optionally, choose a target image to build:

docker bake knot
docker bake spindle

By default this will build the latest tag, but you can target a specific tag like so:

docker bake knot-v1-10-0-alpha spindle-v1-10-0-alpha

The command above for example will build the v1.10.0-alpha tag for both the knot and spindle. They're expressed as individual bake targets, so you can also optionally specify just one to build at a specific version.

You can also build all tagged releases:

docker bake all

By default it will also create a git / spindle user with user and group ID 1000:1000, but you can change it with the UID and GID build arguments.

docker bake UID=$(id -u) GID=$(id -g)

The command above for example will create a user with the host user's UID and GID. This is useful if you are bind mounting the repositories and app folder on the host, as in the provided docker-compose.yml file.

You can also build the latest commit on master for both services by using the -edge targets. These will build to a tag named :edge to distinguish it from the :latest release:

docker bake edge
#
# or, with a specific target image...
#
docker bake edge-knot
docker bake edge-spindle

When using compose, these can be specified as build arguments which will be passed to the builder.

build:
  context: .
  args:
    TAG: master
    UID: 1000
    GID: 1000

This will for example tell docker to build it using the master branch like the command.

Setting Up The Image#

The simplest way to set up your own knot and spindle is to use the provided compose file and run the following:

export KNOT_SERVER_HOSTNAME="knot.example.com"
export SPINDLE_SERVER_HOSTNAME="spindle.example.com"
export KNOT_SERVER_OWNER="did:plc:yourdidgoeshere"
export KNOT_SERVER_PORT="443"

docker compose up --detach

This will setup everything for you including a reverse proxy.