Fix cronjobs by use scheduler

Schedule a recurring task to run at a specific time interval and check if gunicorn is running. Kill any gunicorn process with "gunicorn" or "pycsw.wsgi:application" in its name or command line.
This commit is contained in:
mjanez 2023-04-22 15:57:09 +02:00 committed by GitHub
parent e244a77296
commit f16a527002
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -49,7 +49,13 @@ PYCSW_URL=http://localhost/csw
# SCHEMAS: ckan2pycsw/model/dataset.py - Dataset type
PYCSW_CKAN_SCHEMA=iso19139_geodcatap
PYCSW_OUPUT_SCHEMA=iso19139_inspire
# ckan-pycsw schedule
## ckan2pycsw days between each scheduler job
PYCSW_CRON_DAYS_INTERVAL=2
# ckan2pycsw hour of start of the scheduler job (0-23)
PYCSW_CRON_HOUR_START=4
## Timezone
TZ=UTC
# CKAN databases
POSTGRES_USER=ckan
@ -87,7 +93,6 @@ CKAN_SMTP_STARTTLS=True
CKAN_SMTP_USER=user
CKAN_SMTP_PASSWORD=pass
CKAN_SMTP_MAIL_FROM=ckan@localhost
TZ=UTC
## Customize which text formats the text_view plugin will show
CKAN__PREVIEW__JSON_FORMATS="json jsonld"
# html htm rdf+xml owl+xml xml n3 n-triples turtle plain atom csv tsv rss txt json

View File

@ -12,10 +12,12 @@ ENV PYCSW_URL=http://localhost:${PYCSW_PORT}/
ENV DEV_MODE=False
ENV TIMEOUT=300
ENV PYCSW_CRON_DAYS_INTERVAL=2
ENV PYCSW_CRON_HOUR_START=4
WORKDIR ${APP_DIR}
COPY pycsw/conf/pycsw.conf.template pycsw/entrypoint.sh .
EXPOSE 8080/TCP
EXPOSE ${PYCSW_PORT}/TCP
ENTRYPOINT ["/bin/bash", "./entrypoint.sh"]
CMD ["pdm", "run", "python3", "-m", "gunicorn", "pycsw.wsgi:application", "-b", "0.0.0.0:${PYCSW_PORT}"]
CMD ["tail", "-f", "/dev/null"]