kiwix: fiddle

This commit is contained in:
Starbeamrainbowlabs 2022-11-05 23:50:33 +00:00
parent 510d8d0cd2
commit bddaa05363
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
2 changed files with 20 additions and 5 deletions

View file

@ -24,3 +24,5 @@ WORKDIR /app
USER 10600:10600 USER 10600:10600
ENTRYPOINT [ "/srv/run.sh" ] ENTRYPOINT [ "/srv/run.sh" ]
CMD [ "serve" ]

View file

@ -1,13 +1,26 @@
#!/usr/bin/env bash #!/usr/bin/env bash
echo ">>> Environment:" mode="$1";
echo "[wrapper] NOMAD_PORT_KIWIX=$NOMAD_PORT_KIWIX" shift;
echo "[wrapper] Args: $*"
echo ">>> Checking environment" echo ">>> Environment:";
echo "[wrapper] NOMAD_PORT_KIWIX=$NOMAD_PORT_KIWIX";
echo "[wrapper] Mode: ${mode}";
echo "[wrapper] Args: $*";
echo ">>> Checking environment";
if [[ -z "${NOMAD_PORT_KIWIX}" ]]; then if [[ -z "${NOMAD_PORT_KIWIX}" ]]; then
echo "Error: The environment variable NOMAD_PORT_KIWIX is not set. It must be set to the port number to listen on." >&2; echo "Error: The environment variable NOMAD_PORT_KIWIX is not set. It must be set to the port number to listen on." >&2;
fi fi
echo ">>> Starting kiwix"; echo ">>> Starting kiwix";
case "${mode}" in
serve )
echo ">>> kiwix-serve --library --port ${NOMAD_PORT_KIWIX} /srv/data";
/app/kiwix-serve --library --port "${NOMAD_PORT_KIWIX}" /srv/data; /app/kiwix-serve --library --port "${NOMAD_PORT_KIWIX}" /srv/data;
;;
* )
echo ">>> kiwix-serve $*";
/app/kiwix-serve "$@";
;;
esac