Skip to content

Commit

Permalink
Major rewrite with just breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-vynar committed Apr 16, 2024
1 parent f91c3b9 commit e334d4c
Show file tree
Hide file tree
Showing 44 changed files with 1,181 additions and 1,136 deletions.
24 changes: 20 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
## Changelog

### UNRELEASED

* Add an option to disable counting of tags if it is very slow: `-disable-count-tags`
* Add an option to specify a comma-separated list of repos to purge: `-purge-from-repos`
### 0.10.0 (2024-04-16)

**JUST BREAKING CHANGES**

* We have made a full rewrite. Over 6 years many things have been changed.
* Renamed github/dockerhub repo from docker-registry-ui -> registry-ui
* Switched from doing raw http calls to github.com/google/go-containerregistry
* URLs and links are now matching the image references, no more "library" or other weird URL parts.
* No namespace or only 2-level deep concept
* An arbitrary repository levels are supported
* It is even possible to list both sub-repos and tags within the same repo path if you have those
* Added support for OCI images, so now both Docker + OCI are supported
* Proper support of Image Index (Index Manifest)
* Display full information available about Image or Image Index
* Sub-images (multi-platform ones) are linked under Image Index
* Changed format of config.yml but the same concept is preserved
* Event listener path has been changed from /api/events to /event-receiver and you may need to update your registry config
* Removed built-in cron scheduler for purging tags, please use the normal cron :)
* Now you can now tune the refresh of catalog and separately refresh of tag counting, disable them etc.
* Everything has been made better! :)

### 0.9.7 (2024-02-21)

Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.22.0-alpine3.19 as builder
FROM golang:1.22.1-alpine3.19 as builder

RUN apk update && \
apk add ca-certificates git bash gcc musl-dev
Expand All @@ -9,7 +9,7 @@ ADD registry registry
ADD *.go go.mod go.sum ./

RUN go test -v ./registry && \
go build -o /opt/docker-registry-ui *.go
go build -o /opt/registry-ui *.go


FROM alpine:3.19
Expand All @@ -21,7 +21,7 @@ RUN apk add --no-cache ca-certificates tzdata && \

ADD templates /opt/templates
ADD static /opt/static
COPY --from=builder /opt/docker-registry-ui /opt/
COPY --from=builder /opt/registry-ui /opt/

USER nobody
ENTRYPOINT ["/opt/docker-registry-ui"]
ENTRYPOINT ["/opt/registry-ui"]
19 changes: 13 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
IMAGE=quiq/docker-registry-ui
IMAGE=quiq/registry-ui
VERSION=`sed -n '/version/ s/.* = //;s/"//g p' version.go`
NOCACHE=--no-cache

.DEFAULT: buildx
.DEFAULT_GOAL := dummy

buildx:
@docker build -t ${IMAGE}:${VERSION} .
dummy:
@echo "Nothing to do here."

publish:
@docker buildx build --platform linux/amd64,linux/arm64 -t ${IMAGE}:${VERSION} -t ${IMAGE}:latest --push .
build:
docker build ${NOCACHE} -t ${IMAGE}:${VERSION} .

public:
docker buildx build ${NOCACHE} --platform linux/amd64,linux/arm64 -t ${IMAGE}:${VERSION} -t ${IMAGE}:latest --push .

test:
docker buildx build ${NOCACHE} --platform linux/amd64 -t docker.quiq.im/registry-ui:test -t docker.quiq.sh/registry-ui:test --push .
81 changes: 31 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,41 @@
## Docker Registry UI
## Registry UI

[![Go Report Card](https://goreportcard.com/badge/github.com/quiq/docker-registry-ui)](https://goreportcard.com/report/github.com/quiq/docker-registry-ui)
[![Go Report Card](https://goreportcard.com/badge/github.com/quiq/registry-ui)](https://goreportcard.com/report/github.com/quiq/registry-ui)

### Overview

* Web UI for Docker Registry
* Browse namespaces, repositories and tags
* Display image details by layers
* Display sub-images of multi-arch or cache type of image
* Support Manifest v2 schema 1, Manifest v2 schema 2, Manifest List v2 schema 2 and their confusing combinations
* Fast and small, written on Go
* Automatically discover an authentication method (basic auth, token service etc.)
* Caching the list of repositories, tag counts and refreshing in background
* Event listener of notification events coming from Registry
* Store events in sqlite or MySQL database
* CLI option to maintain the tags retention: purge tags older than X days keeping at least Y tags

No TLS or authentication implemented on the UI web server itself.
Assuming you will proxy it behind nginx, oauth2_proxy or something.

Docker images [quiq/docker-registry-ui](https://hub.docker.com/r/quiq/docker-registry-ui/tags/)
* Web UI for Docker Registry or similar alternatives
* Fast, simple and small package
* Browse catalog of repositories and tags
* Show an arbitrary level of repository tree
* Support Docker and OCI image formats
* Support image and image index manifests (multi-platform images)
* Display full information about image index and links to the underlying sub-images
* Display full information about image, its layers and config file (command history)
* Event listener for notification events coming from Registry
* Store events in Sqlite or MySQL database
* CLI option to maintain the tag retention: purge tags older than X days keeping at least Y tags etc.
* Automatically discover an authentication method: basic auth, token service, keychain etc.
* The list of repositories and tag counts are cached and refreshed in background

No TLS or authentication is implemented on the UI instance itself.
Assuming you will put it behind nginx, oauth2_proxy or similar.

Docker images [quiq/registry-ui](https://hub.docker.com/r/quiq/registry-ui/tags/)

### Configuration

The configuration is stored in `config.yml` and the options are self-descriptive.

### Run UI

docker run -d -p 8000:8000 -v /local/config.yml:/opt/config.yml:ro \
--name=registry-ui quiq/docker-registry-ui
docker run -d -p 8000:8000 -v /local/config.yml:/opt/config.yml:ro quiq/registry-ui

To run with your own root CA certificate, add to the command:

-v /local/rootcacerts.crt:/etc/ssl/certs/ca-certificates.crt:ro

To preserve sqlite db file with event notifications data, add to the command:
To preserve sqlite db file with event data, add to the command:

-v /local/data:/opt/data

Expand All @@ -53,8 +54,8 @@ To receive events you need to configure Registry as follow:

notifications:
endpoints:
- name: docker-registry-ui
url: http://docker-registry-ui.local:8000/api/events
- name: registry-ui
url: http://registry-ui.local:8000/event-receiver
headers:
Authorization: [Bearer abcdefghijklmnopqrstuvwxyz1234567890]
timeout: 1s
Expand All @@ -64,7 +65,7 @@ To receive events you need to configure Registry as follow:
- application/octet-stream

Adjust url and token as appropriate.
If you are running UI from non-root base path, e.g. /ui, the URL path for above will be `/ui/api/events`.
If you are running UI with non-default base path, e.g. /ui, the URL path for above will be `/ui/event-receiver` etc.

## Using MySQL instead of sqlite3 for event listener

Expand Down Expand Up @@ -94,46 +95,26 @@ To delete tags you need to enable the corresponding option in Docker Registry co
The following example shows how to run a cron task to purge tags older than X days but also keep
at least Y tags no matter how old. Assuming container has been already running.

10 3 * * * root docker exec -t registry-ui /opt/docker-registry-ui -purge-tags
10 3 * * * root docker exec -t registry-ui /opt/registry-ui -purge-tags

You can try to run in dry-run mode first to see what is going to be purged:

docker exec -t registry-ui /opt/docker-registry-ui -purge-tags -dry-run

Alternatively, you can schedule the purging task with built-in cron feature:

purge_tags_schedule: '0 10 3 * * *'

Note, the cron schedule format includes seconds! See https://godoc.org/github.com/robfig/cron

### Debug mode

To increase http request verbosity, run container with `-e GOREQUEST_DEBUG=1`.

### About Docker image formats...

Docker image formats and their confusing combinations as supported by this UI:

* Manifest v2 schema 1 only: older format, e.g. created with Docker 1.9.
* Manifest v2 schema 1 + Manifest v2 schema 2: current format of a single image, the image history are coming from schema 1, should be referenced by repo:tag name.
* Manifest v2 schema 1 + Manifest List v2 schema 2: multi-arch image format containing digests of sub-images, the image history are coming from schema 1 (no idea from what sub-image it was picked up when created), should be referenced by repo:tag name.
* Manifest v2 schema 2: current image format referenced by its digest sha256, no image history.
* Manifest List v2 schema 2: multi-arch image referenced by its digest sha256 or cache image referenced by tag name, no image history.
docker exec -t registry-ui /opt/registry-ui -purge-tags -dry-run

### Screenshots

Repository list / home page:
Repository list:

![image](screenshots/1.png)

Repository tag list:
Tag list:

![image](screenshots/2.png)

Tag info page:
Image Index info:

![image](screenshots/3.png)

Event log page:
Image info:

![image](screenshots/4.png)
83 changes: 0 additions & 83 deletions config.go

This file was deleted.

Loading

0 comments on commit e334d4c

Please sign in to comment.