diff --git a/docker/Dockerfile.cron b/docker/Dockerfile.cron new file mode 100644 --- /dev/null +++ b/docker/Dockerfile.cron @@ -0,0 +1,12 @@ +FROM swh/stack + +USER root + +RUN apt-get update && apt-get install -y cron + +COPY ./services/swh-web/refresh-savecodenow-statuses /usr/local/bin/ +COPY ./services/swh-web/refresh-savecodenow-statuses.cron /etc/cron.d/ + +RUN chmod 0755 /usr/local/bin/refresh-savecodenow-statuses && \ + chmod 0644 /etc/cron.d/refresh-savecodenow-statuses.cron && \ + crontab /etc/cron.d/refresh-savecodenow-statuses.cron diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -241,6 +241,20 @@ - "./conf/web.yml:/web.yml:ro" - "./services/swh-web/entrypoint.sh:/entrypoint.sh:ro" + swh-web-cron: + build: ./ + image: swh/cron + depends_on: + - swh-web + env_file: + - ./env/01-web-db.env + - ./env/02-web-db.env + environment: + SWH_CONFIG_FILENAME: /web.yml + entrypoint: ["cron", "-f"] + volumes: + - "./conf/web.yml:/web.yml:ro" + swh-deposit-db: image: postgres:12 env_file: diff --git a/docker/services/swh-web/refresh-savecodenow-statuses b/docker/services/swh-web/refresh-savecodenow-statuses new file mode 100644 --- /dev/null +++ b/docker/services/swh-web/refresh-savecodenow-statuses @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +export DJANGO_SETTINGS_MODULE=swh.web.settings.production + +/srv/softwareheritage/venv/bin/django-admin refresh_savecodenow_statuses diff --git a/docker/services/swh-web/refresh-savecodenow-statuses.cron b/docker/services/swh-web/refresh-savecodenow-statuses.cron new file mode 100644 --- /dev/null +++ b/docker/services/swh-web/refresh-savecodenow-statuses.cron @@ -0,0 +1 @@ +* * * * * (date ; /usr/local/bin/refresh-savecodenow-statuses) >> /var/log/refresh-statuses.log