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

Decouple datapusher from init scripts #32

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ckan-2.10/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ENV GIT_URL=https://github.com/ckan/ckan.git
ENV GIT_BRANCH=${CKAN_VERSION}
# Customize these on the .env file if needed
ENV CKAN_SITE_URL=http://localhost:5000
ENV CKAN__PLUGINS image_view text_view recline_view datastore datapusher envvars
ENV CKAN__PLUGINS image_view text_view recline_view datastore envvars

# UWSGI options
ENV UWSGI_HARAKIRI=50
Expand Down
15 changes: 7 additions & 8 deletions ckan-2.10/base/setup/start_ckan.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#!/bin/sh
#!/bin/bash

# Add ckan.datapusher.api_token to the CKAN config file (updated with corrected value later)
ckan config-tool $CKAN_INI ckan.datapusher.api_token=xxx
if [[ $CKAN__PLUGINS == *"datapusher"* ]]; then
# Add ckan.datapusher.api_token to the CKAN config file (updated with corrected value later)
echo "Setting a temporary value for ckan.datapusher.api_token"
ckan config-tool $CKAN_INI ckan.datapusher.api_token=xxx
fi

# Set up the Secret key used by Beaker and Flask
# This can be overriden using a CKAN___BEAKER__SESSION__SECRET env var
if grep -E "beaker.session.secret ?= ?$" ckan.ini
if grep -qE "beaker.session.secret ?= ?$" ckan.ini
then
echo "Setting beaker.session.secret in ini file"
ckan config-tool $CKAN_INI "beaker.session.secret=$(python3 -c 'import secrets; print(secrets.token_urlsafe())')"
Expand All @@ -18,9 +21,6 @@ fi
# Run the prerun script to init CKAN and create the default admin user
python3 prerun.py

echo "Set up ckan.datapusher.api_token in the CKAN config file"
ckan config-tool $CKAN_INI "ckan.datapusher.api_token=$(ckan -c $CKAN_INI user token add ckan_admin datapusher | tail -n 1 | tr -d '\t')"

# Run any startup scripts provided by images extending this one
if [[ -d "/docker-entrypoint.d" ]]
then
Expand All @@ -30,7 +30,6 @@ then
*.py) echo "$0: Running init file $f"; python3 "$f"; echo ;;
*) echo "$0: Ignoring $f (not an sh or py file)" ;;
esac
echo
done
fi

Expand Down
12 changes: 6 additions & 6 deletions ckan-2.10/dev/setup/start_ckan_development.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/bin/sh

if [[ $CKAN__PLUGINS == *"datapusher"* ]]; then
# Add ckan.datapusher.api_token to the CKAN config file (updated with corrected value later)
echo "Setting a temporary value for ckan.datapusher.api_token"
ckan config-tool $CKAN_INI ckan.datapusher.api_token=xxx
fi

# Install any local extensions in the src_extensions volume
echo "Looking for local extensions to install..."
echo "Extension dir contents:"
Expand Down Expand Up @@ -45,9 +51,6 @@ done
echo "Enabling debug mode"
ckan config-tool $CKAN_INI -s DEFAULT "debug = true"

# Add ckan.datapusher.api_token to the CKAN config file (updated with corrected value later)
ckan config-tool $CKAN_INI ckan.datapusher.api_token=xxx

# Set up the Secret key used by Beaker and Flask
# This can be overriden using a CKAN___BEAKER__SESSION__SECRET env var
if grep -E "beaker.session.secret ?= ?$" ckan.ini
Expand Down Expand Up @@ -76,9 +79,6 @@ ckan config-tool $SRC_DIR/ckan/test-core.ini \
# Run the prerun script to init CKAN and create the default admin user
python3 prerun.py

echo "Set up ckan.datapusher.api_token in the CKAN config file"
ckan config-tool $CKAN_INI "ckan.datapusher.api_token=$(ckan -c $CKAN_INI user token add ckan_admin datapusher | tail -n 1 | tr -d '\t')"

# Run any startup scripts provided by images extending this one
if [[ -d "/docker-entrypoint.d" ]]
then
Expand Down
2 changes: 1 addition & 1 deletion ckan-2.9/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ENV GIT_URL=https://github.com/ckan/ckan.git
ENV GIT_BRANCH=${CKAN_VERSION}
# Customize these on the .env file if needed
ENV CKAN_SITE_URL=http://localhost:5000
ENV CKAN__PLUGINS image_view text_view recline_view datastore datapusher envvars
ENV CKAN__PLUGINS image_view text_view recline_view datastore envvars

# UWSGI options
ENV UWSGI_HARAKIRI=50
Expand Down