Skip to content

Commit

Permalink
Adding image for debugging and traffic shaping (#1394)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitarb committed Mar 23, 2021
1 parent 9fde38c commit 698d8a7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Dockerfile
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions 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

0 comments on commit 698d8a7

Please sign in to comment.