diff options
| author | Matthias Fechner <mfechner@FreeBSD.org> | 2026-05-24 16:02:03 +0000 |
|---|---|---|
| committer | Matthias Fechner <mfechner@FreeBSD.org> | 2026-05-24 16:03:02 +0000 |
| commit | 06e942f62c23237628c5107c129f4ec364e50e74 (patch) | |
| tree | 05e0f01f58faa79671013aa7fcf6724db79d92f1 | |
| parent | 150861618eb5db4efe6b848d2332f78cb8718232 (diff) | |
sysutils/gitlab-registry: new port
store OCI containers with gitlab metadata and is fully integrated into gitlab.
| -rw-r--r-- | sysutils/Makefile | 1 | ||||
| -rw-r--r-- | sysutils/gitlab-registry/Makefile | 47 | ||||
| -rw-r--r-- | sysutils/gitlab-registry/distinfo | 5 | ||||
| -rw-r--r-- | sysutils/gitlab-registry/files/gitlab_registry.in | 52 | ||||
| -rw-r--r-- | sysutils/gitlab-registry/files/patch-config_filesystem.yml | 22 | ||||
| -rw-r--r-- | sysutils/gitlab-registry/files/pkg-message.in | 18 | ||||
| -rw-r--r-- | sysutils/gitlab-registry/pkg-descr | 12 |
7 files changed, 157 insertions, 0 deletions
diff --git a/sysutils/Makefile b/sysutils/Makefile index cb3a857c8e0d..cf99d8f9f756 100644 --- a/sysutils/Makefile +++ b/sysutils/Makefile @@ -457,6 +457,7 @@ SUBDIR += getssl SUBDIR += gh-md-toc SUBDIR += gigolo + SUBDIR += gitlab-registry SUBDIR += gitwatch SUBDIR += gkfreq SUBDIR += gkleds2 diff --git a/sysutils/gitlab-registry/Makefile b/sysutils/gitlab-registry/Makefile new file mode 100644 index 000000000000..31227eada8a8 --- /dev/null +++ b/sysutils/gitlab-registry/Makefile @@ -0,0 +1,47 @@ +PORTNAME= gitlab-registry +PORTVERSION= 4.40.1 +DISTVERSIONPREFIX= v +DISTVERSIONSUFFIX= -gitlab +CATEGORIES= sysutils + +MAINTAINER= mfechner@FreeBSD.org +COMMENT= GitLab Container Registry fork with optimized metadata handling +WWW= https://gitlab.com/gitlab-org/container-registry + +LICENSE= APACHE20 +LICENSE_FILE= ${WRKSRC}/LICENSE + +USES= gmake go:modules,no_targets + +USE_GITLAB= yes +GL_ACCOUNT= gitlab-org +GL_PROJECT= container-registry + +GO_MOD_DIST= gitlab +GO_MODULE= github.com/docker/distribution +#GO_BUILDFLAGS= -buildmode=pie + +SUB_FILES= pkg-message + +USE_RC_SUBR= gitlab_registry + +USERS= git +GROUPS= git + +PLIST_FILES= bin/registry \ + "@sample ${ETCDIR}/config.yml.sample" \ + "${ETCDIR}/filesystem.yml.sample" \ + "${ETCDIR}/database-filesystem.yml.sample" + +post-patch: + ${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|" ${WRKSRC}/config/filesystem.yml + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/bin/registry ${STAGEDIR}${PREFIX}/bin + + ${MKDIR} ${STAGEDIR}${ETCDIR} + ${INSTALL_DATA} ${WRKSRC}/config/filesystem.yml ${STAGEDIR}${PREFIX}/etc/gitlab-registry/config.yml.sample + ${INSTALL_DATA} ${WRKSRC}/config/filesystem.yml ${STAGEDIR}${PREFIX}/etc/gitlab-registry/filesystem.yml.sample + ${INSTALL_DATA} ${WRKSRC}/config/database-filesystem.yml ${STAGEDIR}${PREFIX}/etc/gitlab-registry/database-filesystem.yml.sample + +.include <bsd.port.mk> diff --git a/sysutils/gitlab-registry/distinfo b/sysutils/gitlab-registry/distinfo new file mode 100644 index 000000000000..c0efa5a9c930 --- /dev/null +++ b/sysutils/gitlab-registry/distinfo @@ -0,0 +1,5 @@ +TIMESTAMP = 1779625520 +SHA256 (go/sysutils_gitlab-registry/container-registry-v4.40.1-gitlab/go.mod) = 49643f6575cd509ebf7ee5f092c5f9906030fa3b166b48d143fbc8c66a7954cb +SIZE (go/sysutils_gitlab-registry/container-registry-v4.40.1-gitlab/go.mod) = 10786 +SHA256 (go/sysutils_gitlab-registry/container-registry-v4.40.1-gitlab/container-registry-v4.40.1-gitlab.tar.bz2) = 7f3acd6c7c393531346680f7a1da5f45d41e9208a9492c49f2f8dca09cec6439 +SIZE (go/sysutils_gitlab-registry/container-registry-v4.40.1-gitlab/container-registry-v4.40.1-gitlab.tar.bz2) = 13885578 diff --git a/sysutils/gitlab-registry/files/gitlab_registry.in b/sysutils/gitlab-registry/files/gitlab_registry.in new file mode 100644 index 000000000000..99c52740b810 --- /dev/null +++ b/sysutils/gitlab-registry/files/gitlab_registry.in @@ -0,0 +1,52 @@ +#!/bin/sh + +# PROVIDE: gitlab_registry +# REQUIRE: LOGIN +# KEYWORD: shutdown + +. /etc/rc.subr + +name="gitlab_registry" +rcvar="gitlab_registry_enable" + +load_rc_config $name + +: ${gitlab_registry_enable:="NO"} +: ${gitlab_registry_user:="git"} +: ${gitlab_registry_group:="git"} +: ${gitlab_registry_command:="%%PREFIX%%/bin/registry"} +: ${gitlab_registry_config:="%%PREFIX%%/etc/gitlab-registry/config.yml"} + +logfile="/var/log/${name}.log" +pidfile="/var/run/${name}/${name}.pid" + +command="/usr/sbin/daemon" +# -r = restart on exit +# -f = stay in foreground (rc handles it) +# -P = write pidfile +# -u = run as user +# -o = log output +command_args="-H -r -f -o ${logfile} -P ${pidfile} -t ${name} \ + /bin/sh -c '${gitlab_registry_command} serve ${gitlab_registry_config}'" + +start_precmd="${name}_precmd" +start_cmd="${name}_start" + +gitlab_registry_precmd() { + echo "Preparing ${name} environment..." + + # Create required directories + install -d -o ${gitlab_registry_user} -g ${gitlab_registry_group} /var/run/${name} + + # Ensure log file exists and is writeable + touch ${logfile} + chown ${gitlab_registry_user}:${gitlab_registry_group} ${logfile} +} + +gitlab_registry_start() { + echo "Starting ${name}" + su -m ${gitlab_registry_user} -c "${command} ${command_args}" +} + +run_rc_command "$1" + diff --git a/sysutils/gitlab-registry/files/patch-config_filesystem.yml b/sysutils/gitlab-registry/files/patch-config_filesystem.yml new file mode 100644 index 000000000000..068334863a0a --- /dev/null +++ b/sysutils/gitlab-registry/files/patch-config_filesystem.yml @@ -0,0 +1,22 @@ +--- config/filesystem.yml.orig 2026-05-22 19:07:54 UTC ++++ config/filesystem.yml +@@ -18,7 +18,7 @@ storage: + # Temp dir, rename if you need persistence. + # registry/storage/paths.go describes the structure of the data + # written to this directory +- rootdirectory: "/tmp/registry" ++ rootdirectory: "%%PREFIX%%/www/gitlab/shared/registry" + http: + # Registry API will be accessible at localhost:5000 + addr: :5000 +@@ -31,3 +31,10 @@ http: + # Profiling information will be accessible at localhost:5001/debug/pprof/ + pprof: + enabled: true ++auth: ++ token: ++ realm: https://<gitlab_url>/jwt/auth ++ service: container_registry ++ issuer: gitlab-issuer ++ rootcertbundle: %%PREFIX%%/www/gitlab/config/registry.crt ++ diff --git a/sysutils/gitlab-registry/files/pkg-message.in b/sysutils/gitlab-registry/files/pkg-message.in new file mode 100644 index 000000000000..36f56d3d5388 --- /dev/null +++ b/sysutils/gitlab-registry/files/pkg-message.in @@ -0,0 +1,18 @@ +[ +{ + message: <<EOM +=========================================================================== +gitlab-registry has been successfully installed. + +1. edit %%PREFIX%%/etc/gitlab-registry/config.yml and define in realm + your gitlab domain + +2. Enable and start the service: + sysrc gitlab_registry_enable="YES" + service gitlab_registry start +=========================================================================== +EOM + type: install +} +] + diff --git a/sysutils/gitlab-registry/pkg-descr b/sysutils/gitlab-registry/pkg-descr new file mode 100644 index 000000000000..ada363553b6c --- /dev/null +++ b/sysutils/gitlab-registry/pkg-descr @@ -0,0 +1,12 @@ +The GitLab Container Registry originated as a fork of the Docker Distribution +Registry, now CNCF Distribution, both distributed under Apache License +Version 2.0. + +The first GitLab change on top of the upstream implementation was efe421fd, and +since then we have diverged enough to the point where we decided to detach from +upstream and proceed on our own path. + +Since then, we have implemented and released several major performance +improvements and bug fixes. For a list of changes, please see differences from +upstream. These changes culminated on a new architecture based on a relational +metadata database and the original goal, enabling online garbage collection. |
