Skip to content

Commit bca1fda

Browse files
committed
Remove default CPU/memory caps and add LTO build optimization
- Default PROXY_CPUS and PROXY_MEMORY now empty (use full system resources) - Docker run skips --cpus/--memory flags when not set - Dockerfile: enable LTO, codegen-units=1 for optimized binary
1 parent f571f05 commit bca1fda

2 files changed

Lines changed: 14 additions & 11 deletions

File tree

.github/workflows/build-engine.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
RUN git clone "https://github.com/${TELEMT_REPO}.git" /build
4848
WORKDIR /build
4949
RUN git checkout "${TELEMT_COMMIT}"
50+
ENV CARGO_PROFILE_RELEASE_LTO=true CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 CARGO_PROFILE_RELEASE_DEBUG=false
5051
RUN cargo build --release && strip target/release/telemt 2>/dev/null || true && cp target/release/telemt /telemt
5152
FROM debian:bookworm-slim
5253
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && rm -rf /var/lib/apt/lists/*

mtproxymax.sh

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ PROXY_PORT=443
101101
PROXY_METRICS_PORT=9090
102102
PROXY_DOMAIN="cloudflare.com"
103103
PROXY_CONCURRENCY=8192
104-
PROXY_CPUS="1"
105-
PROXY_MEMORY="256m"
104+
PROXY_CPUS=""
105+
PROXY_MEMORY=""
106106
AD_TAG=""
107107
BLOCKLIST_COUNTRIES=""
108108
MASKING_ENABLED="true"
@@ -2105,15 +2105,17 @@ run_proxy_container() {
21052105
# Run container
21062106
log_info "Starting telemt proxy on port ${PROXY_PORT}..."
21072107

2108-
docker run -d \
2109-
--name "$CONTAINER_NAME" \
2110-
--restart unless-stopped \
2111-
--network host \
2112-
--log-opt max-size=10m \
2113-
--log-opt max-file=3 \
2114-
--cpus "${PROXY_CPUS}" \
2115-
--memory "${PROXY_MEMORY}" \
2116-
--memory-swap "${PROXY_MEMORY}" \
2108+
local _docker_args=(
2109+
--name "$CONTAINER_NAME"
2110+
--restart unless-stopped
2111+
--network host
2112+
--log-opt max-size=10m
2113+
--log-opt max-file=3
2114+
)
2115+
[ -n "${PROXY_CPUS}" ] && _docker_args+=(--cpus "${PROXY_CPUS}")
2116+
[ -n "${PROXY_MEMORY}" ] && _docker_args+=(--memory "${PROXY_MEMORY}" --memory-swap "${PROXY_MEMORY}")
2117+
2118+
docker run -d "${_docker_args[@]}" \
21172119
-v "${CONFIG_DIR}/config.toml:/etc/telemt.toml:ro" \
21182120
"$(get_docker_image)" /etc/telemt.toml \
21192121
&>/dev/null || {

0 commit comments

Comments
 (0)