Skip to content

Commit

Permalink
Added logic to start background services only for the ckan worker con…
Browse files Browse the repository at this point in the history
…tainer and the web server only for ckan container
  • Loading branch information
MarkCalvert committed May 6, 2024
1 parent 152015d commit d31f9e9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 15 deletions.
1 change: 1 addition & 0 deletions ckan/Dockerfile.worker
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ARG CKAN_IMAGE
FROM ${CKAN_IMAGE}

ENV CKAN_WORKER=true
# Override the default CKAN config plugins to only use the ones we need for the worker
ENV CKAN__PLUGINS="dbca activity datastore xloader scheming_datasets qa archiver report doi datatables_view envvars"
RUN ckan config-tool $CKAN_INI "ckan.plugins = ${CKAN__PLUGINS}"
Expand Down
17 changes: 11 additions & 6 deletions ckan/setup/dbca_start_ckan.sh.override
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,17 @@ export CKAN__PLUGINS=$(grep '^ckan\.plugins' $APP_DIR/config/dbca.ini | cut -d'=

if [ $? -eq 0 ]
then
# Start supervisord
su ckan -c "supervisord --configuration /etc/supervisord.conf &"
# Start crond
/usr/sbin/crond
# Start uwsgi
su ckan -c 'uwsgi -i $APP_DIR/config/uwsgi.ini'
# if CKAN_WORKER is set to true, start the background services
if [ "$CKAN_WORKER" = "true" ]
then
# Start supervisord
su ckan -c "supervisord --configuration /etc/supervisord.conf"
# Start crond
/usr/sbin/crond
else
# Start uwsgi
su ckan -c 'uwsgi -i $APP_DIR/config/uwsgi.ini'
fi
else
echo "[prerun] failed...not starting CKAN."
fi
22 changes: 13 additions & 9 deletions ckan/setup/dbca_start_ckan_development.sh.override
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,18 @@ fi
# Set the CKAN plugins variable to the plugins value from the dbca.ini config file
export CKAN__PLUGINS=$(grep '^ckan\.plugins' $APP_DIR/config/dbca.ini | cut -d'=' -f2)

# Start supervisord
su ckan -c "supervisord --configuration /etc/supervisord.conf &"
# Start crond
/usr/sbin/crond

# Start the development server as the ckan user with automatic reload
if [ "$USE_HTTPS_FOR_DEV" = true ] ; then
su ckan -c "/usr/bin/ckan -c $CKAN_INI run -H 0.0.0.0 -C unsafe.cert -K unsafe.key"
# if CKAN_WORKER is set to true, start the background services
if [ "$CKAN_WORKER" = "true" ]
then
# Start crond
/usr/sbin/crond
# Start supervisord
su ckan -c "supervisord --configuration /etc/supervisord.conf"
else
su ckan -c "/usr/bin/ckan -c $CKAN_INI run -H 0.0.0.0"
# Start the development server as the ckan user with automatic reload
if [ "$USE_HTTPS_FOR_DEV" = true ] ; then
su ckan -c "/usr/bin/ckan -c $CKAN_INI run -H 0.0.0.0 -C unsafe.cert -K unsafe.key"
else
su ckan -c "/usr/bin/ckan -c $CKAN_INI run -H 0.0.0.0"
fi
fi

0 comments on commit d31f9e9

Please sign in to comment.