Skip to content

Commit

Permalink
✨ Add healthcheck support and auto-update apps
Browse files Browse the repository at this point in the history
  • Loading branch information
llaumgui committed Dec 17, 2023
1 parent c0202da commit 19953fa
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 3 deletions.
6 changes: 3 additions & 3 deletions 8.2-nextcloud/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
busybox-static && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
mkdir -p /var/spool/cron/crontabs && \
echo '*/5 * * * * php -f /var/www/cron.php' > /var/spool/cron/crontabs/www-data
COPY --chmod=755 cron.sh /
mkdir -p /var/spool/cron/crontabs
COPY --chmod=755 cron/www-data /var/spool/cron/crontabs/
COPY --chmod=755 cron/*.sh /


# ------------------------------------------------------------------ Supervisord
Expand Down
4 changes: 4 additions & 0 deletions 8.2-nextcloud/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ PHP 8.2-nextcloud image:
* Use Debian with GLibC for [reconize](https://github.com/nextcloud/recognize) with **native speed mode**.
* Use [Supervisor](http://supervisord.org/) to launch several process.
* Implement cron.
* Implement [Healthcheck](https://healthchecks.io/).
* Nextcloud cron every 5mn (use Healthcheck: `HEALTHCHECKS_NC_URL`).
* Auto-update extensions (use Healthcheck: `HEALTHCHECKS_UPDATE_URL`) if `NC_EXT_UPDATE` is defined.
* Add [Full text search](https://apps.nextcloud.com/apps/fulltextsearch) support:
* Install [Tesseract](https://github.com/tesseract-ocr/tesseract) and [OCRmyPDF](https://ocrmypdf.readthedocs.io/en/latest/) for OCR.
* Run `occ:fulltextsearch:live` to auto index new contents.
Expand Down Expand Up @@ -48,6 +51,7 @@ You can use this container in a docker-compose.yml file:
restart: always
environment:
TZ: 'Europe/Paris'
HEALTHCHECKS_NC_URL: 'https://healthchecks.io/ping/c6ff4460-abc7-41ce-8e33-a671f17b9319'
volumes:
- /var/www:/var/www
expose:
Expand Down
File renamed without changes.
11 changes: 11 additions & 0 deletions 8.2-nextcloud/cron/cron_ext_update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

if [ -n "${NC_EXT_UPDATE}" ]; then
if [ -z "${HEALTHCHECKS_UPDATE_URL}" ]; then
php -f /var/www/occ app:update --all
else
curl -fsS -m 10 --retry 5 -o /dev/null ${HEALTHCHECKS_UPDATE_URL}/start && \
php -f /var/www/occ app:update --all && \
curl -fsS -m 10 --retry 5 -o /dev/null ${HEALTHCHECKS_UPDATE_URL}
fi
fi
9 changes: 9 additions & 0 deletions 8.2-nextcloud/cron/cron_nextcloud.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

if [ -z "${HEALTHCHECKS_NC_URL}" ]; then
php -f /var/www/cron.php
else
curl -fsS -m 10 --retry 5 -o /dev/null ${HEALTHCHECKS_NC_URL}/start && \
php -f /var/www/cron.php && \
curl -fsS -m 10 --retry 5 -o /dev/null ${HEALTHCHECKS_NC_URL}
fi
2 changes: 2 additions & 0 deletions 8.2-nextcloud/cron/www-data
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*/5 * * * * /cron_nextcloud.sh
5 4 * * * /cron_ext_update.sh

0 comments on commit 19953fa

Please sign in to comment.