diff --git a/Others/dhcp/README.md b/Others/dhcp/README.md index 36e290e5cbe20dc6fe5d46d59d1f38bf9dcec920..f6a4ef31b1c04203a375e693bb7456471eefb318 100644 --- a/Others/dhcp/README.md +++ b/Others/dhcp/README.md @@ -38,7 +38,7 @@ In this usage, users can select the corresponding `{Tag}` based on their require - Create the `dhcpd.conf` file - Add a subnet declaration matching the `eth0` interface`s IP. For example: + Add a subnet declaration matching the `eth0` interface's IP. For example: ``` # Configure subnet based on eth0's IP (172.17.0.7) subnet 172.17.0.0 netmask 255.255.0.0 { @@ -50,7 +50,7 @@ In this usage, users can select the corresponding `{Tag}` based on their require } ``` **Key Points:** - * The subnet range and netmask must cover eth0`s IP(172.17.0.7). + * The subnet range and netmask must cover eth0's IP(172.17.0.7). * If your actual network is `172.17.0.0/24`, change the netmask to `255.255.255.0`. - Specify listening interface(Optional) diff --git a/Others/dnsmasq/README.md b/Others/dnsmasq/README.md index b40a6dbe26e1834820c93b263a778216368b50ef..a7a30979868d137d8ed6a110032a6a88d14a48d8 100644 --- a/Others/dnsmasq/README.md +++ b/Others/dnsmasq/README.md @@ -52,7 +52,7 @@ In this usage, users can select the corresponding `{Tag}` based on their require ``` nohup dnsmasq --no-daemon & ``` - To make sure it`s running: + To make sure it's running: ``` ps aux | grep dnsmasq ``` diff --git a/Others/image-list.yml b/Others/image-list.yml index fffed7d6c1e579d109cb7553993c2306cf62db6f..f06337212695ba4c441109e7adab9e38fa75bb61 100644 --- a/Others/image-list.yml +++ b/Others/image-list.yml @@ -79,7 +79,7 @@ images: haproxy: haproxy jetty: jetty keepalived: keepalived - trafficserver: trafficserver + traffic-server: traffic-server uwsgi: uwsgi nagios: nagios libyuv: libyuv diff --git a/Others/trafficserver/10.0.5/24.03-lts-sp1/Dockerfile b/Others/traffic-server/10.0.5/24.03-lts-sp1/Dockerfile similarity index 43% rename from Others/trafficserver/10.0.5/24.03-lts-sp1/Dockerfile rename to Others/traffic-server/10.0.5/24.03-lts-sp1/Dockerfile index 99aa794372c1a8065fe6fd23c7ea6afd6b34f2fc..b9c5dc4f08b0ea7aa9d92abc3e59358651a32d78 100644 --- a/Others/trafficserver/10.0.5/24.03-lts-sp1/Dockerfile +++ b/Others/traffic-server/10.0.5/24.03-lts-sp1/Dockerfile @@ -3,7 +3,7 @@ FROM ${BASE} ARG VERSION=10.0.5 RUN dnf update -y \ - && dnf install -y wget gcc-c++ cmake brotli-devel xz-devel pcre-devel pcre2-devel zlib-devel openssl-devel \ + && dnf install -y wget gcc-c++ cmake shadow-utils brotli-devel xz-devel pcre-devel pcre2-devel zlib-devel openssl-devel \ && dnf clean all \ && rm -rf /var/cache/dnf @@ -16,9 +16,22 @@ RUN wget https://github.com/apache/trafficserver/archive/refs/tags/10.0.5.tar.gz WORKDIR /opt/trafficserver-${VERSION} RUN cmake -B build -DCMAKE_INSTALL_PREFIX=/usr/local/trafficserver \ - && cmake --build build \ + && cmake --build build -- -j$(nproc) \ && cmake --install build +COPY remap.config /usr/local/trafficserver/etc/trafficserver/remap.config +COPY records.yaml /usr/local/trafficserver/etc/trafficserver/records.yaml + WORKDIR /usr/local/trafficserver -CMD ["./bin/traffic_server", "--help"] \ No newline at end of file +RUN useradd -r -s /sbin/nologin trafficserver + +RUN mkdir -p /usr/local/trafficserver/var/trafficserver && \ + chown -R trafficserver:trafficserver /usr/local/trafficserver/var && \ + chmod 750 /usr/local/trafficserver/var + +USER trafficserver + +EXPOSE 8080 + +CMD ["bin/traffic_server", "-T", "misc"] \ No newline at end of file diff --git a/Others/traffic-server/10.0.5/24.03-lts-sp1/records.yaml b/Others/traffic-server/10.0.5/24.03-lts-sp1/records.yaml new file mode 100644 index 0000000000000000000000000000000000000000..642540728e429ad0688b2a3ca5d0c2a7dec8a4bc --- /dev/null +++ b/Others/traffic-server/10.0.5/24.03-lts-sp1/records.yaml @@ -0,0 +1,219 @@ +############################################################################## +# *NOTE*: All options covered in this file should be documented in the docs: +# +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html +############################################################################## + +records: + accept_threads: 1 + cache: + limits: + http: + +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#proxy-config-cache-limits-http-max-alts + max_alts: 5 + log: + alternate: + +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#proxy-config-cache-log-alternate-eviction + eviction: 0 + +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#proxy-config-cache-max-doc-size + max_doc_size: 0 + min_average_object_size: 8000 + +############################################################################## +# RAM and disk cache configurations. Docs: +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#ram-cache +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/storage.config.en.html +############################################################################## + ram_cache: + size: -1 + ram_cache_cutoff: 4194304 + threads_per_disk: 8 +############################################################################## +# Debugging. Docs: +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#diagnostic-logging-configuration +############################################################################## + diags: + debug: + enabled: 0 + tags: http|dns + +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#proxy-config-dump-mem-info-frequency + dump_mem_info_frequency: 0 + +############################################################################## +# Thread configurations. Docs: +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#thread-variables +############################################################################## + exec_thread: + affinity: 1 + autoconfig: + enabled: 1 + scale: 1.0 + limit: 2 + http: + accept_no_activity_timeout: 120 + cache: + cache_responses_to_cookies: 1 + cache_urls_that_look_dynamic: 1 + +############################################################################## +# Heuristic cache expiration. Docs: +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#heuristic-expiration +############################################################################## + heuristic_lm_factor: 0.1 + heuristic_max_lifetime: 86400 + heuristic_min_lifetime: 3600 + +############################################################################## +# Enable / disable HTTP caching. Useful for testing, but also as an +# overridable (per remap) config +############################################################################## + http: 1 + +############################################################################## +# Cache control. Docs: +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#cache-control +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/cache.config.en.html +############################################################################## + ignore_client_cc_max_age: 1 + +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#proxy-config-http-cache-required-headers + required_headers: 2 + +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#proxy-config-http-cache-when-to-revalidate + when_to_revalidate: 0 + +############################################################################## +# Origin server connect attempts. Docs: +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#origin-server-connect-attempts +############################################################################## + connect_attempts_max_retries: 3 + connect_attempts_max_retries_down_server: 1 + connect_attempts_rr_retries: 3 + connect_attempts_timeout: 30 + down_server: + cache_time: 60 + forward: + proxy_auth_to_parent: 0 + +############################################################################## +# Proxy users variables. Docs: +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#proxy-user-variables +############################################################################## + insert_client_ip: 1 + +############################################################################## +# Via: headers. Docs: +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#proxy-config-http-insert-response-via-str +############################################################################## + insert_request_via_str: 1 + insert_response_via_str: 0 + insert_squid_x_forwarded_for: 1 + keep_alive_no_activity_timeout_in: 120 + keep_alive_no_activity_timeout_out: 120 + +############################################################################## +# Negative response caching, for redirects and errors. Docs: +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#negative-response-caching +############################################################################## + negative_caching_enabled: 0 + negative_caching_lifetime: 1800 + normalize_ae: 1 + +############################################################################## +# Parent proxy configuration, in addition to these settings also see parent.config. Docs: +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#parent-proxy-configuration +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/parent.config.en.html +############################################################################## + parent_proxy: + retry_time: 300 + +############################################################################## +# Security. Docs: +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#security +############################################################################## + push_method_enabled: 0 + +############################################################################## +# Specify server addresses and ports to bind for HTTP and HTTPS. Docs: +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#proxy.config.http.server_ports +############################################################################## + server_ports: 8080 8080:ipv6 + +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#proxy-config-http-slow-log-threshold + slow: + log: + threshold: 0 + +############################################################################## +# HTTP connection timeouts (secs). Docs: +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#http-connection-timeouts +############################################################################## + transaction_active_timeout_in: 900 + transaction_active_timeout_out: 0 + transaction_no_activity_timeout_in: 30 + transaction_no_activity_timeout_out: 30 + uncacheable_requests_bypass_parent: 1 + +############################################################################## +# Logging Config. Docs: +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#logging-configuration +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/logging.yaml.en.html +############################################################################## + log: + auto_delete_rolled_files: 1 + logging_enabled: 3 + max_space_mb_for_logs: 25000 + max_space_mb_headroom: 1000 + periodic_tasks_interval: 5 + rolling_enabled: 1 + rolling_interval_sec: 86400 + rolling_size_mb: 10 + +############################################################################## +# Network. Docs: +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#network +############################################################################## + net: + connections_throttle: 30000 + default_inactivity_timeout: 86400 + max_connections_in: 30000 + max_requests_in: 0 + +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#proxy-config-res-track-memory + res_track_memory: 0 + +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#reverse-proxy + reverse_proxy: + enabled: 1 + ssl: + client: + CA: + cert: + filename: null + +############################################################################## +# SSL Termination. Docs: +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#client-related-configuration +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/ssl_multicert.config.en.html +############################################################################## + verify: + server: + policy: PERMISSIVE + properties: ALL + task_threads: 2 + +############################################################################## +# These settings control remapping, and if the proxy allows (open) forward proxy or not. Docs: +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#url-remap-rules +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/remap.config.en.html +############################################################################## + url_remap: + +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.yaml.en.html#proxy-config-url-remap-pristine-host-hdr + pristine_host_hdr: 0 + remap_required: 1 + acl_behavior_policy: 0 \ No newline at end of file diff --git a/Others/traffic-server/10.0.5/24.03-lts-sp1/remap.config b/Others/traffic-server/10.0.5/24.03-lts-sp1/remap.config new file mode 100644 index 0000000000000000000000000000000000000000..382808994c9a1de14aa5a7c009d689e091051098 --- /dev/null +++ b/Others/traffic-server/10.0.5/24.03-lts-sp1/remap.config @@ -0,0 +1,207 @@ +# +# remap.config - URL Remapping Config File +# +# Documentation: +# https://docs.trafficserver.apache.org/en/latest/admin-guide/files/remap.config.en.html +# +# Using remap.config allows you to accomplish two things: +# +# 1) Rewrite a URL (from the client) before sending it to the Origin Server. +# 2) Protect the proxy server, to only allow certain requests. +# +# With the default configurations, at least one remap rule is required. This +# can be relaxed with the following configuration in records.yaml: +# +# records: +# url_remap: +# remap_required: 0 +# +# +# Be aware, doing so makes the proxy a generic, open-relay! +# +# The format is: +# client-URL origin-server-URL +# +# Where client-URL and origin-server-URL are both of the format +# ://:/ +# +# The directive is optional and can be different for different +# types of . The are optional ACL-like +# arguments unique for each remap rule +# +# Six different types of mappings are possible: +# map +# map_with_referer +# map_with_recv_port +# reverse_map +# redirect +# redirect_temporary +# +# Each of these map types can be prefixed with the string 'regex_' to indicate +# that the rule will have regular expression strings. See the last part of +# this description for more information on regex support. +# +# The 'map' mapping is the most straightforward. Requests that match the +# client-URL are rewritten into the origin-server-URL. The user agent will see +# the page on the remapped URL, but will not be notified of the address +# change. +# +# The 'map_with_referer' is an extended version of 'map', which can be used to +# activate the so-called "deep linking protection" feature available in +# Apache Traffic Server. +# +# The 'map_with_recv_port' is exactly like 'map' except that it uses the port +# at which the request was received to perform the mapping instead of the port +# present in the request. When present, 'map_with_recv_port' mappings are +# checked first. If there is a match, then it is chosen without evaluating the +# "regular" forward mapping rules. +# +# The 'reverse_map' mapping is used to rewrite location headers sent by the +# origin server. The 'redirect' mapping creates a permanent redirect message +# and informs the browser of the URL change. +# +# The 'redirect_temporary' mapping acts in the same way but tells the browser +# that this redirect is only temporary. We need to map the URL in reverse +# proxy mode so that user agents know to contact Traffic Server and not +# attempt to contact the Origin Server directly. +# +# For example, you can set up a reverse proxy for www.example.com with the +# real content situated at server1.example.com with the rules: +# +# map http://www.example.com/ http://server1.example.com/ +# reverse_map http://server1.example.com/ http://www.example.com/ +# +# Or you could permanently redirect users trying to access www.oldserver.com +# to www.newserver.com with the following rule: +# +# redirect http://www.oldserver.com/ http://www.newserver.com +# +# If the redirect is only temporary, you want to only temporarily remap the +# URL. You could use the following rule to divert users away from a failed +# server: +# +# redirect_temporary http://broken.firm.com http://working.firm.com +# +# In order to use "deep linking protection" Traffic Server's feature, the +# 'map_with_referer' mapping scheme must be used. In general, the format of is +# the following: +# +# map_with_referer client-URL origin-server-URL redirect-URL regex1 [regex2 ...] +# +# 'redirect-URL' is a redirection URL specified according to RFC 2616 and can +# contain special formatting instructions for run-time modifications of the +# resulting redirection URL. All regexes Perl compatible regular expressions, +# which describes the content of the "Referer" header which must be +# verified. In case an actual request does not have "Referer" header or it +# does not match with referer regular expression, the HTTP request will be +# redirected to 'redirect-URL'. +# +# At least one regular expressions must be specified in order to activate +# 'deep linking protection'. There are limitations for the number of referer +# regular expression strings - 2048. In order to enable the 'deep linking +# protection' feature in Traffic Server, configure records.yaml with: +# +# records: +# http: +# referer_filter: 1 +# +# +# In order to enable run-time formatting for redirect0URL, configure +# +# records: +# http: +# referer_format_redirect: 1 +# +# +# When run-time formatting for redirect-URL was enabled the following format +# symbols can be used: +# +# %r - to substitute original "Referer" header string +# %f - to substitute client-URL from 'map_with_referer' record +# %t - to substitute origin-server-URL from 'map_with_referer' record +# %o - to substitute request URL to origin server, which was created a +# the result of a mapping operation +# +# Note: There is a special referer type "~*" that can be used in order to +# specify that the Referer header is optional in the request. If "~*" referer +# was used in map_with_referer mapping, only requests with Referer header will +# be verified for validity. If the "~" symbol was specified before referer +# regular expression, it means that the request with a matching referer header +# will be redirected to redirectURL. It can be used to create a so-called +# negative referer list. If "*" was used as a referer regular expression - +# all referers are allowed. Various combinations of "*" and "~" in a referer +# list can be used to create different filtering rules. +# +# Examples: +# map_with_referer http://y.foo.bar.com/x/yy/ http://foo.bar.com/x/yy/ http://games.bar.com/new_games .*\.bar\.com www.bar-friends.com +# +# Explanation: Referer header must be in the request, only ".*\.bar\.com" +# and "www.bar-friends.com" are allowed. +# +# map_with_referer http://y.foo.bar.com/x/yy/ http://foo.bar.com/x/yy/ http://games.bar.com/new_games * ~.*\.evil\.com +# +# Explanation: Referer header must be in the request but all referers are +# allowed except ".*\.evil\.com". +# +# map_with_referer http://y.foo.bar.com/x/yy/ http://foo.bar.com/x/yy/ http://games.bar.com/error ~* * ~.*\.evil\.com +# +# Explanation: Referer header is optional. However, if Referer header exists, +# only request from ".*\.evil\.com" will be redirected to redirect-URL. +# +# There are optional filtering arguments that can be specified at the end of the mapping definition line: +# +# @action=allow|deny +# @src_ip=IP-address +# @method=HTTP method string (CONNECT|DELETE|GET|HEAD|OPTIONS|POST|PURGE|PUT|TRACE|PUSH) +# @plugin= +# @pparam= +# +# There is no limitation for the number of filtering arguments. +# +# Example: +# map http://foo.cow.com/ http://bar.cow.com @src_ip=10.72.118.51-10.72.118.62 @method=GET @method=DELETE @src_ip=192.168.0.1-192.168.0.254 @action=allow @method=PUT +# +# Traffic Server supports WebSockets but it must be enabled via remap. WebSocket upgrades are automatically +# detected when there exists a remap rule containing a ws:// scheme. +# +# Example: +# map ws://bar.com/ ws://foo.com/ +# +# Explanation: When a request comes in with the appropriate upgrade headers, Traffic Server will use this +# remap rule in an attempt to establish and maintain a websocket connection. +# +# Named filters can be created and applied to blocks of mappings +# using the .definefilter, .activatefilter, and .deactivatefilter +# directives. Named filters must be defined using .definefilter +# before being used. Once defined, .activatefilter can used to +# activate a filter for all mappings that follow until deactivated +# with .deactivatefilter. +# +# Example: +# .definefilter disable_delete_purge @action=deny @method=delete @method=purge +# .definefilter internal_only @action=allow @src_ip=192.168.0.1-192.168.0.254 @src_ip=10.0.0.1-10.0.0.254 +# +# .activatefilter disable_delete_purge +# +# map http://foo.example.com/ http://bar.example.com/ +# +# .activatefilter internal_only +# map http://www.example.com/admin http://internal.example.com/admin +# .deactivatefilter internal_only +# +# map http://www.example.com/ http://internal.example.com/ +# +# +# Regex support: Regular expressions can be specified in the rules with the +# following limitations: +# +# 1) Only the host field can have regexes - the scheme, port and other +# fields cannot. +# 2) The number of capturing sub-patterns is limited to 9; +# this means $0 through $9 can be used as substitution place holders ($0 +# will be the entire input string) +# 3) The number of substitutions in the expansion string is limited to 10. +# + +# This is a simple-standalone deployment example the can be replaced with actual forwarding configurations. +map http://localhost/ http://127.0.0.1:8080/ \ No newline at end of file diff --git a/Others/traffic-server/README.md b/Others/traffic-server/README.md new file mode 100644 index 0000000000000000000000000000000000000000..953671836acbb30c65fd9e2ad90cbe1b45b8594b --- /dev/null +++ b/Others/traffic-server/README.md @@ -0,0 +1,83 @@ +# Quick reference + +- The official Apache Traffic Server docker image. + +- Maintained by: [openEuler CloudNative SIG](https://gitee.com/openeuler/cloudnative). + +- Where to get help: [openEuler CloudNative SIG](https://gitee.com/openeuler/cloudnative), [openEuler](https://gitee.com/openeuler/community). + +# Apache Traffic Server | openEuler +Current Apache Traffic Server docker images are built on the [openEuler](https://repo.openeuler.org/). This repository is free to use and exempted from per-user rate limits. + +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. + +Learn more on [Apache Traffic Server Website](https://docs.trafficserver.apache.org/en/latest/index.html)⁠. + +# Supported tags and respective Dockerfile links +The tag of each `traffic-server` docker image is consist of the version of `traffic-server` and the version of basic image. The details are as follows + +| Tag | Currently | Architectures | +|----------|-------------|------------------| +|[10.0.5-oe2403sp1](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/traffic-server/10.0.5/24.03-lts-sp1/Dockerfile)| Apache Traffic Server 10.0.5 on openEuler 24.03-LTS-SP1 | amd64, arm64 | + +# Usage +This guide shows how to run the `Apcache Traffic Server(ATS)` as a simple local proxy in a single-node setup, forwarding traffic to a Nginx container running on the same host. + +- Pull the `openeuler/traffic-server` image from docker‘ + + You can select the corresponding `{Tag}` based your need. + ```bash + docker pull openeuler/traffic-server:{Tag} + ``` + +- Run a backend Nginx container + + Start a Nginx container listening on port `8080`: + ``` + docker run -d --name nginx -p 8080:8080 openeuler/nginx:latest + ``` + +- Configuration the forwarding rule + + Edit the default [remap.config](https://github.com/apache/trafficserver/blob/10.0.5/configs/remap.config.default). Add the following line:. + ``` + # remap.config + map http://localhost/ http://127.0.0.1:8080/ + ``` + + **Notes:** + * This tells ATS to forward requests for `http://localhost/` to the Nginx backend running on `127.0.0.1:8080`. + * Make sure the port `8080` matches the port you exposed for your Nginx container. + * You can adjust the backend address in `remap.config` according to your actual backend service. + +- Run the Traffic Server container + + Start the Traffic Server container and mount your `remap.config` to overwrite the default inside the container: + ``` + docker run -d \ + --name traffic-server \ + -p 8081:8080 \ + -v $(pwd)/remap.config:/usr/local/trafficserver/etc/trafficserver/remap.config \ + my-traffic-server-image + ``` + **Optional:** + * If you need to customize Traffic Server's default behavior, you can modify the [default records.yaml](https://github.com/apache/trafficserver/blob/10.0.5/configs/records.yaml.default.in) and mount it in the same way: + ``` + -v $(pwd)/records.yaml:/usr/local/trafficserver/etc/trafficserver/records.yaml + ``` + * This will overwrite the default config inside the container with your customized version. + + **Tip:** + * The container's internal port is defined by `proxy.config.http.server_port` in `records.yaml`(default is usually `8080`). + * The `-p 8081:8080` maps your host port `8081` to Traffic Server's internal `8080` port. + +- Verify the forwarding + + Test the forwarding by sending a request to your Traffic Server container: + ``` + curl -v -H "Host: localhost" http://127.0.0.1:8081/ + ``` + You should see the response coming from the backend Nginx server through Traffic Server. + +# Question and answering +If you have any questions or want to use some special features, please submit an issue or a pull request on [openeuler-docker-images](https://gitee.com/openeuler/openeuler-docker-images). \ No newline at end of file diff --git a/Others/traffic-server/doc/image-info.yml b/Others/traffic-server/doc/image-info.yml new file mode 100644 index 0000000000000000000000000000000000000000..8ad0d435d77cae9c7227f2b6b73dc4e66c83d471 --- /dev/null +++ b/Others/traffic-server/doc/image-info.yml @@ -0,0 +1,80 @@ +name: traffic-server +category: others +description: Apache Traffic Server (ATS) 是一个高性能的 HTTP 缓存代理服务器,可以作为正向代理,也可以作为反向代理,常用于大规模网站的内容分发、边缘缓存和负载均衡。 +environment: | + 本应用在Docker环境中运行,安装Docker执行如下命令 + ``` + yum install -y docker + ``` +tags: | + traffic-server镜像的Tag由其版本信息和基础镜像版本信息组成,详细内容如下 + + | Tag | Currently | Architectures | + |----------|-------------|------------------| + |[10.0.5-oe2403sp1](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/traffic-server/10.0.5/24.03-lts-sp1/Dockerfile)| Apache Traffic Server 10.0.5 on openEuler 24.03-LTS-SP1 | amd64, arm64 | + +download: | + 拉取镜像到本地 + ``` + docker pull openeuler/traffic-server:{Tag} + ``` + +usage: | + - 运行 Nginx 容器 + + 启动一个监听在 `8080` 端口的 Nginx 容器: + ``` + docker run -d --name nginx -p 8080:8080 openeuler/nginx:latest + ``` + + - 配置转发规则 + + 编辑默认的 [remap.config](https://github.com/apache/trafficserver/blob/10.0.5/configs/remap.config.default),添加如下配置: + ``` + # remap.config + map http://localhost/ http://127.0.0.1:8080/ + ``` + + **说明:** + * 这表示 ATS 会将访问 `http://localhost/` 的请求转发到本机上运行的 `Nginx` 容器(`127.0.0.1:8080`)。 + * 请确保这里配置的端口 `8080` 与你在启动 `Nginx` 容器时映射出来的端口一致。 + * 你也可以根据实际后端服务地址,修改 `remap.config` 中的目标地址。 + + - 运行 Traffic Server 容器 + + 启动 Traffic Server 容器,并挂载你的 `remap.config` 文件来覆盖容器内部默认的配置: + ``` + docker run -d \ + --name traffic-server \ + -p 8081:8080 \ + -v $(pwd)/remap.config:/usr/local/trafficserver/etc/trafficserver/remap.config \ + my-traffic-server-image + ``` + **可选:** + * 如果你需要自定义 Traffic Server 的默认行为,可以修改默认的 [records.yaml](https://github.com/apache/trafficserver/blob/10.0.5/configs/records.yaml.default.in),并在启动容器时挂载: + ``` + -v $(pwd)/records.yaml:/usr/local/trafficserver/etc/trafficserver/records.yaml + ``` + * 这样会将容器中的默认配置文件替换为你的自定义版本。 + + **提示:** + * 容器内部监听的端口是通过 `records.yaml` 中的 `proxy.config.http.server_port` 定义的(默认通常是 `8080`)。 + * 这里 `-p 8081:8080` 表示将宿主机的 `8081` 端口映射到容器内部的 `8080` 端口。 + + - 测试流量转发 + + 通过 `curl` 向 Traffic Server 容器发送请求,验证转发是否生效: + ``` + curl -v -H "Host: localhost" http://127.0.0.1:8081/ + ``` + 你应该能看到来自 `Nginx` 容器的响应,通过 Traffic Server 成功转发。 + +license: Apache-2.0 license +similar_packages: + - Nginx: Nginx 是一个高性能的、轻量级的 Web 服务器和反向代理服务器。它以其出色的性能和可扩展性而闻名,并且在处理高并发请求时表现出色。 +dependency: + - openssl + - zlib + - pcre + - xz + - brotli diff --git a/Others/traffic-server/doc/picture/logo.png b/Others/traffic-server/doc/picture/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..6de47c859c5e58f8ff758a74e019192ca634f873 Binary files /dev/null and b/Others/traffic-server/doc/picture/logo.png differ diff --git a/Others/trafficserver/meta.yml b/Others/traffic-server/meta.yml similarity index 100% rename from Others/trafficserver/meta.yml rename to Others/traffic-server/meta.yml