Traffic Server is a high-performance building block for cloud services. It's more than just a caching proxy server; it also has support for plugins to build large scale web applications.
AS of version 10, ATS has transitioned to cmake as its build system. Below is a quick-start guide to building ATS with cmake:
With cmake, you definitely want to create an out-of-source build. You will give that directory to every cmake command. For these examples, it will just be build.
$ cmake -B build
This will configure the project with defaults.
If you want to customize the build, you can pass values for variables on the command line. Or, you can interactively change them using the ccmake program.
$ cmake -B build -DCMAKE_INSTALL_PREFIX=/tmp/ats -DBUILD_EXPERIMENTAL_PLUGINS=ON
-- or --
$ ccmake build
To specify the location of a dependency (like --with-* for autotools builds), you generally set a variable with the ROOT. The big exception to this is for openssl. This variable is called OPENSSL_ROOT_DIR
$ cmake -B build -Djemalloc_ROOT=/opt/jemalloc -DOPENSSL_ROOT_DIR=/opt/boringssl
cmake has a feature for grouping configurations together to make configuration and reproduction easier. The file CMakePresets.json declares presets that you can use from the command line. You can provide your own CMakeUserPresets.json and further refine those via inheritance:
$ cmake --preset dev
You can start out your user presets by just copying CMakePresets.json and removing everything in configurePresets
Here is an example user preset:
{
"name": "clang",
"hidden": true,
"environment": {
"LDFLAGS": "-L/opt/homebrew/opt/llvm/lib -L/opt/homebrew/opt/llvm/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++ -fuse-ld=/opt/homebrew/opt/llvm/bin/ld64.lld",
"CPPFLAGS": "-I/opt/homebrew/opt/llvm/include",
"CXXFLAGS": "-stdlib=libc++",
"CC": "/opt/homebrew/opt/llvm/bin/clang",
"CXX": "/opt/homebrew/opt/llvm/bin/clang++"
}
},
{
"name": "mydev",
"displayName": "my development",
"description": "My Development Presets",
"binaryDir": "${sourceDir}/build-dev-clang",
"inherits": ["clang", "dev"],
"cacheVariables": {
"CMAKE_INSTALL_PREFIX": "/opt/ats-cmake",
"jemalloc_ROOT": "/opt/homebrew",
"ENABLE_LUAJIT": false,
"ENABLE_JEMALLOC": true,
"ENABLE_MIMALLOC": false,
"ENABLE_MALLOC_ALLOCATOR": true,
"BUILD_EXPERIMENTAL_PLUGINS": true,
"BUILD_REGRESSION_TESTING": true
}
},
And then use it like:
cmake --preset mydev
$ cmake --build build
$ cmake --build build -t traffic_server
$ cd build
$ ctest
$ cmake --install build
trafficserver ............. Top src dir
βββ ci .................... Quality assurance and other CI tools and configs
βββ cmake ................. CMake build system files
βββ configs ............... Configurations
βββ contrib ............... Various contributed auxiliary pieces
βββ doc ................... Documentation for Traffic Server
β βββ admin-guide ....... Admin guide documentations
β βββ appendices ........ Appendices of Traffic Server
β βββ developer-guide ... Documentation for developers
β βββ dot ............... Graphviz source files for docs pictures
β βββ static ............ Static resources
β βββ uml ............... Documentation in UML
βββ example ............... Example plugins
βββ ext ................... External dependencies and extensions
βββ include ............... Header files
βββ lib ................... Third-party libraries
β βββ Catch2 ............ Unit testing framework
β βββ fastlz ............ Fast compression library
β βββ ls-hpack .......... HPACK compression for HTTP/2
β βββ swoc .............. Solid Wall of Code utility library
β βββ systemtap ......... SystemTap integration
β βββ yamlcpp ........... YAML parser library
βββ memory-bank ........... AI assistant context documentation
βββ plugins ............... Stable core plugins
β βββ experimental ...... Experimental core plugins
βββ rc .................... Installation programs and scripts
βββ src ................... Source for all the main binaries / applications
β βββ api ............... C Plugin API implementation
β βββ cripts ............ Cripts scripting framework
β βββ iocore ............ I/O core subsystem
β β βββ aio ........... Asynchronous I/O core
β β βββ cache ......... Disk and RAM cache
β β βββ dns ........... DNS (asynchronous)
β β βββ eventsystem ... Event Driven Engine
β β βββ hostdb ........ Internal DNS cache
β β βββ io_uring ...... io_uring support (Linux)
β β βββ net ........... Network I/O
β β β βββ quic ...... QUIC implementation
β β βββ utils ......... I/O utilities
β βββ mgmt .............. JSONRPC server/management and tools
β βββ proxy ............. HTTP proxy logic
β β βββ hdrs .......... Headers parsing and management
β β βββ http .......... HTTP/1.x implementation
β β βββ http2 ......... HTTP/2 implementation
β β βββ http3 ......... HTTP/3 implementation
β β βββ logging ....... Flexible logging
β β βββ shared ........ Shared proxy files
β βββ records ........... Configuration records library
β βββ shared ............ Shared utilities and RPC
β βββ traffic_cache_tool Tool to interact with the Traffic Server cache
β βββ traffic_crashlog .. Helper process that catches Traffic Server crashes
β βββ traffic_ctl ....... Command line management tool
β βββ traffic_layout .... Display information on the build and runtime directory structure
β βββ traffic_logcat .... Convert binary log file to plain text
β βββ traffic_logstats .. Log parsing and metrics calculation utility
β βββ traffic_quic ...... QUIC client tool
β βββ traffic_server .... Main proxy server
β βββ traffic_top ....... Top like tool for viewing Traffic Server statistics
β βββ traffic_via ....... Tool for decoding the Traffic Server Via header codes
β βββ tscore ............ Base / core library
β βββ tscpp ............. C++ api wrapper for plugin developers
β βββ tsutil ............ Core utilities (metrics, debugging, regex, etc.)
βββ tests ................. Different tests for Traffic Server
βββ tools ................. Directory of various tools
βββ CONTRIBUTING.md ....... How to contribute to the project
βββ INSTALL ............... Build and installation guide
βββ LICENSE ............... Full license text
βββ NOTICE ................ Copyright notices
βββ README.md ............. This file: intro, links, build info
βββ README-EC2 ............ Info on EC2 support
βββ SECURITY.md ........... Security policy and vulnerability reporting
βββ STATUS ................ Release history and information
This section outlines build requirements for different OS distributions. This may be out of date compared to the on-line requirements at
https://cwiki.apache.org/confluence/display/TS/Building.
As of ATS v9.0.0 and later, gcc 7 or later is required, since we now use and require the C++17 standard.
cmake
ninja
pkgconfig
gcc/g++ or clang/clang++
openssl-devel
pcre2-devel
ncurses-devel and libcurl-devel(optional, needed for traffic_top)
libcap-devel (optional, highly recommended)
hwloc-devel (optional, highly recommended)
cmake
ninja
pkg-config
gcc/g++ or clang/clang++
zlib1g-dev
libssl-dev
libpcre2-dev
libcap-dev (optional, highly recommended)
libhwloc-dev (optional, highly recommended)
libncurses5-dev (optional, required for e.g.: traffic_top)
libcurl4-openssl-dev (optional, required for e.g.: traffic_top)
build-base
libexecinfo-dev
pcre2-dev
libressl-dev
cmake
ninja
linux-headers
cmake
ninja
pkg-config
openssl
pcre2
cmake
ninja
devel/gmake
devel/pkgconf
security/openssl
devel/pcre2
textproc/flex (optional, install newer version from ports, fix PATH)
devel/hwloc (optional, highly recommended)
You can download the latest source code from the official Apache Traffic Server site:
https://trafficserver.apache.org/downloads
(or via the URL shortener: http://s.apache.org/uG). Once downloaded, follow the instructions:
tar jxvf trafficserver-9.1.3.tar.bz2
cd trafficserver-9.1.3
cmake -B build
cmake --build build
This will build with a destination prefix of /usr/local. You can finish the installation with
sudo cmake --install build
git clone https://github.com/apache/trafficserver.git # get the source code from ASF Git repository
cd trafficserver # enter the checkout directory
cmake --preset default # configure the build
cmake --build build-default # execute the compile
cmake --build build-default -t test # run tests (optional)
cmake --install build-default # install
NOTE: Alternately you may use the scripts under 'contrib' which will automate the install for trafficserver under EC2 which is HIGHLY RECOMMENDED. See 'README-EC2' for further details.
mkdir -p /mnt #EC2 Storage Mount, where storage is located
cd /mnt
git clone ... # get the source code from ASF Git repo
cd trafficserver # enter the checkout dir
cmake --preset default # configure the build
cmake --build build-default # execute the compile
cmake --build build-default -t test
cmake --install build-default
mkdir -p /mnt #EC2 Storage Mount, where storage is located
cd /mnt
git clone ... # get the source code from ASF Git repo
cd trafficserver # enter the checkout dir
cmake --preset default # configure the build
cmake --build build-default # execute the compile
cmake --build build-default -t test # run tests (optional)
cmake --install build-default # install
/usr/local
βββ /var/log/trafficserver log files created at runtime
βββ /var/trafficserver runtime files
βββ /etc/trafficserver configuration files
βββ /bin executable binaries
βββ /libexec/trafficserver plugins
This distribution includes cryptographic software. The country in which you currently reside may have restrictions on the import, possession, use, and/or re-export to another country, of encryption software. BEFORE using any encryption software, please check your country's laws, regulations and policies concerning the import, possession, or use, and re-export of encryption software, to see if this is permitted. See http://www.wassenaar.org/ for more information.
The U.S. Government Department of Commerce, Bureau of Industry and Security (BIS), has classified this software as Export Commodity Control Number (ECCN) 5D002.C.1, which includes information security software using or performing cryptographic functions with asymmetric algorithms. The form and manner of this Apache Software Foundation distribution makes it eligible for export under the License Exception ENC Technology Software Unrestricted (TSU) exception (see the BIS Export Administration Regulations, Section 740.13) for both object code and source code.
The following provides more details on the included cryptographic software:
The functionality of OpenSSL http://www.openssl.org/ is utilized in parts of the software.
export CC=clang
export CXX=clang++
export CFLAGS="-O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link"
export CXXFLAGS="-O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link"
export LIB_FUZZING_ENGINE=-fsanitize=fuzzercmake -B build -DENABLE_POSIX_CAP=OFF -DENABLE_FUZZING=ON -DYAML_BUILD_SHARED_LIBS=OFF
cmake --build build- Web page: https://trafficserver.apache.org/
- Wiki: https://cwiki.apache.org/confluence/display/TS/
- User mailing list: [email protected]