File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11FROM node:24-alpine
22
3+ RUN apk update && apk add --no-cache haproxy bash
4+
35WORKDIR /usr/src/app
46
57RUN mkdir /usr/src/app/cert_dir
68ENV CERT_CACHE_DIR=/usr/src/app/cert_dir
79
810COPY package.json package-lock.json ./
9-
1011RUN npm ci --omit=dev
1112
1213COPY src/ src/
1314
15+ COPY haproxy.cfg /etc/haproxy/haproxy.cfg
16+ COPY start.sh ./
17+ RUN chmod +x start.sh
18+
1419ARG GIT_HASH
1520ENV VERSION_HASH=${GIT_HASH}
16- CMD ["npm" , "start" ]
21+
22+ CMD ["./start.sh" ]
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ primary_region = 'cdg'
77 image = ' httptoolkit/testserver:latest'
88
99[env ]
10- PORTS = ' 8080 '
10+ PORTS = ' 3000 '
1111 CERT_CACHE_DIR = ' /usr/src/app/cert_dir'
1212
1313 # If deploying a separate instance and wanting real certificates, customize these:
@@ -23,11 +23,14 @@ primary_region = 'cdg'
2323
2424 [[services .ports ]]
2525 port = " 80"
26+ handlers = [" proxy_proto" ]
2627 [[services .ports ]]
2728 port = " 443"
29+ handlers = [" proxy_proto" ]
2830 [[services .ports ]]
2931 start_port = 8000
3032 end_port = 10000
33+ handlers = [" proxy_proto" ]
3134
3235 # Continually check /echo can return a valid HTTPS response
3336 [[services .http_checks ]]
Original file line number Diff line number Diff line change 1+ global
2+ log stdout format raw local0
3+
4+ defaults
5+ mode tcp
6+ log global
7+ timeout client 10m
8+ timeout server 10m
9+ timeout connect 5s
10+
11+ frontend public_shield
12+ bind *:8080 accept-proxy
13+
14+ # Track IP connection rate (100k IP storage, expires in 30s)
15+ stick-table type ip size 100k expire 30s store conn_rate(5s )
16+ tcp-request connection track-sc0 src
17+
18+ # Block if >100 connections in 5 seconds
19+ tcp-request connection reject if { sc0_conn_rate gt 100 }
20+
21+ default_backend node_app
22+
23+ backend node_app
24+ # Forward to Node on localhost
25+ server local_node 127.0.0.1:3000
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ npm start &
4+ NODE_PID=$!
5+
6+ haproxy -f /etc/haproxy/haproxy.cfg &
7+ HAPROXY_PID=$!
8+
9+ wait -n
10+ exit $?
You can’t perform that action at this time.
0 commit comments