Skip to content

Commit

Permalink
Begin work on Trafficserver 10 upgrade.
Browse files Browse the repository at this point in the history
  • Loading branch information
GUI committed Jan 29, 2025
1 parent 0d8df64 commit f678fd3
Show file tree
Hide file tree
Showing 8 changed files with 293 additions and 259 deletions.
14 changes: 12 additions & 2 deletions config/schema.cue
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,18 @@ import "path"
storage: {
size: string | *"256M"
}
embedded_server_config: {
records: [...string] | *[]
records: {
cache: {
ram_cache: {
size: string | *"-1"
}
}
net: {
connections_throttle: uint | *30000
max_requests_in: uint | *0
max_connections_in: uint | *30000
default_inactivity_timeout: uint | *86400
}
}
}

Expand Down
1 change: 0 additions & 1 deletion src/api-umbrella/utils/generate_runtime_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,6 @@ local function set_computed_config(config)
-- since we will allow long-running streaming responses..
config["envoy"]["_route_timeout"] = "0s"
config["trafficserver"]["_connect_attempts_timeout"] = math.min(5, config["nginx"]["proxy_connect_timeout"])
config["trafficserver"]["_post_connect_attempts_timeout"] = math.min(5, config["trafficserver"]["_connect_attempts_timeout"])
config["trafficserver"]["_transaction_no_activity_timeout_out"] = config["nginx"]["proxy_read_timeout"]
config["trafficserver"]["_transaction_no_activity_timeout_in"] = config["nginx"]["proxy_send_timeout"]
config["nginx"]["_initial_proxy_connect_timeout"] = math.min(5, config["nginx"]["proxy_connect_timeout"])
Expand Down
40 changes: 16 additions & 24 deletions tasks/deps/trafficserver
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# https://github.com/apache/trafficserver/issues/10393 This issue has been
# reproducible by running the following test in a loop:
# bundle exec minitest test/apis/test_web_app_large_body.rb -n test_limit_is_configurable
trafficserver_version="9.1.4"
trafficserver_hash="f18aca66e444470738f6031366edc45db26942917e3fe8cba9fbb3b28173e01e06991aa9846e459047365946738931b1910719574c9c2afee72e4dfb30eab617"
trafficserver_version="10.0.2"
trafficserver_hash="5de65130d4c0997d619d0c1be6840aaffd3e17abd820d22b9294c4d78834eb71a58fed12f3166396c7169583850a8b42ed768e5af11e855c87b2fca8a10da7f3"

set -e -u -x
source ./tasks/helpers.sh
Expand All @@ -15,30 +15,22 @@ task_working_dir
download "https://archive.apache.org/dist/trafficserver/trafficserver-$trafficserver_version.tar.bz2" "sha512" "$trafficserver_hash"
extract_download "trafficserver-$trafficserver_version.tar.bz2"

detect_os_release
if [[ "$ID_NORMALIZED" == "rhel" && "$VERSION_ID" == "7" ]]; then
export CC=/opt/rh/devtoolset-7/root/usr/bin/gcc
export CXX=/opt/rh/devtoolset-7/root/usr/bin/g++
elif [[ "$ID" == "debian" && "$VERSION_ID" == "9" ]]; then
export CC=clang-7
export CXX=clang++-7
export CXXFLAGS="-I/usr/lib/llvm-7/include/c++/v1 -stdlib=libc++"
fi

cd "trafficserver-$trafficserver_version"

SPHINXBUILD=false ./configure \
--disable-tests \
--disable-silent-rules \
--disable-maintainer-mode \
--disable-dependency-tracking \
--prefix="$INSTALL_PREFIX_EMBEDDED" \
--with-jemalloc \
--with-luajit="$STAGE_EMBEDDED_DIR/openresty/luajit"
make -j"$NPROC"
make install DESTDIR="$STAGE_DIR"
chrpath -d "$STAGE_EMBEDDED_DIR/lib/libtscore.so"
chrpath -d "$STAGE_EMBEDDED_DIR/lib/libtsmgmt.so"
PKG_CONFIG_PATH="$STAGE_EMBEDDED_DIR/openresty/luajit/lib/pkgconfig:${PKG_CONFIG_PATH:-}" \
cmake -B build \
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX_EMBEDDED" \
-DENABLE_LUAJIT=ON \
-DENABLE_JEMALLOC=ON

cmake --build build -j "$NPROC"

cmake --install build

chrpath -d "$STAGE_EMBEDDED_DIR/lib/libswoc"*.so
chrpath -d "$STAGE_EMBEDDED_DIR/lib/libtsapi.so"
chrpath -d "$STAGE_EMBEDDED_DIR/lib/libtscppapi.so"
chrpath -d "$STAGE_EMBEDDED_DIR/lib/libyaml-cpp.so"
find "$STAGE_EMBEDDED_DIR/libexec/trafficserver/" -name "*.so" -exec chrpath -d {} \;
find "$STAGE_EMBEDDED_DIR/bin/" -name "traffic_*" -exec chrpath -d {} \;

Expand Down
5 changes: 4 additions & 1 deletion templates/etc/perp/trafficserver/rc.main.etlua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ if [ "${1}" = "start" ]; then
ln -sf /dev/stderr "<%- config['log_dir'] %>/trafficserver/traffic.out"
fi

exec runtool ${run_args[@]+"${run_args[@]}"} traffic_manager --nosyslog
# Disable freelist args to use jemalloc for memory management.
# https://github.com/apache/trafficserver/issues/9162#issuecomment-1292274810
# https://github.com/apache/trafficserver/issues/3354
exec runtool ${run_args[@]+"${run_args[@]}"} traffic_server --disable_freelist --disable_pfreelist
fi

exit 0
File renamed without changes.
6 changes: 4 additions & 2 deletions templates/etc/trafficserver/logging.yaml.etlua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ logging:
# chi: Client: IP address of the client’s host.
# caun: Client Request: Authentication User name
# cqtn: Client Request: Client request timestamp
# cqtx: Client Request: HTTP client request text
# cqhm: Client Request: HTTP method
# pqu: Proxy Request: URL
# cqpv: Client Request: Request protocol and version
# pssc: Proxy Response: HTTP response status code sent by Traffic Server proxy to the client.
# pscl: Proxy Response: Content body length of the Traffic Server proxy response.
#
Expand Down Expand Up @@ -44,7 +46,7 @@ logging:
# csssc: Cached Proxy: Response HTTP response status code of the origin server response, as cached by Traffic Server.
# cqtr: Client Request: TCP reused status of the connection between the client and Traffic Server proxy, indicating whether the request was delivered through an already established connection.
# cquuc: Client Request: Canonical (prior to remapping) effective URL from client request.
format: '[%<cqtn>] "%<cqtx>" %<pssc> id=%<{X-Api-Umbrella-Request-ID}cqh> up_status=%<sssc> time=%<ttms> origin_time=%<stms> client_finish=%<cfsc> proxy_finish=%<pfsc> cache=%<crc> cache_sub=%<crsc> cache_hit=%<chm> cache_write=%<cwr> con_attempt=%<sca> '
format: '[%<cqtn>] "%<cqhm> %<pqu> %<cqpv>" %<pssc> id=%<{X-Api-Umbrella-Request-ID}cqh> up_status=%<sssc> time=%<ttms> origin_time=%<stms> client_finish=%<cfsc> proxy_finish=%<pfsc> cache=%<crc> cache_sub=%<crsc> cache_hit=%<chm> cache_write=%<cwr> con_attempt=%<sca> '

logs:
- mode: <%- (config["log"]["destination"] == "console") and "ascii_pipe" or "ascii" %>
Expand Down
229 changes: 0 additions & 229 deletions templates/etc/trafficserver/records.config.etlua

This file was deleted.

Loading

0 comments on commit f678fd3

Please sign in to comment.