[packages/gitlab-workhorse] configurable listen options

glen glen at pld-linux.org
Thu Nov 3 22:35:32 CET 2016


commit 6d2a4500e545efe8c6235a387fe2ea22315aefc5
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Thu Nov 3 23:34:47 2016 +0200

    configurable listen options

 gitlab-workhorse.init      |  5 +----
 gitlab-workhorse.service   |  6 ++----
 gitlab-workhorse.spec      |  7 +++++--
 gitlab-workhorse.sysconfig | 11 +++++++++++
 4 files changed, 19 insertions(+), 10 deletions(-)
---
diff --git a/gitlab-workhorse.spec b/gitlab-workhorse.spec
index dae10fc..2ca22de 100644
--- a/gitlab-workhorse.spec
+++ b/gitlab-workhorse.spec
@@ -8,6 +8,7 @@ Source0:	https://gitlab.com/gitlab-org/gitlab-workhorse/repository/archive.tar.g
 # Source0-md5:	983d07b5c6f277dac7bc652d002f938b
 Source1:	%{name}.service
 Source2:	%{name}.init
+Source3:	%{name}.sysconfig
 URL:		https://gitlab.com/gitlab-org/gitlab-workhorse
 BuildRequires:	git-core
 BuildRequires:	golang >= 1.5
@@ -42,11 +43,12 @@ grep "$version" v
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_sbindir},%{systemdunitdir},/etc/rc.d/init.d}
+install -d $RPM_BUILD_ROOT{%{_sbindir},%{systemdunitdir},/etc/{rc.d/init.d,sysconfig}}
 
 install -p %{name} $RPM_BUILD_ROOT%{_sbindir}/%{name}
 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
-cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -69,6 +71,7 @@ fi
 %files
 %defattr(644,root,root,755)
 %doc CHANGELOG README.md LICENSE
+%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
 %attr(754,root,root) /etc/rc.d/init.d/%{name}
 %attr(755,root,root) %{_sbindir}/%{name}
 %{systemdunitdir}/%{name}.service
diff --git a/gitlab-workhorse.init b/gitlab-workhorse.init
index 438e253..d9e0826 100755
--- a/gitlab-workhorse.init
+++ b/gitlab-workhorse.init
@@ -49,10 +49,7 @@ start() {
 	# http://lists.pld-linux.org/mailman/pipermail/pld-devel-en/2016-September/025111.html
 	RC_LOGGING=no
 	daemon --pidfile $pidfile --user $USER --makepid --chdir "$APP_PATH" --redirfds --fork \
-		/usr/sbin/gitlab-workhorse -listenUmask 0 \
-			-authBackend http://localhost:8080 -authSocket /var/run/gitlab/gitlab.socket \
-			-documentRoot /usr/lib/gitlab/public \
-			-listenNetwork unix -listenAddr /var/run/gitlab/gitlab-workhorse.socket
+		/usr/sbin/gitlab-workhorse $OPTIONS $LISTEN_OPTIONS
 	RETVAL=$?
 	[ $RETVAL -eq 0 ] && touch $lockfile
 }
diff --git a/gitlab-workhorse.service b/gitlab-workhorse.service
index f8fa4ac..3c9ad98 100644
--- a/gitlab-workhorse.service
+++ b/gitlab-workhorse.service
@@ -8,10 +8,8 @@ Type=simple
 User=git
 Group=git
 WorkingDirectory=/usr/lib/gitlab
-# listen on unix socket (nginx)
-ExecStart=/usr/sbin/gitlab-workhorse -listenUmask 0 -authBackend http://localhost:8080 -authSocket /var/run/gitlab/gitlab.socket -documentRoot /usr/lib/gitlab/public -listenNetwork unix -listenAddr /var/run/gitlab/gitlab-workhorse.socket
-# listen on tcp port (apache)
-#ExecStart=/usr/sbin/gitlab-workhorse -listenUmask 0 -authBackend http://localhost:8080 -authSocket /var/run/gitlab/gitlab.socket -documentRoot /usr/lib/gitlab/public -listenNetwork tcp  -listenAddr 0.0.0.0:8181
+EnvironmentFile=/etc/sysconfig/gitlab-workhorse
+ExecStart=/usr/sbin/gitlab-workhorse $OPTIONS $LISTEN_OPTIONS
 Restart=on-failure
 
 [Install]
diff --git a/gitlab-workhorse.sysconfig b/gitlab-workhorse.sysconfig
new file mode 100644
index 0000000..f1b0928
--- /dev/null
+++ b/gitlab-workhorse.sysconfig
@@ -0,0 +1,11 @@
+# configuration for gitlab-workhorse
+
+OPTIONS="-listenUmask 0 -authBackend http://localhost:8080 -authSocket /var/run/gitlab/gitlab.socket -documentRoot /usr/lib/gitlab/public"
+
+# Unix socket for Nginx
+# listen on unix socket (nginx)
+LISTEN_OPTIONS="-listenNetwork unix -listenAddr /var/run/gitlab/gitlab-workhorse.socket"
+
+# listen on tcp port (apache)
+# TCP for Apache
+#LISTEN_OPTIONS="-listenNetwork tcp -listenAddr 0.0.0.0:8181"
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/gitlab-workhorse.git/commitdiff/6d2a4500e545efe8c6235a387fe2ea22315aefc5



More information about the pld-cvs-commit mailing list