Elukey has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/325568 )

Change subject: Initial debianization
......................................................................


Initial debianization

Bug: T147316
Change-Id: I14d46a8998ca25f1d376065bb196b8286d3ac4cd
---
A debian/changelog
A debian/compat
A debian/control
A debian/copyright
A debian/default
A debian/dirs
A debian/docs
A debian/gdb.conf
A debian/init
A debian/postinst
A debian/postrm
A debian/rules
A debian/service
A debian/watch
14 files changed, 208 insertions(+), 0 deletions(-)

Approvals:
  Elukey: Verified; Looks good to me, approved
  Filippo Giunchedi: Looks good to me, but someone else must approve



diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..a80c7ce
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+prometheus-apache-exporter (0.3-1) jessie-wikimedia; urgency=low
+
+  * Initial Release, packaged the 0.3 upstream version.
+
+ -- Luca Toscano <ltosc...@wikimedia.org>  Thu, 03 Nov 2016 15:13:55 +0100
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..0b20b9c
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,16 @@
+Source: prometheus-apache-exporter
+Section: net
+Priority: extra
+Maintainer: Luca Toscano <ltosc...@wikimedia.org>
+Build-Depends: debhelper (>= 9),
+               dh-golang,
+               dh-systemd (>= 1.5),
+               golang-go,
+               golang-github-prometheus-client-golang-dev
+Standards-Version: 3.9.8
+Homepage: https://github.com/neezgee/apache_exporter
+
+Package: prometheus-apache-exporter
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Exports apache mod_status statistics via HTTP for Prometheus 
consumption.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..9f4877a
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,27 @@
+Files: *
+Copyright: 2016 neezgee
+License: MIT
+
+Files: debian/*
+Copyright: 2016 Luca Toscano <ltosc...@wikimedia.org>
+License: MIT
+Comment: Debian packaging is licensed under the same terms as upstream
+
+License: MIT
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+ .
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
diff --git a/debian/default b/debian/default
new file mode 100644
index 0000000..406a2eb
--- /dev/null
+++ b/debian/default
@@ -0,0 +1,14 @@
+ARGS=""
+
+# Usage of prometheus-apache-exporter:
+#
+#  -insecure
+#        Ignore server certificate if using https (default false)
+#  -log.level value
+#        Only log messages with the given severity or above. Valid levels: 
[debug, info, warn, error, fatal, panic]. (default info)
+#  -scrape_uri string
+#        URI to apache stub status page (default 
"http://localhost/server-status/?auto";)
+#  -telemetry.address string
+#        Address on which to expose metrics. (default ":9117")
+#  -telemetry.endpoint string
+#        Path under which to expose metrics. (default "/metrics")
diff --git a/debian/dirs b/debian/dirs
new file mode 100644
index 0000000..557ffa1
--- /dev/null
+++ b/debian/dirs
@@ -0,0 +1 @@
+var/log/prometheus
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000..b43bf86
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1 @@
+README.md
diff --git a/debian/gdb.conf b/debian/gdb.conf
new file mode 100644
index 0000000..f692a5d
--- /dev/null
+++ b/debian/gdb.conf
@@ -0,0 +1,2 @@
+[buildpackage]
+upstream-tag=v%(version)s
diff --git a/debian/init b/debian/init
new file mode 100755
index 0000000..0cce939
--- /dev/null
+++ b/debian/init
@@ -0,0 +1,64 @@
+#!/bin/sh
+# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
+if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
+    set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
+fi
+### BEGIN INIT INFO
+# Provides:          prometheus-apache-exporter
+# Required-Start:    $remote_fs $syslog
+# Required-Stop:     $remote_fs $syslog
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Prometheus exporter for Apache httpd
+### END INIT INFO
+
+# Author: Filippo Giunchedi <fili...@debian.org>, Luca Toscano 
<ltosc...@wikimedia.org>
+
+DESC="Prometheus exporter for Apache httpd"
+DAEMON=/usr/bin/prometheus-apache-exporter
+NAME=prometheus-apache-exporter
+USER=prometheus
+PIDFILE=/var/run/prometheus/prometheus-apache-exporter.pid
+LOGFILE=/var/log/prometheus/prometheus-apache-exporter.log
+
+ARGS=""
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+HELPER=/usr/bin/daemon
+HELPER_ARGS="--name=$NAME --output=$LOGFILE --pidfile=$PIDFILE --user=$USER"
+
+do_start_prepare()
+{
+    mkdir -p `dirname $PIDFILE` || true
+    chown -R $USER: `dirname $LOGFILE`
+    chown -R $USER: `dirname $PIDFILE`
+}
+
+do_start_cmd()
+{
+    # Return
+    #   0 if daemon has been started
+    #   1 if daemon was already running
+    #   2 if daemon could not be started
+    $HELPER $HELPER_ARGS --running && return 1
+    $HELPER $HELPER_ARGS -- $DAEMON $ARGS || return 2
+    return 0
+}
+
+do_stop_cmd()
+{
+    # Return
+    #   0 if daemon has been stopped
+    #   1 if daemon was already stopped
+    #   2 if daemon could not be stopped
+    #   other if a failure occurred
+    $HELPER $HELPER_ARGS --running || return 1
+    $HELPER $HELPER_ARGS --stop || return 2
+    # wait for the process to really terminate
+    for n in 1 2 3 4 5; do
+        sleep 1
+        $HELPER $HELPER_ARGS --running || break
+    done
+    $HELPER $HELPER_ARGS --running || return 0
+    return 2
+}
diff --git a/debian/postinst b/debian/postinst
new file mode 100644
index 0000000..ebfa183
--- /dev/null
+++ b/debian/postinst
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+  configure)
+    # Add prometheus user
+    if ! getent passwd prometheus > /dev/null; then
+        adduser --quiet --system --no-create-home \
+            --group --gecos "Prometheus daemon" prometheus || true
+    fi
+
+    chown -R prometheus:prometheus /var/lib/prometheus || true
+    chown -R prometheus:prometheus /var/log/prometheus || true
+
+  ;;
+
+  abort-upgrade|abort-remove|abort-deconfigure)
+    :
+  ;;
+
+  *)
+    echo "postinst called with unknown argument \`$1'" >&2
+    exit 1
+  ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/postrm b/debian/postrm
new file mode 100644
index 0000000..7b7bdfe
--- /dev/null
+++ b/debian/postrm
@@ -0,0 +1,15 @@
+#!/bin/sh
+# postrm script for prometheus-apache-exporter
+# Script executed after the package is removed.
+
+set -e
+
+case "$1" in
+  purge)
+    rm -rf /var/log/prometheus/prometheus-apache-exporter.log \
+      /var/run/prometheus/prometheus-apache-exporter.pid
+  # We do NOT remove the system user.
+  ;;
+esac
+
+#DEBHELPER#
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..cf83a89
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,14 @@
+#!/usr/bin/make -f
+
+DEBPKGNAME ?= $(shell dpkg-parsechangelog | sed -n -e 's/^Source: //p')
+export DH_GOPKG := github.com/neezgee/apache_exporter
+
+%:
+       dh $@ --buildsystem=golang --with=golang,systemd
+
+override_dh_auto_install:
+       dh_auto_install
+       rm -r debian/$(DEBPKGNAME)/usr/share/gocode
+       mv -v debian/$(DEBPKGNAME)/usr/bin/apache_exporter \
+               debian/$(DEBPKGNAME)/usr/bin/prometheus-apache-exporter
+
diff --git a/debian/service b/debian/service
new file mode 100644
index 0000000..5a53be8
--- /dev/null
+++ b/debian/service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Prometheus exporter for Apache httpd
+Documentation=https://prometheus.io/docs/introduction/overview/
+
+[Service]
+Restart=always
+User=prometheus
+EnvironmentFile=/etc/default/prometheus-apache-exporter
+ExecStart=/usr/bin/prometheus-apache-exporter $ARGS
+
+[Install]
+WantedBy=multi-user.target
diff --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..1b4b5ad
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,3 @@
+version=2
+opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/prometheus_apache2_exporter-$1\.tar\.gz/
 \
+  https://github.com/neezgee/apache_exporter/tags .*/v?(\d\S*)\.tar\.gz

-- 
To view, visit https://gerrit.wikimedia.org/r/325568
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I14d46a8998ca25f1d376065bb196b8286d3ac4cd
Gerrit-PatchSet: 2
Gerrit-Project: operations/debs/prometheus-apache-exporter
Gerrit-Branch: master
Gerrit-Owner: Elukey <ltosc...@wikimedia.org>
Gerrit-Reviewer: Elukey <ltosc...@wikimedia.org>
Gerrit-Reviewer: Filippo Giunchedi <fgiunch...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to