Skip to content

Commit b5cabcf

Browse files
authored
added ability to specify custom HaPRoxy timeouts (#18)
Signed-off-by: Alexander Piskun <[email protected]>
1 parent 2c03220 commit b5cabcf

File tree

5 files changed

+31
-5
lines changed

5 files changed

+31
-5
lines changed

.github/SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Supported Versions
44

5-
Only the latest non beta release version of `app_api` are currently being supported with security updates.
5+
Only the latest non beta release version of `docker-socket-proxy` are currently being supported with security updates.
66

77
## Reporting a Vulnerability
88

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ ENV HAPROXY_PORT 2375
66
ENV BIND_ADDRESS *
77
ENV EX_APPS_NET "localhost"
88
ENV EX_APPS_COUNT 50
9+
ENV TIMEOUT_CONNECT "10s"
10+
ENV TIMEOUT_CLIENT "30s"
11+
ENV TIMEOUT_SERVER "30s"
912

1013
RUN set -ex; \
1114
apk add --no-cache \
@@ -14,7 +17,8 @@ RUN set -ex; \
1417
bash \
1518
curl \
1619
openssl \
17-
bind-tools; \
20+
bind-tools \
21+
nano; \
1822
chmod -R 777 /tmp
1923

2024
COPY --chmod=775 *.sh /

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ You should set `BIND_ADDRESS` to the IP on which server with ExApps can accept r
6363

6464
`BIND_ADDRESS`: the address to use for port binding. (Usually needed only for remote installs, **must be accessible from the Nextcloud**)
6565

66+
`TIMEOUT_CONNECT`: timeout for connecting to ExApp, default: **10s**
67+
68+
`TIMEOUT_CLIENT`: timeout for NC to start sending request data to the ExApp, default: **30s**
69+
70+
`TIMEOUT_SERVER`: timeout for ExApp to start responding to NC request, default: **30s**
71+
6672
#### Only for ExApp installs with TLS:
6773

6874
* `EX_APPS_NET`: determines destination of requests to ExApps for HaProxy. Default:`localhost`
@@ -148,3 +154,16 @@ specify the EX_APPS_NET variable when creating the container:
148154
```shell
149155
-e EX_APPS_NET="ipv4@localhost"
150156
```
157+
158+
### Slow responding ExApps
159+
160+
Some AI applications may respond **longer** than the standard 30 seconds timeout defined in the `HaProxy` config.
161+
162+
An example of such an application: `context_chat`
163+
164+
For the successful operation of such applications,
165+
you can set custom config values through the environment variable during the creation of the DSP container with:
166+
167+
```shell
168+
-e TIMEOUT_SERVER="1800s"
169+
```

haproxy.cfg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ defaults
99
log global
1010
option httplog
1111
option dontlognull
12-
timeout connect 10s
13-
timeout client 30s
14-
timeout server 30s
12+
timeout connect TIMEOUT_CONNECT
13+
timeout client TIMEOUT_CLIENT
14+
timeout server TIMEOUT_SERVER
1515

1616
userlist app_api_credentials
1717
user app_api_haproxy_user insecure-password NC_PASSWORD_PLACEHOLDER

start.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#!/bin/sh
22

33
sed -i "s|NC_PASSWORD_PLACEHOLDER|$NC_HAPROXY_PASSWORD|" /haproxy.cfg
4+
sed -i "s|TIMEOUT_CONNECT|$TIMEOUT_CONNECT|" /haproxy.cfg
5+
sed -i "s|TIMEOUT_CLIENT|$TIMEOUT_CLIENT|" /haproxy.cfg
6+
sed -i "s|TIMEOUT_SERVER|$TIMEOUT_SERVER|" /haproxy.cfg
47

58
if [ -f "/certs/cert.pem" ]; then
69
EX_APPS_COUNT_PADDED=$(printf "%03d" "$EX_APPS_COUNT")

0 commit comments

Comments
 (0)