Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions apps/trafficserver/.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,9 @@ W9_DIST=community
W9_VERSION="latest"

W9_POWER_PASSWORD="1PrMxExC45LsCT"

W9_HTTP_PORT_SET=8080
W9_HTTP_PORT_SET='8080'
W9_HTTP_PORT=8080
W9_ID=trafficserver
W9_LOGIN_USER=admin
W9_ADMIN_PATH="/manager"
W9_URL=internet_ip:$W9_HTTP_PORT_SET
W9_ID='trafficserver'
W9_URL='internet_ip:$W9_HTTP_PORT_SET'

W9_NETWORK=websoft9

#### ----------------------------------------------------------------------------------------- ####


# Below environment is created by this app
# TrafficServer management configuration
TS_ADMIN_USER=$W9_LOGIN_USER
TS_ADMIN_PASSWORD=$W9_POWER_PASSWORD
17 changes: 2 additions & 15 deletions apps/trafficserver/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
# CHANGELOG

## 2025-12-25
### Initial Release
- Complete docker-compose orchestration for Apache Traffic Server
- Basic reverse proxy configuration with records.config and remap.config
- Health checks and proper resource limits
- Persistent volumes for configuration, logs, and cache
- Management interface on port 8088
- Support for both HTTP (8080) and HTTPS (8443) protocols
- Comprehensive documentation and troubleshooting guide

### Configuration
- Default cache: 10GB disk, 256MB RAM
- Resource limits: 4GB memory, 2 CPU cores
- Reverse proxy mode enabled by default
- Logging enabled with rotation
## Release
### Fixes and Enhancements

61 changes: 8 additions & 53 deletions apps/trafficserver/Notes.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,10 @@
# Apache Traffic Server
# Traffic Server

## Notes
1. 修改records.yaml以及remap.config
remap.config示例:将所有发到该容器的请求反向代理到wordpress容器的80端口
```
map / http://wdpress_nmxmp/
```
2. 重建应用

- Default HTTP port: 8080
- Default HTTPS port: 8443
- Management interface: 8088
- Configuration files are mounted from `./src/` directory
- Cache storage is persistent across container restarts

## Configuration Notes

1. **Reverse Proxy Setup**: Edit `src/remap.config` to configure backend server mappings
2. **Performance Tuning**: Modify `src/records.config` for cache size and connection limits
3. **SSL Configuration**: Place SSL certificates in the appropriate volume mount if needed

## Troubleshooting

### Common Issues

1. **"Not Found on Accelerator" Error**:
- Check that remap.config has correct mapping rules
- Ensure the client URL matches the mapping pattern
- Verify that the origin server in remap.config is accessible

2. **Container fails to start**: Check port conflicts (8080, 8443, 8088)
3. **Configuration errors**: Validate syntax in `records.config`, `records.yaml` and `remap.config`
4. **Permission issues**: Ensure proper file permissions for mounted configuration files

### Logs

- Access logs: `/var/log/trafficserver/access.log`
- Error logs: `/var/log/trafficserver/error.log`
- Manager logs: `/var/log/trafficserver/manager.log`

## FAQ

### Q: How to configure TrafficServer as a reverse proxy?
A: Edit the `src/remap.config` file and add mapping rules like:
```
map http://your-domain.com/ http://backend-server:port/
```

### Q: How to increase cache size?
A: Modify the following lines in `src/records.config`:
```
CONFIG proxy.config.cache.ram_cache.size INT 268435456 # RAM cache in bytes
CONFIG proxy.config.cache.disk_space INT 10737418240 # Disk cache in bytes
```

### Q: How to enable HTTPS?
A: Configure SSL certificates and update the SSL settings in `records.config`

### Q: How to monitor TrafficServer?
A: Use the management interface at `http://your-server:8088/` or check the log files
配置文档:https://docs.trafficserver.apache.org/getting-started/index.en.html#configuration
27 changes: 2 additions & 25 deletions apps/trafficserver/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# Apache Traffic Server on Docker

This is an **[Docker Compose template](https://github.com/Websoft9/docker-library)** powered by [Websoft9](https://www.websoft9.com) based on Docker for Apache Traffic Server.
This is an **[Docker Compose template](https://github.com/Websoft9/docker-library)** powered by [Websoft9](https://www.websoft9.com) based on Docker for Apache Traffic Server:

Apache Traffic Server is a high-performance HTTP proxy cache server that can be used as a reverse proxy, forward proxy, or cache server.

## Supported Versions
- community: latest

- community: latest

## System Requirements

Expand All @@ -23,27 +21,6 @@ You can install this Apache Traffic Server by [How to use it?](https://github.co

If you want use Apache Traffic Server with **Websoft9 Business Support** free, you can [subscribe Apache Traffic Server](https://www.websoft9.com/apps) on Cloud platform

## Quick Start

1. After installation, access the web interface:
- HTTP: `http://your-server-ip:8080`
- HTTPS: `https://your-server-ip:8443`
- Management: `http://your-server-ip:8088`

2. Configure reverse proxy by editing the `remap.config` file in the `src` directory
3. Restart the container to apply configuration changes

## Configuration

### Basic Configuration
- Edit `src/records.config` for server settings
- Edit `src/remap.config` for URL remapping rules

### Environment Variables
- `W9_HTTP_PORT_SET`: HTTP port (default: 8080)
- `W9_HTTPS_PORT_SET`: HTTPS port (default: 8443)
- `W9_POWER_PASSWORD`: Admin password

## Documentation

[Apache Traffic Server Administrator Guide](https://support.websoft9.com/docs/trafficserver) powered by Websoft9
18 changes: 4 additions & 14 deletions apps/trafficserver/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,9 @@ services:
- trafficserver_config:/etc/trafficserver
- trafficserver_logs:/var/log/trafficserver
- trafficserver_cache:/var/cache/trafficserver
- ./src/records.config:/etc/trafficserver/records.config:ro
- ./src/records.yaml:/etc/trafficserver/records.yaml:ro
- ./src/remap.config:/etc/trafficserver/remap.config:ro
- ./src/hosting.config:/etc/trafficserver/hosting.config:ro
environment:
- TS_ROOT_PASSWORD=$W9_POWER_PASSWORD
# Health check
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
- ./src/records.yaml:/opt/etc/trafficserver/records.yaml
- ./src/remap.config:/opt/etc/trafficserver/remap.config
- ./src/storage.config:/opt/etc/trafficserver/storage.config

volumes:
trafficserver_config:
Expand All @@ -38,4 +28,4 @@ volumes:
networks:
default:
name: $W9_NETWORK
external: true
external: true
22 changes: 0 additions & 22 deletions apps/trafficserver/src/README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,3 @@
# About

This folder includes files mount to container and used by Websoft9

## Configuration Files

- `records.config`: Traditional configuration file for Apache Traffic Server
- `records.yaml`: Modern YAML configuration file (preferred by newer versions)
- `remap.config`: URL remapping rules for reverse proxy configuration
- `hosting.config`: Origin server configuration

## Usage

1. Edit `remap.config` to configure your reverse proxy mappings
2. Modify `records.config` for performance and caching settings
3. Restart the container to apply changes

## Default Configuration

- HTTP Port: 8080
- HTTPS Port: 8443
- Management Port: 8088
- Cache Size: 10GB disk, 256MB RAM

Refer to [Apache Traffic Server Documentation](https://docs.trafficserver.apache.org/) for more configuration options.
6 changes: 0 additions & 6 deletions apps/trafficserver/src/hosting.config

This file was deleted.

44 changes: 0 additions & 44 deletions apps/trafficserver/src/records.config

This file was deleted.

65 changes: 9 additions & 56 deletions apps/trafficserver/src/records.yaml
Original file line number Diff line number Diff line change
@@ -1,57 +1,10 @@
# Apache Traffic Server records.yaml
# Modern YAML configuration for TrafficServer

# HTTP server configuration
proxy:
config:
http:
server_ports: "8080:ipv4 8443:ssl:ipv4"
cache:
http: 1
ignore_client_cc_max_age: 1
required_headers: 0
keep_alive_enabled_in: 1
keep_alive_enabled_out: 1
chunking_enabled: 1
server_session_sharing:
match: both
session_auth_cache:
enabled: 1

# Cache settings
records:
http:
cache:
ram_cache:
size: 268435456 # 256MB
disk_space: 10737418240 # 10GB

# Reverse proxy mode
reverse_proxy:
enabled: 1

# Logging configuration
log:
logging_enabled: 3
max_secs_per_buffer: 5
max_space_mb_for_logs: 25000
max_space_mb_headroom: 1000
rolling_enabled: 1

# Management interface
admin:
synthetic_port: 8088
autoconf_port: 8080

# SSL settings
ssl:
client:
verify:
server: 0
server:
cert:
load_elevated: 1

# Performance tuning
net:
connections_throttle: 30000
accept_threads: 1
task_threads: 2
http: 1
server_ports: 8080 8080:ipv6
reverse_proxy:
enabled: 1
url_remap:
pristine_host_hdr: 1
remap_required: 1
21 changes: 1 addition & 20 deletions apps/trafficserver/src/remap.config
Original file line number Diff line number Diff line change
@@ -1,20 +1 @@
# Apache Traffic Server remap.config
# Reverse proxy mapping configuration

# Default mapping - replace with your actual backend servers
# Format: map <client-URL> <server-URL>

# Map all HTTP requests to httpbin for testing
map http://0.0.0.0:8080/ http://httpbin.org/
map http://localhost:8080/ http://httpbin.org/
map http://127.0.0.1:8080/ http://httpbin.org/

# Map any IP address on port 8080 to httpbin
regex_map http://.*:8080/(.*) http://httpbin.org/$1

# HTTPS mapping (if needed)
# map https://0.0.0.0:8443/ https://httpbin.org/

# Example: Map specific paths
# map http://localhost:8080/api/ http://api-server:8080/
# map http://localhost:8080/static/ http://static-server:80/
map / http://wdpress_nmxmp/
1 change: 1 addition & 0 deletions apps/trafficserver/src/storage.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/cache/trafficserver 500G