Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cron): Run harvester cron job in background (run and clean up log… #71

Merged
merged 4 commits into from
Jun 10, 2024

Conversation

hcvdwerf
Copy link

@hcvdwerf hcvdwerf commented Jun 7, 2024

  • harvester run and cleanup log in background
  • Create entrypoint script to export environment variables to /etc/profile.d/custom_env.sh
  • Update crontab to source environment variables from custom_env.sh
  • Start cron daemon in background and tail cron log to keep container running
  • Ensure CKAN cron jobs have necessary environment context

Closes #67

…ging)

- Create entrypoint script to export environment variables to /etc/profile.d/custom_env.sh
- Update crontab to source environment variables from custom_env.sh
- Start cron daemon in background and tail cron log to keep container running
- Ensure CKAN cron jobs have necessary environment context

Closes #67
@hcvdwerf hcvdwerf linked an issue Jun 7, 2024 that may be closed by this pull request
1 task
@@ -47,4 +59,4 @@ RUN for d in $APP_DIR/patches/*; do \
fi ; \
done

ENV CKAN__PLUGINS="envvars image_view text_view recline_view scheming_datasets scheming_organizations gdi_userportal dcat harvest ckan_harvester dcat_rdf_harvester dcat_json_harvester dcat_json_interface oidc_pkce fairdatapointharvester activity"
ENV CKAN__PLUGINS="envvars image_view text_view recline_view scheming_datasets scheming_organizations gdi_userportal dcat harvest ckan_harvester dcat_rdf_harvester dcat_json_harvester dcat_json_interface oidc_pkce fairdatapointharvester activity"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this missing a newline at the end of the file?

ckan/config/ckan_harvesting.conf Outdated Show resolved Hide resolved
stderr_logfile=/var/log/cron.log
autostart=true
autorestart=true
startsecs=10
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing newline at end of file?

BASH_ENV=/etc/profile.d/custom_env.sh

# Every 15 minutes, run the harvester and clean the harvest log every day at 5am
*/15 * * * * /usr/bin/ckan -c /srv/app/ckan.ini harvester run
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do/can this be configurable through an environment flag?

#!/bin/sh

# Dump environment variables to a file that will be sourced by cron
printenv | sed 's/^\(.*\)$/export \1/g' > /etc/profile.d/custom_env.sh
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing newline at end of file?

Copy link

@kburger kburger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

sonarcloud bot commented Jun 10, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@hcvdwerf hcvdwerf merged commit d5d8218 into main Jun 10, 2024
2 checks passed
@hcvdwerf hcvdwerf deleted the 67-gdi-ckan-harvesters-are-not-running branch June 10, 2024 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[gdi - ckan] Harvesters are not running
2 participants