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
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ RUN set -ex; \
bind-tools \
nano \
vim \
envsubst; \
envsubst \
jq; \
chmod -R 777 /tmp

COPY --chmod=775 *.sh /
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ You should set `BIND_ADDRESS` to the IP on which server with ExApps can accept r

`TIMEOUT_SERVER`: timeout for ExApp to start responding to NC request, default: **1800s**

`NC_AUTOSTART_CONTAINERS`: if set, automatically start managed app containers (useful for Podman users)

`NC_HAPROXY_PASSWORD_FILE`: Specifies path to a file containing the password for HAProxy.

> [!NOTE]
Expand Down
9 changes: 9 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,21 @@ fi

echo "HaProxy config:"

start_app_containers() {
if ! [ -z ${NC_AUTOSTART_CONTAINERS+x} ]; then
echo "Autostarting existing app containers per NC_AUTOSTART_CONTAINERS."
curl --silent --globoff -XGET --unix-socket /run/docker.sock 'http://localhost/containers/json?filters={"status":["exited"]}' | jq -r '.[] | select(.Names[0] | startswith("/nc_app_")) | .Id' | xargs -I% curl --silent --globoff -XPOST --fail-with-body --unix-socket /run/docker.sock 'http://localhost/containers/%/start'
fi
}

if [ -f "/certs/cert.pem" ]; then
cat /haproxy.cfg
cat /haproxy_ex_apps.cfg
start_app_containers
haproxy -f /haproxy.cfg -f /haproxy_ex_apps.cfg -db
else
cat /haproxy.cfg
start_app_containers
haproxy -f /haproxy.cfg -db
fi

Expand Down