Worker server for the REUSE API, taking and executing requests
Go to file
Linus Sehn 6c9c7f29da chore: bump inventory 2023-11-04 12:10:14 +01:00
.reuse copy and small edits from reuse/api 2019-08-09 10:55:19 +02:00
LICENSES copy and small edits from reuse/api 2019-08-09 10:55:19 +02:00
docker-image make REUSE compliant 2023-05-10 16:17:38 +02:00
worker-setup chore: bump inventory 2023-11-04 12:10:14 +01:00
.gitignore fix REUSE compliance 2022-12-04 11:08:58 +01:00
.gitmodules make REUSE compliant 2021-06-10 17:46:11 +02:00
Dockerfile fix logging in local dev docker container 2023-03-26 11:14:52 +02:00 adapt to new script name and parameters 2023-03-26 11:15:24 +02:00
docker-compose.yml add to shared external network 2020-10-28 14:37:19 +01:00


REUSE status

This repository contains two elements for the REUSE API's worker server:

  • The Ansible playbook that initiates (and updates) the worker server itself. Currently written for an Ubuntu server.
  • The Docker image that performs a reuse lint for a Git repository. A container based on this image is spun up for each check.

It is supposed to be invoked by the REUSE API service.


Clone this repo:

git clone --recurse-submodules

Update the inventory submodule to reflect the newest changes to the list of our hosts and the groups that they are in

git submodule update --remote


Just run

ansible-playbook setup.yml \
        -i inventory/hosts \
        -l "reuse_api_server" \
        # limit to single server \
        # -l "" \

from the worker_setup directory to deploy all hosts given in the inventory. You need access to the root user of the server.

Note the tags that allow you to only run specific routines.

Docker image

The Docker image is based on fsfe/reuse and contains the simple script in this repository.

To build the image, run docker build -t reuse-api .


Running the check is fairly simple:

$ ssh -i ~/.ssh/reuse_ed25519 reuse_lint_repo -r
Cloning into '/project'...

Checking REUSE compliance for commit d3121becd4d715df40ba6b72394582b85d1c5cc9:


* Bad licenses:
* Missing licenses:
* Unused licenses:
* Used licenses: AGPL-3.0-or-later, Apache-2.0, CC-BY-SA-4.0, CC0-1.0, GPL-3.0-or-later, MIT, OFL-1.1
* Read errors: 0
* Files with copyright information: 61 / 61
* Files with license information: 61 / 61

Congratulations! Your project is compliant with version 3.0 of the REUSE Specification :-)

The exit codes of this command can be evaluated in a later stage, so that a web service could decide which badge to display.

Local Development

You can imitate the API Worker in a Docker image for local tests (no production!). There are some specialities with that:

  • Instead of the reuse user, the root user should execute all checks
  • The Docker container does not have its own Docker daemon, but used the host's Docker socket
  • When spun up this way, you can SSH as root with the test_ed25519 key

To setup everything, follow these steps from within the root of this repo:

  1. Build the reuse-api-worker-runner image that will eventually spin up inside the worker for every repo check. Only has to be done once: docker build --no-cache -t reuse-api-worker-runner docker-image/

  2. Build and deploy the REUSE API Worker with: docker-compose up -d --build

Now you can task the local worker with REUSE checks. You can either do this via a direct Docker command, or via SSH (just like the REUSE API does it):

docker exec reuse-api-worker reuse_lint_repo -r

ssh -i ./worker-setup/files/test_ed25519 root@DOCKER-CONTAINER-IP reuse_lint_repo -r

Note that for the latter you enter as root (unlike with the production API), and you require the container's IP address. In a Docker network, you can also use the container name reuse-api-worker.