From a8e4dc63d35417ee31142076aff7fa94e658b678 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Tue, 28 Nov 2017 19:33:36 +0100 Subject: [PATCH] Adjust CKAN datapusher + datastore configuration, related to #148 --- 30-ckan.sh | 5 +---- ckan/etc/ckan/ckan.ini | 2 +- ckan/etc/ckan/datapusher.wsgi | 5 +++-- ckan/etc/ckan/datapusher_settings.py | 13 ++++++++----- ckan/etc/nginx/sites-available/ckan | 4 ++-- ckan/srv/ckan/update-ip.sh | 5 ++--- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/30-ckan.sh b/30-ckan.sh index 1b0701b..1e8956b 100755 --- a/30-ckan.sh +++ b/30-ckan.sh @@ -71,13 +71,10 @@ systemctl restart solr # Configure CKAN export CKAN_SECRET=$(head -c 18 /dev/urandom | base64) export CKAN_UUID=$(uuidgen -r) -export CKAN_DSJOB_SECRET=$(uuidgen -r) -export CKAN_DSJOB_USER=$(uuidgen -r) -export CKAN_DSJOB_PWD=$(uuidgen -r) mkdir /etc/ckan envsubst <${SOURCE_DIR}/ckan/etc/ckan/ckan.ini >/etc/ckan/ckan.ini -envsubst <${SOURCE_DIR}/ckan/etc/ckan/datapusher_settings.py >/etc/ckan/datapusher_settings.py cp ${SOURCE_DIR}/ckan/etc/ckan/datapusher.wsgi /etc/ckan/datapusher.wsgi +cp ${SOURCE_DIR}/ckan/etc/ckan/datapusher_settings.py /etc/ckan/datapusher_settings.py ln -s /srv/ckan/src/ckan/ckan/config/who.ini /etc/ckan/who.ini cp ${SOURCE_DIR}/ckan/srv/ckan/update-ip.sh /srv/ckan/update-ip.sh /srv/ckan/update-ip.sh diff --git a/ckan/etc/ckan/ckan.ini b/ckan/etc/ckan/ckan.ini index 4772f27..07c92c9 100644 --- a/ckan/etc/ckan/ckan.ini +++ b/ckan/etc/ckan/ckan.ini @@ -169,7 +169,7 @@ ckan.max_image_size = 2 # Make sure you have set up the DataStore ckan.datapusher.formats = csv xls xlsx tsv application/csv application/vnd.ms-excel application/vnd.openxmlformats-officedocument.spreadsheetml.sheet -ckan.datapusher.url = http://127.0.0.1 +ckan.datapusher.url = http://127.0.0.1:8098 #ckan.datapusher.assume_task_stale_after = 3600 # Resource Proxy settings diff --git a/ckan/etc/ckan/datapusher.wsgi b/ckan/etc/ckan/datapusher.wsgi index 5362167..08e0f12 100644 --- a/ckan/etc/ckan/datapusher.wsgi +++ b/ckan/etc/ckan/datapusher.wsgi @@ -6,8 +6,9 @@ activate_this = os.path.join('/srv/ckan/bin/activate_this.py') execfile(activate_this, dict(__file__=activate_this)) import ckanserviceprovider.web as web -import datapusher.jobs as jobs - os.environ['JOB_CONFIG'] = '/etc/ckan/datapusher_settings.py' web.init() + +import datapusher.jobs as jobs + application = web.app diff --git a/ckan/etc/ckan/datapusher_settings.py b/ckan/etc/ckan/datapusher_settings.py index e7a44b8..2f17757 100644 --- a/ckan/etc/ckan/datapusher_settings.py +++ b/ckan/etc/ckan/datapusher_settings.py @@ -1,17 +1,20 @@ #!/usr/bin/python +import uuid + DEBUG = False TESTING = False -SSL_VERIFY = False -SECRET_KEY = '${CKAN_DSJOB_SECRET}' -USERNAME = '${CKAN_DSJOB_USER}' -PASSWORD = '${CKAN_DSJOB_PWD}' +SECRET_KEY = str(uuid.uuid4()) +USERNAME = str(uuid.uuid4()) +PASSWORD = str(uuid.uuid4()) + NAME = 'datapusher' SQLALCHEMY_DATABASE_URI = 'sqlite:////var/lib/ckan/datapusher-jobs.db' HOST = '0.0.0.0' -PORT = 8004 +PORT = 8098 +SSL_VERIFY = False FROM_EMAIL = 'ckan@spotter.ngo' #ADMINS = ['yourname@example.com'] # where to send emails diff --git a/ckan/etc/nginx/sites-available/ckan b/ckan/etc/nginx/sites-available/ckan index f11cff4..5563040 100644 --- a/ckan/etc/nginx/sites-available/ckan +++ b/ckan/etc/nginx/sites-available/ckan @@ -14,8 +14,8 @@ server { } server { - listen 8004 ssl http2; - listen [::]:8004 ssl http2; + listen 127.0.0.1:8098; + listen [::1]:8098; access_log /var/log/nginx/ckan-datapusher.access.log; error_log /var/log/nginx/ckan-datapusher.error.log; diff --git a/ckan/srv/ckan/update-ip.sh b/ckan/srv/ckan/update-ip.sh index e43d51b..15216bd 100755 --- a/ckan/srv/ckan/update-ip.sh +++ b/ckan/srv/ckan/update-ip.sh @@ -1,5 +1,4 @@ #!/bin/sh -IP=$(ip route get 1 | awk '{print $NF;exit}') -sed -i "s|^ckan\.site_url.*|ckan.site_url = https://${IP}:8003|" /etc/ckan/ckan.ini -sed -i "s|^ckan\.datapusher\.url.*|ckan.datapusher.url = https://${IP}:8004|" /etc/ckan/ckan.ini +URL=$(ip route get 1 | awk '{print $NF;exit}') +sed -i "s|^ckan\.site_url.*|ckan.site_url = https://${URL}:8003|" /etc/ckan/ckan.ini