Skip to content

Commit dbdf242

Browse files
authored
Merge pull request #55 from linuxserver/timeout-config
Allow configuring timeouts via env
2 parents a43286f + 0f2406a commit dbdf242

4 files changed

Lines changed: 26 additions & 5 deletions

File tree

‎README.md‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ services:
183183
- SWARM=0 #optional
184184
- SYSTEM=0 #optional
185185
- TASKS=0 #optional
186-
- TZ=Etc/UTC #optional
187186
- VERSION=1 #optional
188187
- VOLUMES=0 #optional
189188
- LIBPOD_CONTAINERS=0 #optional
@@ -201,6 +200,9 @@ services:
201200
- LIBPOD_SYSTEM=0 #optional
202201
- LIBPOD_VERSION=1 #optional
203202
- LIBPOD_VOLUMES=0 #optional
203+
- TIMEOUT_CLIENT=10 #optional
204+
- TIMEOUT_SERVER=10 #optional
205+
- TZ=Etc/UTC #optional
204206
volumes:
205207
- /var/run/docker.sock:/var/run/docker.sock:ro
206208
restart: unless-stopped
@@ -265,6 +267,8 @@ docker run -d \
265267
-e LIBPOD_SYSTEM=0 `#optional` \
266268
-e LIBPOD_VERSION=1 `#optional` \
267269
-e LIBPOD_VOLUMES=0 `#optional` \
270+
-e TIMEOUT_CLIENT=10 `#optional` \
271+
-e TIMEOUT_SERVER=10 `#optional` \
268272
-v /var/run/docker.sock:/var/run/docker.sock:ro \
269273
--restart unless-stopped \
270274
--read-only \
@@ -332,6 +336,10 @@ Containers are configured using parameters passed at runtime (such as those abov
332336
| `-e ALLOW_START=0` | `(/libpod)?/(containers∣pods)/{id}/start` |
333337
| `-e ALLOW_STOP=0` | `(/libpod)?/(containers∣pods)/{id}/stop` |
334338
| `-e ALLOW_UNPAUSE=0` | `(/libpod)?/(containers∣pods)/{id}/unpause` |
339+
| **These options control HAProxy settings** | |
340+
| `-e TIMEOUT_CLIENT=10` | Client timeout in minutes |
341+
| `-e TIMEOUT_SERVER=10` | Server timeout in minutes |
342+
| **Docker native options** | |
335343
| `-v /var/run/docker.sock:ro` | Mount the host docker socket into the container. |
336344
| `--read-only` | Make the container filesystem read-only. |
337345
| `--tmpfs /run` | Mount /run to tmpfs (RAM) to make it writeable. |
@@ -456,6 +464,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
456464

457465
## Versions
458466

467+
* **05.10.26:** - Add `TIMEOUT_CLIENT` & `TIMEOUT_SERVER` options.
459468
* **18.08.26:** - Add `ALLOW_ARCHIVE`, `ALLOW_CHANGES`, `ALLOW_EXPORT`, `ALLOW_LOGS`, `ALLOW_TOP` options.
460469
* **15.06.26:** - Rebase to Alpine 3.24.
461470
* **13.06.26:** - Add libpod API support for Podman via `LIBPOD_*` environment variables.

‎readme-vars.yml‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ full_custom_readme: |
190190
- SWARM=0 #optional
191191
- SYSTEM=0 #optional
192192
- TASKS=0 #optional
193-
- TZ=Etc/UTC #optional
194193
- VERSION=1 #optional
195194
- VOLUMES=0 #optional
196195
- LIBPOD_CONTAINERS=0 #optional
@@ -208,6 +207,9 @@ full_custom_readme: |
208207
- LIBPOD_SYSTEM=0 #optional
209208
- LIBPOD_VERSION=1 #optional
210209
- LIBPOD_VOLUMES=0 #optional
210+
- TIMEOUT_CLIENT=10 #optional
211+
- TIMEOUT_SERVER=10 #optional
212+
- TZ=Etc/UTC #optional
211213
volumes:
212214
- /var/run/docker.sock:/var/run/docker.sock:ro
213215
restart: unless-stopped
@@ -272,6 +274,8 @@ full_custom_readme: |
272274
-e LIBPOD_SYSTEM=0 `#optional` \
273275
-e LIBPOD_VERSION=1 `#optional` \
274276
-e LIBPOD_VOLUMES=0 `#optional` \
277+
-e TIMEOUT_CLIENT=10 `#optional` \
278+
-e TIMEOUT_SERVER=10 `#optional` \
275279
-v /var/run/docker.sock:/var/run/docker.sock:ro \
276280
--restart unless-stopped \
277281
--read-only \
@@ -339,6 +343,10 @@ full_custom_readme: |
339343
| `-e ALLOW_START=0` | `(/libpod)?/(containers∣pods)/{id}/start` |
340344
| `-e ALLOW_STOP=0` | `(/libpod)?/(containers∣pods)/{id}/stop` |
341345
| `-e ALLOW_UNPAUSE=0` | `(/libpod)?/(containers∣pods)/{id}/unpause` |
346+
| **These options control HAProxy settings** | |
347+
| `-e TIMEOUT_CLIENT=10` | Client timeout in minutes |
348+
| `-e TIMEOUT_SERVER=10` | Server timeout in minutes |
349+
| **Native docker options** | |
342350
| `-v /var/run/docker.sock:ro` | Mount the host docker socket into the container. |
343351
| `--read-only` | Make the container filesystem read-only. |
344352
| `--tmpfs /run` | Mount /run to tmpfs (RAM) to make it writeable. |
@@ -463,6 +471,7 @@ full_custom_readme: |
463471
464472
## Versions
465473
474+
* **05.10.26:** - Add `TIMEOUT_CLIENT` & `TIMEOUT_SERVER` options.
466475
* **18.08.26:** - Add `ALLOW_ARCHIVE`, `ALLOW_CHANGES`, `ALLOW_EXPORT`, `ALLOW_LOGS`, `ALLOW_TOP` options.
467476
* **15.06.26:** - Rebase to Alpine 3.24.
468477
* **13.06.26:** - Add libpod API support for Podman via `LIBPOD_*` environment variables.

‎root/docker-entrypoint.sh‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ else
88
BIND_PROTO="[::]:2375 v4v6"
99
fi
1010

11-
sed "s/@@BIND_PROTO@@/${BIND_PROTO}/g" /templates/haproxy.cfg > /run/haproxy/haproxy.cfg
11+
sed -e "s/@@BIND_PROTO@@/${BIND_PROTO}/g" \
12+
-e "s/@@TIMEOUT_CLIENT@@/${TIMEOUT_CLIENT:-10}m/g" \
13+
-e "s/@@TIMEOUT_SERVER@@/${TIMEOUT_SERVER:-10}m/g" \
14+
/templates/haproxy.cfg > /run/haproxy/haproxy.cfg
1215

1316
echo '
1417
───────────────────────────────────────

‎root/templates/haproxy.cfg‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ defaults
1616
timeout http-request 10s
1717
timeout queue 1m
1818
timeout connect 10s
19-
timeout client 10m
20-
timeout server 10m
19+
timeout client @@TIMEOUT_CLIENT@@
20+
timeout server @@TIMEOUT_SERVER@@
2121
timeout http-keep-alive 10s
2222
timeout check 10s
2323
maxconn 2000

0 commit comments

Comments
 (0)