diff --git a/Dockerfile b/Dockerfile index 1c460313b03..f94fb1a8709 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,6 +37,15 @@ COPY --from=temporal-builder /temporal/temporal-server /usr/local/bin FROM temporal-server AS temporal-auto-setup CMD /start.sh autosetup +##### Debug configuration for Temporal with additional set of tools ##### +FROM temporal-server as temporal-debug +# iproute2 contains tc, which can be used for traffic shaping in resiliancy testing. +RUN apk add iproute2 +# Add debug configuration file. +COPY docker/debug-configure.sh /debug-configure.sh +# Run configuration script before the service startup. +CMD /debug-configure.sh && /start.sh autosetup + ##### Temporal CLI (tctl) ##### FROM temporalio/base-server:1.0.0 AS temporal-tctl WORKDIR /etc/temporal diff --git a/docker/debug-configure.sh b/docker/debug-configure.sh new file mode 100755 index 00000000000..62ddc415836 --- /dev/null +++ b/docker/debug-configure.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -x + +# Adding artificial delay for all network calls. +# In order to verify that there is a delay, you can login to the container and run: +# > tc qdisc show dev eth0 +# To change the delay inside of the running container, run: +# > tc qdisc del dev eth0 root && tc qdisc add dev eth0 root netem delay 100ms +# +# Read more about what's possible with tc here: +# https://www.badunetworks.com/traffic-shaping-with-tc/ +if [ ! -z "$TEMPORAL_DBG_NETWORK_DELAY_MS" ]; then + tc qdisc add dev eth0 root netem delay "${TEMPORAL_DBG_NETWORK_DELAY_MS}ms" +fi