diff --git a/ckan-backend-dev/ckan/Dockerfile.dev b/ckan-backend-dev/ckan/Dockerfile.dev index 74b585b4c..0369dfe87 100644 --- a/ckan-backend-dev/ckan/Dockerfile.dev +++ b/ckan-backend-dev/ckan/Dockerfile.dev @@ -123,4 +123,10 @@ RUN ckan config-tool ${CKAN_INI} "ckan.root_path = /private-admin/{{LANG}}" COPY setup/who.ini ${APP_DIR}/src/ckan/who.ini +COPY setup/supervisord.conf /etc/supervisord.d/supervisord.conf +COPY setup/supervisor.worker.conf /etc/supervisord.d/worker.conf +COPY setup/supervisor.harvest.conf /etc/supervisord.d/harvest.conf + +RUN chown -R ckan:ckan /etc/supervisord.d + CMD ["sh", "-c", "${APP_DIR}/start_ckan_development.sh"] 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..7e00d445a 100755 --- a/ckan-backend-dev/ckan/setup/start_ckan_development.sh.override +++ b/ckan-backend-dev/ckan/setup/start_ckan_development.sh.override @@ -94,7 +94,7 @@ then fi # Start supervisord -supervisord --configuration /etc/supervisord.conf & +supervisord --configuration /etc/supervisord.d/supervisord.conf & # Start the development server with automatic reload ckan -c $CKAN_INI run -H 0.0.0.0 --prefix /private-admin \ No newline at end of file diff --git a/ckan-backend-dev/ckan/setup/supervisor.harvest.conf b/ckan-backend-dev/ckan/setup/supervisor.harvest.conf new file mode 100644 index 000000000..3efd1ae7b --- /dev/null +++ b/ckan-backend-dev/ckan/setup/supervisor.harvest.conf @@ -0,0 +1,26 @@ +[program:ckan-fetch] +command=ckan -c /srv/app/production.ini harvester fetch-consumer +priority=501 +autostart=true +autorestart=true +redirect_stderr=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stdout +stderr_logfile_maxbytes=0 +user=ckan +environment=HOME="/srv/app",USER="ckan" + + +[program:ckan-gather] +command=ckan -c /srv/app/production.ini harvester gather-consumer +priority=501 +autostart=true +autorestart=true +redirect_stderr=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stdout +stderr_logfile_maxbytes=0 +user=ckan +environment=HOME="/srv/app",USER="ckan" diff --git a/ckan-backend-dev/ckan/setup/supervisor.worker.conf b/ckan-backend-dev/ckan/setup/supervisor.worker.conf new file mode 100644 index 000000000..ce2353092 --- /dev/null +++ b/ckan-backend-dev/ckan/setup/supervisor.worker.conf @@ -0,0 +1,12 @@ +[program:ckan-worker] +command=ckan -c /srv/app/production.ini jobs worker +priority=501 +autostart=true +autorestart=true +redirect_stderr=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stdout +stderr_logfile_maxbytes=0 +user=ckan +environment=HOME="/srv/app",USER="ckan" diff --git a/ckan-backend-dev/ckan/setup/supervisord.conf b/ckan-backend-dev/ckan/setup/supervisord.conf new file mode 100644 index 000000000..8aca4eb14 --- /dev/null +++ b/ckan-backend-dev/ckan/setup/supervisord.conf @@ -0,0 +1,23 @@ +[unix_http_server] +file = /tmp/supervisor.sock +chmod = 0777 +chown = ckan:ckan + +[supervisord] +logfile = /tmp/supervisord.log +logfile_maxbytes = 50MB +logfile_backups=10 +loglevel = info +pidfile = /tmp/supervisord.pid +nodaemon = true +umask = 022 +identifier = supervisor + +[supervisorctl] +serverurl = unix:///tmp/supervisor.sock + +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + +[include] +files = /etc/supervisord.d/*.conf diff --git a/deployment/ckan/Dockerfile b/deployment/ckan/Dockerfile index 62c83246b..4da2227d7 100644 --- a/deployment/ckan/Dockerfile +++ b/deployment/ckan/Dockerfile @@ -71,7 +71,7 @@ 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 . -ENV CKAN__PLUGINS image_view text_view webpage_view resource_proxy datatables_view datastore datapusher activity s3filestore scheming_datasets scheming_organizations scheming_groups wri 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 hierarchy_form hierarchy_group_form 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" @@ -81,5 +81,12 @@ USER root RUN chown -R ckan:ckan ${APP_DIR}/src/ +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 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 index 99506d589..eb909762e 100755 --- a/deployment/ckan/setup/start_ckan.sh.override +++ b/deployment/ckan/setup/start_ckan.sh.override @@ -39,7 +39,7 @@ export SCRIPT_NAME="/private-admin" if [ $? -eq 0 ] then # Start supervisord - supervisord --configuration /etc/supervisord.conf & + supervisord --configuration /etc/supervisord.d/supervisord.conf & # Start uwsgi uwsgi $UWSGI_OPTS else diff --git a/deployment/ckan/setup/start_ckan_development.sh.override b/deployment/ckan/setup/start_ckan_development.sh.override index cb5a3c275..15887be13 100755 --- a/deployment/ckan/setup/start_ckan_development.sh.override +++ b/deployment/ckan/setup/start_ckan_development.sh.override @@ -93,7 +93,7 @@ then fi # Start supervisord -supervisord --configuration /etc/supervisord.conf & +supervisord --configuration /etc/supervisord.d/supervisord.conf & # Start the development server with automatic reload sudo -u ckan -EH ckan -c $CKAN_INI run -H 0.0.0.0 --prefix /private-admin \ No newline at end of file diff --git a/deployment/ckan/setup/supervisor.harvest.conf b/deployment/ckan/setup/supervisor.harvest.conf new file mode 100644 index 000000000..3efd1ae7b --- /dev/null +++ b/deployment/ckan/setup/supervisor.harvest.conf @@ -0,0 +1,26 @@ +[program:ckan-fetch] +command=ckan -c /srv/app/production.ini harvester fetch-consumer +priority=501 +autostart=true +autorestart=true +redirect_stderr=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stdout +stderr_logfile_maxbytes=0 +user=ckan +environment=HOME="/srv/app",USER="ckan" + + +[program:ckan-gather] +command=ckan -c /srv/app/production.ini harvester gather-consumer +priority=501 +autostart=true +autorestart=true +redirect_stderr=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stdout +stderr_logfile_maxbytes=0 +user=ckan +environment=HOME="/srv/app",USER="ckan" diff --git a/deployment/ckan/setup/supervisor.worker.conf b/deployment/ckan/setup/supervisor.worker.conf new file mode 100644 index 000000000..ce2353092 --- /dev/null +++ b/deployment/ckan/setup/supervisor.worker.conf @@ -0,0 +1,12 @@ +[program:ckan-worker] +command=ckan -c /srv/app/production.ini jobs worker +priority=501 +autostart=true +autorestart=true +redirect_stderr=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stdout +stderr_logfile_maxbytes=0 +user=ckan +environment=HOME="/srv/app",USER="ckan" diff --git a/deployment/ckan/setup/supervisord.conf b/deployment/ckan/setup/supervisord.conf new file mode 100644 index 000000000..8aca4eb14 --- /dev/null +++ b/deployment/ckan/setup/supervisord.conf @@ -0,0 +1,23 @@ +[unix_http_server] +file = /tmp/supervisor.sock +chmod = 0777 +chown = ckan:ckan + +[supervisord] +logfile = /tmp/supervisord.log +logfile_maxbytes = 50MB +logfile_backups=10 +loglevel = info +pidfile = /tmp/supervisord.pid +nodaemon = true +umask = 022 +identifier = supervisor + +[supervisorctl] +serverurl = unix:///tmp/supervisor.sock + +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + +[include] +files = /etc/supervisord.d/*.conf