[gentoo-commits] repo/gentoo:master commit in: app-emulation/docker-registry/, app-emulation/docker-registry/files/

2018-12-14 Thread Manuel Rüger
commit: 4f6a9e4e9b4b483cfdfc3dcf42ea1c45e5f366f0
Author: Manuel Rüger  gentoo  org>
AuthorDate: Fri Dec 14 16:48:40 2018 +
Commit: Manuel Rüger  gentoo  org>
CommitDate: Fri Dec 14 16:48:40 2018 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4f6a9e4e

app-emulation/docker-registry: Apply patch to provide more notification metrics

Signed-off-by: Manuel Rüger  gentoo.org>
Package-Manager: Portage-2.3.52, Repoman-2.3.11

 .../docker-registry-2.7.0-r1.ebuild|  47 +++
 ...ocker-registry-2.7.0-notification-metrics.patch | 398 +
 2 files changed, 445 insertions(+)

diff --git a/app-emulation/docker-registry/docker-registry-2.7.0-r1.ebuild 
b/app-emulation/docker-registry/docker-registry-2.7.0-r1.ebuild
new file mode 100644
index 000..7f36e363292
--- /dev/null
+++ b/app-emulation/docker-registry/docker-registry-2.7.0-r1.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit golang-vcs-snapshot systemd user
+
+KEYWORDS="~amd64"
+EGO_PN="github.com/docker/distribution"
+EGIT_COMMIT="v${PV}"
+SRC_URI="https://${EGO_PN}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"
+DESCRIPTION="Docker Registry 2.0"
+HOMEPAGE="https://github.com/docker/distribution;
+LICENSE="Apache-2.0"
+SLOT="0"
+IUSE=""
+SVCNAME=registry
+
+pkg_setup() {
+   enewgroup ${SVCNAME}
+   enewuser ${SVCNAME} -1 -1 /dev/null ${SVCNAME}
+}
+
+src_prepare() {
+   default
+   pushd src/${EGO_PN} || die
+   eapply "${FILESDIR}"/${P}-notification-metrics.patch
+   popd || die
+}
+
+src_compile() {
+   GOPATH="${S}" \
+   go install -v -work -x ${EGO_BUILD_FLAGS} "${EGO_PN}/..." || die
+}
+
+src_install() {
+   exeinto /usr/libexec/${PN}
+   doexe bin/*
+   insinto /etc/docker/registry
+   newins src/${EGO_PN}/cmd/registry/config-example.yml config.yml.example
+   newinitd "${FILESDIR}/${SVCNAME}.initd" "${SVCNAME}"
+   newconfd "${FILESDIR}/${SVCNAME}.confd" "${SVCNAME}"
+   systemd_dounit "${FILESDIR}/${SVCNAME}.service"
+   keepdir /var/{lib,log}/${SVCNAME}
+   fowners ${SVCNAME}:${SVCNAME} /var/{lib,log}/${SVCNAME}
+   insinto /etc/logrotate.d
+   newins "${FILESDIR}/${SVCNAME}.logrotated" "${SVCNAME}"
+}

diff --git 
a/app-emulation/docker-registry/files/docker-registry-2.7.0-notification-metrics.patch
 
b/app-emulation/docker-registry/files/docker-registry-2.7.0-notification-metrics.patch
new file mode 100644
index 000..8adf364ce16
--- /dev/null
+++ 
b/app-emulation/docker-registry/files/docker-registry-2.7.0-notification-metrics.patch
@@ -0,0 +1,398 @@
+From 7b2292ee20c5d49053cc5262dfbc99ce121b9b74 Mon Sep 17 00:00:00 2001
+From: tifayuki 
+Date: Tue, 13 Feb 2018 13:30:56 -0800
+Subject: [PATCH 1/4] Add notification metrics
+
+It adds notification related prometheus metrics, including:
+  - total count for events/success/failure/error
+  - total count for notification per each status code
+  - gauge of the pending notification queue
+
+Signed-off-by: tifayuki 
+---
+ metrics/prometheus.go|  3 +++
+ notifications/metrics.go | 28 
+ 2 files changed, 31 insertions(+)
+
+diff --git a/metrics/prometheus.go b/metrics/prometheus.go
+index b5a532144..91b32b23d 100644
+--- a/metrics/prometheus.go
 b/metrics/prometheus.go
+@@ -10,4 +10,7 @@ const (
+ var (
+   // StorageNamespace is the prometheus namespace of blob/cache related 
operations
+   StorageNamespace = metrics.NewNamespace(NamespacePrefix, "storage", nil)
++
++  // NotificationsNamespace is the prometheus namespace of notification 
related metrics
++  NotificationsNamespace = metrics.NewNamespace(NamespacePrefix, 
"notifications", nil)
+ )
+diff --git a/notifications/metrics.go b/notifications/metrics.go
+index a20af1687..69960e9cb 100644
+--- a/notifications/metrics.go
 b/notifications/metrics.go
+@@ -5,6 +5,18 @@ import (
+   "fmt"
+   "net/http"
+   "sync"
++
++  prometheus "github.com/docker/distribution/metrics"
++  "github.com/docker/go-metrics"
++)
++
++var (
++  // eventsCounter counts total events of incoming, success, failure, and 
errors
++  eventsCounter = 
prometheus.NotificationsNamespace.NewLabeledCounter("events", "The number of 
total events", "type")
++  // pendingGauge measures the pending queue size
++  pendingGauge = prometheus.NotificationsNamespace.NewGauge("pending", 
"The gauge of pending events in queue", metrics.Total)
++  // statusCounter counts the total notification call per each status code
++  statusCounter = 
prometheus.NotificationsNamespace.NewLabeledCounter("status", "The number of 
status code", "code")
+ )
+ 
+ // EndpointMetrics track various actions taken by the endpoint, typically by
+@@ -61,6 +73,9 @@ func (emsl *endpointMetricsHTTPStatusListener) 
success(status int, events ...Eve
+   defer 

[gentoo-commits] repo/gentoo:master commit in: app-emulation/docker-registry/, app-emulation/docker-registry/files/

2017-09-01 Thread Zac Medico
commit: 0eea13ca58aba2306a979fdc0bd307bccedbfe60
Author: Zac Medico  gentoo  org>
AuthorDate: Fri Sep  1 22:09:01 2017 +
Commit: Zac Medico  gentoo  org>
CommitDate: Fri Sep  1 22:13:24 2017 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0eea13ca

app-emulation/docker-registry: revbump to 2.6.2-r1 for bug 629202

Package-Manager: Portage-2.3.8, Repoman-2.3.2

 ...y-2.6.2.ebuild => docker-registry-2.6.2-r1.ebuild} |  0
 app-emulation/docker-registry/files/registry.initd| 19 +++
 2 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/app-emulation/docker-registry/docker-registry-2.6.2.ebuild 
b/app-emulation/docker-registry/docker-registry-2.6.2-r1.ebuild
similarity index 100%
rename from app-emulation/docker-registry/docker-registry-2.6.2.ebuild
rename to app-emulation/docker-registry/docker-registry-2.6.2-r1.ebuild

diff --git a/app-emulation/docker-registry/files/registry.initd 
b/app-emulation/docker-registry/files/registry.initd
index 43637a9dbe8..b81303c624d 100644
--- a/app-emulation/docker-registry/files/registry.initd
+++ b/app-emulation/docker-registry/files/registry.initd
@@ -1,24 +1,19 @@
 #!/sbin/openrc-run
-# Copyright 2016 Gentoo Foundation
+# Copyright 2016-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 description="Docker Registry 2.0"
-pidfile=${pidfile:-"/run/${SVCNAME}/${SVCNAME}.pid"}
-user=${user:-${SVCNAME}}
-group=${group:-${SVCNAME}}
+pidfile=${pidfile:-"/run/${RC_SVCNAME}.pid"}
+user=${user:-${RC_SVCNAME}}
+group=${group:-${RC_SVCNAME}}
 
-command="/usr/libexec/docker-${SVCNAME}/${SVCNAME}"
+command="/usr/libexec/docker-${RC_SVCNAME}/${RC_SVCNAME}"
 command_args="${command_args:-serve /etc/docker/registry/config.yml}"
 command_background="true"
 start_stop_daemon_args="--user ${user} --group ${group} \
-   --stdout /var/log/${SVCNAME}/${SVCNAME}.log \
-   --stderr /var/log/${SVCNAME}/${SVCNAME}.log"
+   --stdout /var/log/${RC_SVCNAME}/${RC_SVCNAME}.log \
+   --stderr /var/log/${RC_SVCNAME}/${RC_SVCNAME}.log"
 
 depend() {
need net
-   after net
-}
-
-start_pre() {
-   checkpath -d -m 0755 -o "${user}":"${group}" "${pidfile%/*}"
 }



[gentoo-commits] repo/gentoo:master commit in: app-emulation/docker-registry/, app-emulation/docker-registry/files/

2017-05-19 Thread Manuel Rüger
commit: 21eba0700591adc9435adc2b75bbdbf98915
Author: Manuel Rüger  gentoo  org>
AuthorDate: Fri May 19 14:47:59 2017 +
Commit: Manuel Rüger  gentoo  org>
CommitDate: Fri May 19 14:47:59 2017 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=21eba070

app-emulation/docker-registry: Include patch to fix json in notifications 
endpoint

Package-Manager: Portage-2.3.5, Repoman-2.3.2

 .../docker-registry-2.6.1-r1.ebuild| 42 ++
 ...ocker-registry-2.6.1-notifications-expvar.patch | 64 ++
 2 files changed, 106 insertions(+)

diff --git a/app-emulation/docker-registry/docker-registry-2.6.1-r1.ebuild 
b/app-emulation/docker-registry/docker-registry-2.6.1-r1.ebuild
new file mode 100644
index 000..45aac739ef0
--- /dev/null
+++ b/app-emulation/docker-registry/docker-registry-2.6.1-r1.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit golang-vcs-snapshot systemd user
+
+KEYWORDS="~amd64"
+EGO_PN="github.com/docker/distribution/..."
+EGIT_COMMIT="v${PV}"
+SRC_URI="https://${EGO_PN%/*}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"
+DESCRIPTION="Docker Registry 2.0"
+HOMEPAGE="https://github.com/docker/distribution;
+LICENSE="Apache-2.0"
+SLOT="0"
+IUSE=""
+SVCNAME=registry
+
+PATCHES=( "${FILESDIR}/${P}-notifications-expvar.patch" )
+
+pkg_setup() {
+   enewgroup ${SVCNAME}
+   enewuser ${SVCNAME} -1 -1 /dev/null ${SVCNAME}
+}
+
+src_compile() {
+   GOPATH="${S}" \
+   go install -v -work -x ${EGO_BUILD_FLAGS} "${EGO_PN}" || die
+}
+
+src_install() {
+   exeinto /usr/libexec/${PN}
+   doexe bin/*
+   insinto /etc/docker/registry
+   newins src/${EGO_PN%/*}/cmd/registry/config-example.yml 
config.yml.example
+   newinitd "${FILESDIR}/${SVCNAME}.initd" "${SVCNAME}"
+   newconfd "${FILESDIR}/${SVCNAME}.confd" "${SVCNAME}"
+   systemd_dounit "${FILESDIR}/${SVCNAME}.service"
+   keepdir /var/{lib,log}/${SVCNAME}
+   fowners ${SVCNAME}:${SVCNAME} /var/{lib,log}/${SVCNAME}
+   insinto /etc/logrotate.d
+   newins "${FILESDIR}/${SVCNAME}.logrotated" "${SVCNAME}"
+}

diff --git 
a/app-emulation/docker-registry/files/docker-registry-2.6.1-notifications-expvar.patch
 
b/app-emulation/docker-registry/files/docker-registry-2.6.1-notifications-expvar.patch
new file mode 100644
index 000..1d40edf1f0c
--- /dev/null
+++ 
b/app-emulation/docker-registry/files/docker-registry-2.6.1-notifications-expvar.patch
@@ -0,0 +1,64 @@
+From 9a58c91051e03b46f1461e371a7bf527c1284612 Mon Sep 17 00:00:00 2001
+From: Noah Treuhaft 
+Date: Wed, 8 Feb 2017 11:38:44 -0800
+Subject: [PATCH] notifications: fix expvar for Go 1.7
+
+Remove EndpointConfig.Transport from the return value of the
+registry.notifications.endpoints expvar.Func.  It results in an empty
+value for that expvar variable under Go 1.7 because it is a non-nil
+*http.Transport, which Go 1.7 can no longer encode as JSON.
+
+Signed-off-by: Noah Treuhaft 
+---
+ notifications/endpoint.go |  2 +-
+ notifications/metrics_test.go | 28 
+ 2 files changed, 29 insertions(+), 1 deletion(-)
+ create mode 100644 notifications/metrics_test.go
+
+diff --git a/src/github.com/docker/distribution/notifications/endpoint.go 
b/src/github.com/docker/distribution/notifications/endpoint.go
+index 29a9e27b5..44d0f6d7b 100644
+--- a/src/github.com/docker/distribution/notifications/endpoint.go
 b/src/github.com/docker/distribution/notifications/endpoint.go
+@@ -13,7 +13,7 @@ type EndpointConfig struct {
+   Threshold int
+   Backoff   time.Duration
+   IgnoredMediaTypes []string
+-  Transport *http.Transport
++  Transport *http.Transport `json:"-"`
+ }
+ 
+ // defaults set any zero-valued fields to a reasonable default.
+diff --git a/src/github.com/docker/distribution/notifications/metrics_test.go 
b/src/github.com/docker/distribution/notifications/metrics_test.go
+new file mode 100644
+index 0..03a08e2c8
+--- /dev/null
 b/notifications/metrics_test.go
+@@ -0,0 +1,28 @@
++package notifications
++
++import (
++  "encoding/json"
++  "expvar"
++  "testing"
++)
++
++func TestMetricsExpvar(t *testing.T) {
++  endpointsVar := 
expvar.Get("registry").(*expvar.Map).Get("notifications").(*expvar.Map).Get("endpoints")
++
++  var v interface{}
++  if err := json.Unmarshal([]byte(endpointsVar.String()), ); err != nil 
{
++  t.Fatalf("unexpected error unmarshaling endpoints: %v", err)
++  }
++  if v != nil {
++  t.Fatalf("expected nil, got %#v", v)
++  }
++
++  NewEndpoint("x", "y", EndpointConfig{})
++
++  if err := json.Unmarshal([]byte(endpointsVar.String()), ); err != nil 
{
++  t.Fatalf("unexpected error unmarshaling endpoints: 

[gentoo-commits] repo/gentoo:master commit in: app-emulation/docker-registry/, app-emulation/docker-registry/files/

2016-04-25 Thread Zac Medico
commit: 21508b9a287a302d48439353674fb2face00b464
Author: Zac Medico  gentoo  org>
AuthorDate: Mon Apr 25 09:04:15 2016 +
Commit: Zac Medico  gentoo  org>
CommitDate: Mon Apr 25 09:05:30 2016 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=21508b9a

app-emulation/docker-registry: use config.yml example from tarball

Package-Manager: portage-2.2.28

 .../docker-registry/docker-registry-2.4.0.ebuild   |  2 +-
 app-emulation/docker-registry/files/config.yml | 18 --
 2 files changed, 1 insertion(+), 19 deletions(-)

diff --git a/app-emulation/docker-registry/docker-registry-2.4.0.ebuild 
b/app-emulation/docker-registry/docker-registry-2.4.0.ebuild
index 08c7199..c5b0e84 100644
--- a/app-emulation/docker-registry/docker-registry-2.4.0.ebuild
+++ b/app-emulation/docker-registry/docker-registry-2.4.0.ebuild
@@ -32,7 +32,7 @@ src_install() {
exeinto /usr/libexec/${PN}
doexe "${S}"/bin/*
insinto /etc/docker/registry
-   newins "${FILESDIR}/config.yml" config.yml.example
+   newins "${S}"/src/${EGO_PN%/*}/cmd/registry/config-example.yml 
config.yml.example
newinitd "${FILESDIR}/${SVCNAME}.initd" "${SVCNAME}"
newconfd "${FILESDIR}/${SVCNAME}.confd" "${SVCNAME}"
systemd_dounit "${FILESDIR}/${SVCNAME}.service"

diff --git a/app-emulation/docker-registry/files/config.yml 
b/app-emulation/docker-registry/files/config.yml
deleted file mode 100644
index b5700e1..000
--- a/app-emulation/docker-registry/files/config.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-version: 0.1
-log:
-  fields:
-service: registry
-storage:
-cache:
-blobdescriptor: inmemory
-filesystem:
-rootdirectory: /var/lib/registry
-http:
-addr: :5000
-headers:
-X-Content-Type-Options: [nosniff]
-health:
-  storagedriver:
-enabled: true
-interval: 10s
-threshold: 3