Skip to content

Commit dd6f8a0

Browse files
author
JasonFord
committed
adding fixes for files
1 parent e4c926a commit dd6f8a0

File tree

4 files changed

+36
-5
lines changed

4 files changed

+36
-5
lines changed

Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ RUN apk update --no-cache && apk upgrade --no-cache openssl && apk add --no-cach
55
RUN mkdir -p /etc/codecov/ssl/certs && chown haproxy:haproxy /etc/codecov/ssl/certs && chown haproxy:haproxy /etc/haproxy
66
COPY --chown=haproxy:haproxy --chmod=644 config/0-haproxy.conf /etc/haproxy/0-haproxy.conf.template
77
COPY --chown=haproxy:haproxy --chmod=644 config/0-haproxy-no-chroot.conf /etc/haproxy/0-haproxy-no-chroot.conf.template
8-
COPY --chown=haproxy:haproxy --chmod=644 config/2-http.conf /etc/haproxy/2-http.conf.template
9-
COPY --chown=haproxy:haproxy --chmod=644 config/3-ssl.conf /etc/haproxy/3-ssl.conf.template
108

119
FROM base as self-hosted
1210
COPY --chmod=755 enterprise.sh /usr/local/bin/enterprise.sh
11+
COPY --chown=haproxy:haproxy --chmod=644 config/3-ssl.conf /etc/haproxy/3-ssl.conf.template
1312
COPY --chown=haproxy:haproxy --chmod=644 config/1-backends.conf /etc/haproxy/1-backends.conf.template
1413
COPY --chown=haproxy:haproxy --chmod=644 config/1-minio.conf /etc/haproxy/1-minio.conf.template
14+
COPY --chown=haproxy:haproxy --chmod=644 config/2-http.conf /etc/haproxy/2-http.conf.template
1515
COPY --chown=haproxy:haproxy --chmod=644 config/routing.map /etc/haproxy/routing.map
1616
COPY --chown=haproxy:haproxy --chmod=644 config/minio.map /etc/haproxy/minio.map
1717
ENV CODECOV_API_HOST=api
@@ -43,6 +43,8 @@ ENTRYPOINT ["/usr/local/bin/enterprise.sh"]
4343
FROM base as onprem
4444
COPY --chmod=755 onprem.sh /usr/local/bin/onprem.sh
4545
COPY --chown=haproxy:haproxy --chmod=644 config/onprem.conf /etc/haproxy/onprem.conf.template
46+
COPY --chown=haproxy:haproxy --chmod=644 config/onprem-ssl.conf /etc/haproxy/onprem-ssl.conf.template
47+
COPY --chown=haproxy:haproxy --chmod=644 config/onprem-http.conf /etc/haproxy/onprem-http.conf.template
4648
COPY --chown=haproxy:haproxy --chmod=644 config/onprem.map /etc/haproxy/routing.map
4749
ENV CODECOV_ONPREM_HOST_HEADER="%[req.hdr(Host)]"
4850
ENV CODECOV_ONPREM_HOST=onprem_host

config/onprem-http.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
frontend http
2+
bind :${CODECOV_GATEWAY_HTTP_PORT}
3+
use_backend %[path,map_reg("/etc/haproxy/routing.map")]
4+
default_backend be_onprem

config/onprem-ssl.conf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
frontend ssl
2+
bind :${CODECOV_GATEWAY_HTTP_PORT}
3+
bind :${CODECOV_GATEWAY_HTTPS_PORT} ssl crt /etc/codecov/ssl/certs/cert.crt
4+
http-request set-header X-Forwarded-Proto https if { ssl_fc }
5+
http-request redirect scheme https unless { ssl_fc }
6+
use_backend %[path,map_reg("/etc/haproxy/routing.map")]
7+
8+
default_backend be_onprem

onprem.sh

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,29 @@
22
set -e
33
_start_haproxy() {
44
export DOLLAR='$'
5-
envsubst < /etc/haproxy/0-haproxy.conf.template > /etc/haproxy/0-haproxy.conf
6-
envsubst < /etc/haproxy/onprem.conf.template > /etc/haproxy/onprem.conf
5+
if [ "$CODECOV_GATEWAY_SSL_ENABLED" ]; then
6+
echo 'Codecov gateway ssl enabled'
7+
envsubst < /etc/haproxy/onprem-ssl.conf.template > /etc/haproxy/2-frontends.conf
8+
else
9+
echo 'Codecov gateway ssl disabled'
10+
envsubst < /etc/haproxy/onprem-http.conf.template > /etc/haproxy/2-frontends.conf
11+
fi
12+
ssl_string="ssl verify none "
13+
if [ $CODECOV_ONPREM_SCHEME = "https" ]; then
14+
export CODECOV_FRONTEND_SSL_FLAG=$ssl_string
15+
fi
16+
if [ "$CODECOV_GATEWAY_CHROOT_DISABLED" ]; then
17+
echo 'Codecov gateway chroot disabled'
18+
envsubst < /etc/haproxy/0-haproxy-no-chroot.conf.template > /etc/haproxy/0-haproxy.conf
19+
else
20+
envsubst < /etc/haproxy/0-haproxy.conf.template > /etc/haproxy/0-haproxy.conf
21+
fi
22+
envsubst < /etc/haproxy/onprem.conf.template > /etc/haproxy/onprem-backends.conf
723
echo "Starting haproxy"
8-
haproxy -W -db -f /etc/haproxy/0-haproxy.conf -f /etc/haproxy/onprem.conf
24+
haproxy -W -db -f /etc/haproxy/0-haproxy.conf -f /etc/haproxy/onprem-backends.conf -f /etc/haproxy/2-frontends.conf
925
}
1026

27+
1128
if [ -z "$1" ];
1229
then
1330
_start_haproxy

0 commit comments

Comments
 (0)