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
- git diff
- 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
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 \
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 = {
"default": {
"BACKEND": "wagtail.search.backends.database",
"AUTO_UPDATE": DEBUG,
"AUTO_UPDATE": True,
"ATOMIC_REBUILD": True,
}
}