-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnew-haproxy
executable file
·92 lines (81 loc) · 2.29 KB
/
new-haproxy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")" || exit ; pwd -P)"
# shellcheck source=/dev/null
source "${SCRIPT_DIR}/common-functions.sh"
if [ -f "${SCRIPT_DIR}/overrides" ]; then
# shellcheck source=/dev/null
source "${SCRIPT_DIR}/overrides"
fi
PCS=""
which pcs && PCS="true"
BAD_PCS_HOST=""
if [ -n "${PCS}" ]; then
PCS_HAPROXY_HOST="$(pcs status | grep -iE "haproxy.*started" | awk '{print $NF}')"
RET="$?"
if [ "${RET}" -ne 0 ]; then
die "Unable to get pacemaker status"
fi
if [ "${PCS_HAPROXY_HOST}" != "smeagol" ]; then
BAD_PCS_HOST="true"
fi
fi
if [ -n "${HAPROXY_OVERRIDE}" ]; then
HAPROXY_SRC_DIR="${SCRIPT_DIR}/${HAPROXY_OVERRIDE}"
else
HAPROXY_SRC_DIR="${SCRIPT_DIR}/$1"
fi
MAKE_COUNT="$(make_cpu_count)"
if [ -d /opt/quictls/lib64 ]; then
QUICTLS_LIB=/opt/quictls/lib64
else
QUICTLS_LIB=/opt/quictls/lib
fi
if [ -z "$1" ]; then
die "Command needs an argument, the subdirectory with haproxy source"
fi
log_info "- Beginning pull/build of haproxy"
if [ -e "${HAPROXY_SRC_DIR}" ]; then
if [ -d "${HAPROXY_SRC_DIR}" ]; then
cd "${HAPROXY_SRC_DIR}" || die "cd to ${HAPROXY_SRC_DIR} didn't work"
log_info "Haproxy repo maintenance"
make -s clean
fetch_from_git "haproxy"
log_info "Building haproxy"
log_info "Using ${MAKE_COUNT} threads with make"
make -s "-j${MAKE_COUNT}" TARGET=linux-glibc \
USE_PCRE2_JIT=1 \
USE_OPENSSL=1 \
USE_ZLIB=1 \
USE_SYSTEMD=1 \
CPU=native \
USE_QUIC=1 \
SSL_INC=/opt/quictls/include \
SSL_LIB=$QUICTLS_LIB \
LDFLAGS="-Wl,-rpath,$QUICTLS_LIB" \
DEBUG=" " \
# blank line above intentional
# DEBUG="-DDEBUG_H3 -DDEBUG_QPACK" \
RETVAL="$?"
if [ "$RETVAL" -eq 0 ]; then
log_info "Installing haproxy"
make -s install > /dev/null
RETVAL="$?"
if [ "$RETVAL" -ne 0 ]; then
die "Install failed!"
fi
log_info "Cleaning haproxy repo"
make -s clean > /dev/null
log_info "Restarting haproxy"
service haproxy restart
else
die "Build failed!"
fi
else
die "location (${HAPROXY_SRC_DIR}) is not a directory."
fi
else
die "location (${HAPROXY_SRC_DIR}) does not exist."
fi
if [ -n "${BAD_PCS_HOST}" ]; then
log_warn "WARNING: Host running haproxy is ${PCS_HAPROXY_HOST} not smeagol."
fi