Adjust CKAN for spotter-appmgr

This commit is contained in:
Disassembler 2018-03-25 22:55:15 +02:00
parent d44b5e7ba3
commit c054be6dac
Signed by: Disassembler
GPG Key ID: 524BD33A0EE29499
9 changed files with 19 additions and 34 deletions

View File

@ -41,7 +41,7 @@ RUN \
&& patch -p0 </srv/ckan-datapusher/ssl_verify.patch
VOLUME ["/etc/ckan-datapusher", "/srv/ckan-datapusher/data"]
EXPOSE 8004
EXPOSE 8080
USER ckan-datapusher
CMD ["uwsgi", "--plugin", "python", "--http-socket", "0.0.0.0:8004", "--wsgi-file", "/etc/ckan-datapusher/datapusher.wsgi", "--enable-threads"]
CMD ["uwsgi", "--plugin", "python", "--http-socket", "0.0.0.0:8080", "--wsgi-file", "/etc/ckan-datapusher/datapusher.wsgi", "--enable-threads"]

View File

@ -13,7 +13,7 @@ NAME = 'datapusher'
SQLALCHEMY_DATABASE_URI = 'sqlite:////srv/ckan-datapusher/data/jobs.db'
HOST = '0.0.0.0'
PORT = 8004
PORT = 8080
SSL_VERIFY = False
FROM_EMAIL = 'ckan@spotter.ngo'

11
ckan.sh
View File

@ -31,8 +31,7 @@ export CKAN_SECRET=$(head -c 18 /dev/urandom | base64)
export CKAN_UUID=$(cat /proc/sys/kernel/random/uuid)
envsubst <${SOURCE_DIR}/srv/ckan/conf/ckan.ini >/srv/ckan/conf/ckan.ini
cp ${SOURCE_DIR}/srv/ckan/conf/who.ini /srv/ckan/conf/who.ini
cp ${SOURCE_DIR}/srv/ckan/update-ip.sh /srv/ckan/update-ip.sh
/srv/ckan/update-ip.sh
cp ${SOURCE_DIR}/srv/ckan/update-url.sh /srv/ckan/update-url.sh
# Set "production values" (increases performance) only if the DEBUG environment variable is not set
if [ ${DEBUG:-0} -eq 0 ]; then
@ -58,12 +57,8 @@ cp ${SOURCE_DIR}/etc/init.d/ckan /etc/init.d/ckan
rc-update add ckan
service ckan start
# Create nginx app definition
cp ${SOURCE_DIR}/etc/nginx/conf.d/ckan.conf /etc/nginx/conf.d/ckan.conf
service nginx reload
# Install cron job
cp ${SOURCE_DIR}/etc/periodic/hourly/ckan /etc/periodic/hourly/ckan
# Add portal application definition
portal-app-manager ckan "https://{host}:8403/" "${CKAN_ADMIN_USER}" "${CKAN_ADMIN_PWD}"
# Add application definition
spotter-appmgr add-app ckan "https://ckan.{host}/" "${CKAN_ADMIN_USER}" "${CKAN_ADMIN_PWD}"

View File

@ -48,7 +48,7 @@ RUN \
&& rm -rf /root/.cache
VOLUME ["/etc/ckan", "/srv/ckan/storage"]
EXPOSE 8003
EXPOSE 8080
USER ckan
CMD ["paster", "serve", "/etc/ckan/ckan.ini"]

View File

@ -8,10 +8,6 @@ depend() {
after ckan-datapusher redis solr
}
start_pre() {
/srv/ckan/update-ip.sh
}
start() {
/usr/bin/docker run -d --rm \
--name ckan \
@ -22,12 +18,15 @@ start() {
--link redis \
--link solr \
--link ckan-datapusher \
-p 127.0.0.1:8003:8003 \
-v /srv/ckan/conf:/etc/ckan \
-v /srv/ckan/data:/srv/ckan/storage \
ckan
}
start_post() {
/usr/local/bin/spotter-appmgr update-hosts ckan
}
stop() {
/usr/bin/docker stop ckan
}

View File

@ -1,11 +0,0 @@
server {
listen [::]:8803 ipv6only=off;
listen [::]:8403 ssl http2 ipv6only=off;
access_log /var/log/nginx/ckan.access.log;
error_log /var/log/nginx/ckan.error.log;
location / {
proxy_pass http://127.0.0.1:8003;
}
}

View File

@ -19,7 +19,7 @@ debug = true
[server:main]
use = egg:Paste#http
host = 0.0.0.0
port = 8003
port = 8080
[app:main]
use = egg:ckan
@ -177,7 +177,7 @@ ckan.max_image_size = 10
# 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://ckan-datapusher:8004/
ckan.datapusher.url = http://ckan-datapusher:8080/
#ckan.datapusher.assume_task_stale_after = 3600
# Resource Proxy settings

View File

@ -1,4 +0,0 @@
#!/bin/sh
URL=$(ip route get 1 | awk '{print $NF;exit}')
sed -i "s|^ckan\.site_url.*|ckan.site_url = https://${URL}:8403|" /srv/ckan/conf/ckan.ini

View File

@ -0,0 +1,6 @@
#!/bin/sh
HOST="${1}"
[ "${2}" != "443" ] && HOST="${1}:${2}"
sed -i "s|^ckan\.site_url.*|ckan.site_url = https://${HOST}|" /srv/ckan/conf/ckan.ini