Skip to content

Update 01_setup_datapusher.sh#210

Open
saleemalharir1 wants to merge 1 commit into
ckan:masterfrom
saleemalharir1:patch-1
Open

Update 01_setup_datapusher.sh#210
saleemalharir1 wants to merge 1 commit into
ckan:masterfrom
saleemalharir1:patch-1

Conversation

@saleemalharir1
Copy link
Copy Markdown

Fix CKAN crash on startup when using DataPusher plugin

CKAN was failing to start when the datapusher plugin was enabled because the startup script (01_setup_datapusher.sh) attempted to generate an API token for the plugin before the sysadmin user had been created.

The original script assumed that the user specified by $CKAN_SYSADMIN_NAME already existed, and used that user to create a token for ckan.datapusher.api_token. On fresh installations, this user may not yet exist, causing the token generation to fail and CKAN to crash with:

Exception: Config option `ckan.datapusher.api_token` must be set to use the DataPusher.

This commit updates the script to:

  • Check if the sysadmin user exists using ckan user show
  • If not, create the user using ckan sysadmin add --force
  • Retry up to 10 times if the CKAN service is not ready yet
  • Generate the DataPusher token only after the user exists
  • Apply the token to the config using ckan config-tool

This makes the startup script more robust and ensures CKAN can successfully initialize with the DataPusher plugin enabled, even on a clean setup.

@kowh-ai kowh-ai self-assigned this Apr 3, 2025
graemediack added a commit to Atlantic-Salmon-Trust/ckan-docker that referenced this pull request Apr 28, 2025
@saleemalharir1
Copy link
Copy Markdown
Author

@kowh-ai can you please review the changes and accept it
since i don't want to maintain a fork of the official repo
thanks

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.

2 participants