Migrate haproxy-config package to Debian

Modified haproxy-config package to add support to Debian packaging.

PASS: built image successfully
PASS: Installed image successfully (with haproxy-config)
PASS: build updated latest image (fresh env)
PASS: bootstrap and unlock successful

Story: 2009256
Task: 44844
Depends-On: https://review.opendev.org/c/starlingx/integ/+/837572

Signed-off-by: Thayna Santos <Thayna.EmillyCavalcanteSantos@windriver.com>
Change-Id: Ie20947bd417d6d83c4aca4c4277019f1bf188f2d
This commit is contained in:
Thayna Santos 2022-03-30 15:55:42 -04:00
parent 99f0674cb2
commit 6f596870cf
13 changed files with 199 additions and 0 deletions

View File

@ -4,6 +4,7 @@ dhcp-config
dnsmasq-config
docker-config
filesystem-scripts
haproxy-config
initscripts-config
lighttpd-config
lvm2-config

View File

@ -0,0 +1,5 @@
haproxy-config (1.0-1) unstable; urgency=medium
* Initial release
-- Thayna Santos <Thayna.EmillyCavalcanteSantos@windriver.com> Fri, 18 Mar 17:09:03 -0300

View File

@ -0,0 +1,15 @@
Source: haproxy-config
Section: admin
Priority: optional
Maintainer: StarlingX Developers <starlingx-discuss@lists.starlingx.io>
Build-Depends: debhelper-compat (= 13)
Standards-Version: 4.5.1
Homepage: https://www.starlingx.io
Package: haproxy-config
Architecture: any
Depends:
${misc:Depends},
haproxy
Description: StarlingX haproxy configuration files
StarlingX configuration files of haproxy to system folder.

View File

@ -0,0 +1,27 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: haproxy-config
Source: https://opendev.org/starlingx/config-files
Files: *
Copyright: (c) 2013-2021 Wind River Systems, Inc
License: Apache-2
Files: debian/*
Copyright: 2021 Wind River Systems, Inc
License: Apache-2
License: Apache-2
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
.
https://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
.
On Debian-based systems the full text of the Apache version 2.0 license
can be found in `/usr/share/common-licenses/Apache-2.0'.

View File

@ -0,0 +1,2 @@
etc/init.d
etc/systemd/system

View File

@ -0,0 +1,3 @@
etc/systemd/system/haproxy.service
etc/init.d/haproxy
systemd/00-haproxy-config.preset etc/systemd/system-preset

View File

@ -0,0 +1,9 @@
#!/bin/sh
set -e
if test -s /etc/logrotate.d/haproxy ; then
echo '#See /etc/logrotate.d/syslog for haproxy rules' > /etc/logrotate.d/haproxy
fi
#DEBHELPER#

View File

@ -0,0 +1,12 @@
#!/usr/bin/make -f
#export DH_VERBOSE = 1
ROOT := $(CURDIR)/debian/tmp
%:
dh $@
override_dh_install:
install -p -D -m 755 haproxy.sh ${ROOT}/etc/init.d/haproxy
install -p -D -m 644 haproxy.service ${ROOT}/etc/systemd/system/haproxy.service
dh_install

View File

@ -0,0 +1 @@
3.0 (quilt)

View File

@ -0,0 +1,7 @@
---
debname: haproxy-config
debver: 1.0-1
src_path: source-debian
revision:
dist: $STX_DIST
PKG_GITREVCOUNT: true

View File

@ -0,0 +1,13 @@
[Unit]
Description=HAProxy Load Balancer
After=syslog.target network.target
[Service]
EnvironmentFile=/etc/default/haproxy
ExecStart=/etc/init.d/haproxy start
ExecStop=/etc/init.d/haproxy stop
ExecReload=/bin/kill -USR2 $MAINPID
KillMode=mixed
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,103 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: HA-Proxy
# Required-Start: networking
# Required-Stop: networking
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: HA-Proxy TCP/HTTP reverse proxy
# Description: HA-Proxy is a TCP/HTTP reverse proxy
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/haproxy
NAME=haproxy
DESC="HA-Proxy TCP/HTTP reverse proxy"
PIDFILE="/var/run/$NAME.pid"
OPTS="-D -f /etc/haproxy/haproxy.cfg -p $PIDFILE"
RETVAL=0
start() {
if [ -e $PIDFILE ]; then
PIDDIR=/proc/$(cat $PIDFILE)
if [ -d $PIDDIR ]; then
echo "$DESC already running."
return
else
echo "Removing stale PID file $PIDFILE"
rm -f $PIDFILE
fi
fi
echo -n "Starting $NAME: "
start-stop-daemon --start --pidfile $PIDFILE -x "$DAEMON" -- $OPTS
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo "done."
else
echo "failed."
fi
}
stop() {
if [ ! -e $PIDFILE ]; then
return
fi
echo -n "Stopping $DESC..."
start-stop-daemon --stop --quiet --retry 3 --oknodo --pidfile $PIDFILE -x "$DAEMON"
if [ -n "`pidof $DAEMON`" ] ; then
pkill -KILL -f $DAEMON
fi
echo "done."
rm -f $PIDFILE
rm -f /var/lock/subsys/$NAME
}
status() {
pid=`cat $PIDFILE 2>/dev/null`
if [ -n "$pid" ]; then
if ps -p $pid &>/dev/null ; then
echo "$DESC is running"
RETVAL=0
return
else
RETVAL=1
fi
fi
echo "$DESC is not running"
RETVAL=1
}
check() {
/usr/sbin/$NAME -c -q -V -f /etc/$NAME/$NAME.cfg
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|force-reload|reload)
stop
start
;;
status)
status
;;
check)
check
;;
*)
echo "Usage: $0 {start|stop|force-reload|restart|reload|status|check}"
RETVAL=1
;;
esac
exit $RETVAL

View File

@ -0,0 +1 @@
disable haproxy.service