Add crontab to project

Cron will likely be a duplicate compose service with a different
command.
This commit is contained in:
Jake Howard 2022-08-20 20:48:27 +01:00
parent 2fe0960623
commit 10b32da3e0
Signed by: jake
GPG key ID: 57AFB45680EDD477
4 changed files with 16 additions and 1 deletions

View file

@ -132,3 +132,12 @@ pip_tools:
- ./scripts/compile-requirements.sh - ./scripts/compile-requirements.sh
- git diff - git diff
- git diff-index --quiet HEAD -- - git diff-index --quiet HEAD --
crontab:
image: alpine
stage: test
dependencies: []
before_script:
- apk add --no-cache supercronic
script:
- supercronic -test etc/crontab

View file

@ -17,6 +17,8 @@ RUN useradd website --create-home -u 1000 && mkdir /app $VIRTUAL_ENV && chown -R
WORKDIR /app WORKDIR /app
RUN wget https://github.com/aptible/supercronic/releases/download/v0.2.1/supercronic-linux-amd64 -O /usr/local/bin/supercronic && chmod +x /usr/local/bin/supercronic
ENV PATH=${POETRY_HOME}/bin:$VIRTUAL_ENV/bin:$PATH \ ENV PATH=${POETRY_HOME}/bin:$VIRTUAL_ENV/bin:$PATH \
PYTHONUNBUFFERED=1 PYTHONUNBUFFERED=1

4
etc/crontab Normal file
View file

@ -0,0 +1,4 @@
@weekly ./manage.py update_index
@daily ./manage.py clearsessions
@daily ./manage.py update_unsplash_photos
*/10 * * * * ./manage.py publish_scheduled_pages

View file

@ -163,7 +163,7 @@ WAGTAIL_SITE_NAME = "website"
WAGTAILSEARCH_BACKENDS = { WAGTAILSEARCH_BACKENDS = {
"default": { "default": {
"BACKEND": "wagtail.search.backends.database", "BACKEND": "wagtail.search.backends.database",
"AUTO_UPDATE": DEBUG, "AUTO_UPDATE": True,
"ATOMIC_REBUILD": True, "ATOMIC_REBUILD": True,
} }
} }