diff --git a/ckan-backend-dev/.env.example b/ckan-backend-dev/.env.example index f2d91d2dd..cfcaeb491 100644 --- a/ckan-backend-dev/.env.example +++ b/ckan-backend-dev/.env.example @@ -84,8 +84,8 @@ DATAPUSHER_REWRITE_RESOURCES=True DATAPUSHER_REWRITE_URL=http://ckan-dev:5000 # Extensions -CKAN__PLUGINS="image_view text_view webpage_view resource_proxy datatables_view datastore datapusher activity s3filestore scheming_datasets scheming_organizations scheming_groups harvest wri wri_harvester auth hierarchy_display hierarchy_form hierarchy_group_form issues envvars" -CKAN__VIEWS__DEFAULT_VIEWS="image_view text_view webpage_view datatables_view" +CKAN__PLUGINS=image_view text_view webpage_view resource_proxy datatables_view datastore datapusher activity s3filestore scheming_datasets scheming_organizations scheming_groups harvest wri wri_harvester auth hierarchy_display hierarchy_form hierarchy_group_form issues envvars +CKAN__VIEWS__DEFAULT_VIEWS=image_view text_view webpage_view datatables_view CKAN__HARVEST__MQ__TYPE=redis CKAN__HARVEST__MQ__HOSTNAME=redis CKAN__HARVEST__MQ__PORT=6379 diff --git a/ckan-backend-dev/ckan/Dockerfile.dev b/ckan-backend-dev/ckan/Dockerfile.dev index e6da9f203..72930adc0 100644 --- a/ckan-backend-dev/ckan/Dockerfile.dev +++ b/ckan-backend-dev/ckan/Dockerfile.dev @@ -127,14 +127,6 @@ COPY setup/supervisord.conf /etc/supervisord.conf COPY setup/supervisor.worker.conf /etc/supervisord.d/worker.conf COPY setup/supervisor.harvest.conf /etc/supervisord.d/harvest.conf -RUN SUPERVISOR_USER="root"; \ - SUPERVISOR_HOME="/tmp"; \ - sed -i "s|SUPERVISOR_USER|${SUPERVISOR_USER}|g" /etc/supervisord.d/harvest.conf && \ - sed -i "s|SUPERVISOR_HOME|${SUPERVISOR_HOME}|g" /etc/supervisord.d/harvest.conf && \ - sed -i "s|SUPERVISOR_USER|${SUPERVISOR_USER}|g" /etc/supervisord.d/worker.conf && \ - sed -i "s|SUPERVISOR_HOME|${SUPERVISOR_HOME}|g" /etc/supervisord.d/worker.conf && \ - sed -i "s|SUPERVISOR_HOME|${SUPERVISOR_HOME}|g" /etc/supervisord.conf - RUN chown -R ckan:ckan /etc/supervisord.d RUN chown -R ckan:ckan /etc/supervisord.conf diff --git a/ckan-backend-dev/ckan/setup/start_ckan_development.sh.override b/ckan-backend-dev/ckan/setup/start_ckan_development.sh.override index 1363037f5..70b3b8cc4 100755 --- a/ckan-backend-dev/ckan/setup/start_ckan_development.sh.override +++ b/ckan-backend-dev/ckan/setup/start_ckan_development.sh.override @@ -93,7 +93,27 @@ then done fi +# Check if we are running in GitHub Actions +if [ "$GITHUB_ACTIONS" = "true" ]; then + SUPERVISOR_USER='root' + SUPERVISOR_HOME='/tmp' +else + SUPERVISOR_USER='ckan' + SUPERVISOR_HOME='/srv/app' +fi + # Start supervisord +echo "===================================" +echo "SUPERVISOR_USER: $SUPERVISOR_USER" +echo "SUPERVISOR_HOME: $SUPERVISOR_HOME" +echo "===================================" + +sed -i "s|SUPERVISOR_USER|$SUPERVISOR_USER|g" /etc/supervisord.d/harvest.conf +sed -i "s|SUPERVISOR_HOME|$SUPERVISOR_HOME|g" /etc/supervisord.d/harvest.conf +sed -i "s|SUPERVISOR_USER|$SUPERVISOR_USER|g" /etc/supervisord.d/worker.conf +sed -i "s|SUPERVISOR_HOME|$SUPERVISOR_HOME|g" /etc/supervisord.d/worker.conf +sed -i "s|SUPERVISOR_HOME|$SUPERVISOR_HOME|g" /etc/supervisord.conf + supervisord --configuration /etc/supervisord.conf & # Start the development server with automatic reload diff --git a/ckan-backend-dev/docker-compose.test.yml b/ckan-backend-dev/docker-compose.test.yml index 6f1ca76be..1653d0001 100755 --- a/ckan-backend-dev/docker-compose.test.yml +++ b/ckan-backend-dev/docker-compose.test.yml @@ -9,7 +9,6 @@ volumes: services: ckan-dev: - user: "ckan" container_name: ${CKAN_CONTAINER_NAME} image: ${CKAN_IMAGE} environment: diff --git a/deployment/ckan/Dockerfile b/deployment/ckan/Dockerfile index 09be48d00..3c485dc58 100644 --- a/deployment/ckan/Dockerfile +++ b/deployment/ckan/Dockerfile @@ -71,7 +71,9 @@ RUN for d in $APP_DIR/patches/*; do \ USER ckan RUN cd ${APP_DIR}/src/ckanext-wri && pip3 install -r requirements.txt && pip3 install -r dev-requirements.txt && pip3 install -e . -RUN ckan config-tool ${CKAN_INI} "ckan.plugins = image_view text_view webpage_view resource_proxy datatables_view datastore datapusher activity s3filestore scheming_datasets scheming_organizations scheming_groups harvest wri wri_harvester auth hierarchy_display hierarchy_form hierarchy_group_form issues envvars" +ENV CKAN__PLUGINS image_view text_view webpage_view resource_proxy datatables_view datastore datapusher activity s3filestore scheming_datasets scheming_organizations scheming_groups harvest wri wri_harvester auth hierarchy_display issues envvars + +RUN ckan config-tool ${CKAN_INI} "ckan.plugins = ${CKAN__PLUGINS}" RUN ckan config-tool ${CKAN_INI} "ckan.auth.create_user_via_web = false" RUN ckan config-tool ${CKAN_INI} "ckan.root_path = /private-admin/{{LANG}}" @@ -87,16 +89,8 @@ COPY setup/supervisord.conf /etc/supervisord.conf COPY setup/supervisor.worker.conf /etc/supervisord.d/worker.conf COPY setup/supervisor.harvest.conf /etc/supervisord.d/harvest.conf -ENV SUPERVISOR_USER=root -ENV SUPERVISOR_HOME=/srv/app - -RUN sed -i "s|SUPERVISOR_USER|${SUPERVISOR_USER}|g" /etc/supervisord.d/harvest.conf && \ - sed -i "s|SUPERVISOR_HOME|${SUPERVISOR_HOME}|g" /etc/supervisord.d/harvest.conf && \ - sed -i "s|SUPERVISOR_USER|${SUPERVISOR_USER}|g" /etc/supervisord.d/worker.conf && \ - sed -i "s|SUPERVISOR_HOME|${SUPERVISOR_HOME}|g" /etc/supervisord.d/worker.conf && \ - sed -i "s|SUPERVISOR_HOME|${SUPERVISOR_HOME}|g" /etc/supervisord.conf - RUN chown -R ckan:ckan /etc/supervisord.d RUN chown -R ckan:ckan /etc/supervisord.conf USER ckan + diff --git a/deployment/ckan/setup/start_ckan.sh.override b/deployment/ckan/setup/start_ckan.sh.override old mode 100644 new mode 100755 index c57c9ed03..9e0e5dcef --- a/deployment/ckan/setup/start_ckan.sh.override +++ b/deployment/ckan/setup/start_ckan.sh.override @@ -1,4 +1,5 @@ #!/bin/bash + # Run the prerun script to init CKAN and create the default admin user python3 prerun.py @@ -30,6 +31,11 @@ echo "From GitHub Actions: $GITHUB_ACTIONS" # Check if we are running in GitHub Actions if [ "$GITHUB_ACTIONS" = "true" ]; then UWSGI_OPTS="$UWSGI_OPTS --single-interpreter --manage-script-name --mount /private-admin=/srv/app/wsgi.py" + SUPERVISOR_USER='root' + SUPERVISOR_HOME='/tmp' +else + SUPERVISOR_USER='ckan' + SUPERVISOR_HOME='/srv/app' fi echo "Starting CKAN with the following uwsgi options: $UWSGI_OPTS" @@ -38,6 +44,17 @@ export SCRIPT_NAME="/private-admin" if [ $? -eq 0 ] then # Start supervisord + echo "===================================" + echo "SUPERVISOR_USER: $SUPERVISOR_USER" + echo "SUPERVISOR_HOME: $SUPERVISOR_HOME" + echo "===================================" + + sed -i "s|SUPERVISOR_USER|$SUPERVISOR_USER|g" /etc/supervisord.d/harvest.conf + sed -i "s|SUPERVISOR_HOME|$SUPERVISOR_HOME|g" /etc/supervisord.d/harvest.conf + sed -i "s|SUPERVISOR_USER|$SUPERVISOR_USER|g" /etc/supervisord.d/worker.conf + sed -i "s|SUPERVISOR_HOME|$SUPERVISOR_HOME|g" /etc/supervisord.d/worker.conf + sed -i "s|SUPERVISOR_HOME|$SUPERVISOR_HOME|g" /etc/supervisord.conf + supervisord --configuration /etc/supervisord.conf & # Start uwsgi uwsgi $UWSGI_OPTS