From 923b794cc688dfce891a1e6f4c1b6b519c91b8b5 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Fri, 13 Mar 2020 20:10:24 +0100 Subject: [PATCH] Make CKAN SPOC-compatible --- lxc-apps/ckan/app | 50 ++++++++++++++++++ ...tapusher.lxcfile => ckan-datapusher.image} | 10 ++-- .../ckan-datapusher.image.d/bin/add-ca-cert | 7 +++ .../run | 0 .../ckan/ckan-datapusher.lxc/bin/add-ca-cert | 4 -- lxc-apps/ckan/{ckan.lxcfile => ckan.image} | 13 ++--- .../etc/crontabs/ckan | 0 .../etc/services.d/.s6-svscan/finish | 0 .../etc/services.d/ckan/run | 0 .../etc/services.d/cron/run | 0 lxc-apps/ckan/meta | 51 ------------------- 11 files changed, 65 insertions(+), 70 deletions(-) create mode 100644 lxc-apps/ckan/app rename lxc-apps/ckan/{ckan-datapusher.lxcfile => ckan-datapusher.image} (74%) create mode 100755 lxc-apps/ckan/ckan-datapusher.image.d/bin/add-ca-cert rename lxc-apps/ckan/{ckan-datapusher.lxc => ckan-datapusher.image.d}/run (100%) mode change 100644 => 100755 delete mode 100755 lxc-apps/ckan/ckan-datapusher.lxc/bin/add-ca-cert rename lxc-apps/ckan/{ckan.lxcfile => ckan.image} (83%) rename lxc-apps/ckan/{ckan.lxc => ckan.image.d}/etc/crontabs/ckan (100%) rename lxc-apps/ckan/{ckan.lxc => ckan.image.d}/etc/services.d/.s6-svscan/finish (100%) rename lxc-apps/ckan/{ckan.lxc => ckan.image.d}/etc/services.d/ckan/run (100%) rename lxc-apps/ckan/{ckan.lxc => ckan.image.d}/etc/services.d/cron/run (100%) delete mode 100644 lxc-apps/ckan/meta diff --git a/lxc-apps/ckan/app b/lxc-apps/ckan/app new file mode 100644 index 0000000..75b9539 --- /dev/null +++ b/lxc-apps/ckan/app @@ -0,0 +1,50 @@ +{ + "version": "2.8.3-200313", + "meta": { + "title": "CKAN", + "desc-cs": "DatovĂ˝ sklad", + "desc-en": "Data store", + "license": "GPL" + }, + "containers": { + "ckan": { + "image": "ckan_2.8.3-200313", + "depends": [ + "ckan-datapusher", + "ckan-redis", + "ckan-solr", + "ckan-postgres" + ], + "mounts": { + "ckan/ckan_conf": "etc/ckan", + "ckan/ckan_data": "srv/ckan/storage" + } + }, + "ckan-datapusher": { + "image": "ckan-datapusher_0.0.13-190620", + "mounts": { + "ckan/datapusher_conf": "etc/ckan-datapusher", + "ckan/datapusher_data": "srv/ckan-datapusher/data" + } + }, + "ckan-redis": { + "image": "redis_4.0.12-190620", + "mounts": { + "ckan/redis_conf/redis.conf": "etc/redis.conf:file", + "ckan/redis_data": "var/lib/redis" + } + }, + "ckan-solr": { + "image": "solr6_6.5.1-190620", + "mounts": { + "ckan/solr_data": "var/lib/solr" + } + }, + "ckan-postgres": { + "image": "postgis_2.5.1-190620", + "mounts": { + "ckan/postgres_data": "var/lib/postgresql" + } + } + } +} diff --git a/lxc-apps/ckan/ckan-datapusher.lxcfile b/lxc-apps/ckan/ckan-datapusher.image similarity index 74% rename from lxc-apps/ckan/ckan-datapusher.lxcfile rename to lxc-apps/ckan/ckan-datapusher.image index 6eee49f..9fd74f5 100644 --- a/lxc-apps/ckan/ckan-datapusher.lxcfile +++ b/lxc-apps/ckan/ckan-datapusher.image @@ -1,5 +1,5 @@ IMAGE ckan-datapusher_0.0.13-190620 -FROM alpine3.9-python2.7_2.7.16-190620 +FROM alpine3.11-python2.7_2.7.16-200313 RUN EOF # Install runtime dependencies @@ -14,10 +14,6 @@ RUN EOF pip install -U setuptools pip install -e 'git+https://github.com/ckan/datapusher.git#egg=datapusher' - # Hackfix the X509_STORE_CTX wrapper - sed -i 's/\[security\]//' /srv/ckan-datapusher/src/datapusher/requirements.txt - pip install -r /srv/ckan-datapusher/src/datapusher/requirements.txt - # Create OS user addgroup -S -g 8080 ckandp adduser -S -u 8080 -h /srv/ckan-datapusher -s /bin/false -g ckandp -G ckandp ckandp @@ -29,6 +25,6 @@ RUN EOF rm -rf /root/.cache EOF -COPY ckan-datapusher.lxc +COPY ckan-datapusher.image.d -CMD execlineb -P /run +CMD /bin/execlineb -P /run diff --git a/lxc-apps/ckan/ckan-datapusher.image.d/bin/add-ca-cert b/lxc-apps/ckan/ckan-datapusher.image.d/bin/add-ca-cert new file mode 100755 index 0000000..ea933c4 --- /dev/null +++ b/lxc-apps/ckan/ckan-datapusher.image.d/bin/add-ca-cert @@ -0,0 +1,7 @@ +#!/usr/bin/python3 + +import ssl + +cert = ssl.get_server_certificate(('host', 443)) +with open('/usr/lib/python3.8/site-packages/certifi/cacert.pem', 'a') as f: + f.write(cert) diff --git a/lxc-apps/ckan/ckan-datapusher.lxc/run b/lxc-apps/ckan/ckan-datapusher.image.d/run old mode 100644 new mode 100755 similarity index 100% rename from lxc-apps/ckan/ckan-datapusher.lxc/run rename to lxc-apps/ckan/ckan-datapusher.image.d/run diff --git a/lxc-apps/ckan/ckan-datapusher.lxc/bin/add-ca-cert b/lxc-apps/ckan/ckan-datapusher.lxc/bin/add-ca-cert deleted file mode 100755 index 565c302..0000000 --- a/lxc-apps/ckan/ckan-datapusher.lxc/bin/add-ca-cert +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -/bin/cat /etc/ssl/services.pem >>/usr/lib/python2.7/site-packages/requests/cacert.pem -/bin/cat /etc/ssl/services.pem >>/usr/lib/python2.7/site-packages/certifi/cacert.pem diff --git a/lxc-apps/ckan/ckan.lxcfile b/lxc-apps/ckan/ckan.image similarity index 83% rename from lxc-apps/ckan/ckan.lxcfile rename to lxc-apps/ckan/ckan.image index cfb109e..e761a74 100644 --- a/lxc-apps/ckan/ckan.lxcfile +++ b/lxc-apps/ckan/ckan.image @@ -1,22 +1,19 @@ -IMAGE ckan_2.8.2-190620 -FROM alpine3.9-python2.7_2.7.16-190620 +IMAGE ckan_2.8.3-200313 +FROM alpine3.11-python2.7_2.7.16-200313 RUN EOF # Install runtime dependencies - apk --no-cache add geos@vm libjpeg-turbo libmagic libpq mailcap py2-pip zlib + apk --no-cache add geos libjpeg-turbo libmagic libpq mailcap py2-pip zlib # Install build dependencies apk --no-cache add --virtual .deps build-base git libjpeg-turbo-dev libxml2-dev libxslt-dev postgresql-dev python2-dev zlib-dev - # Hackfix for python find_library('c') call - ln -s /lib/ld-musl-x86_64.so.1 /lib/libc.so.1 - # Install CKAN mkdir -p /srv/ckan cd /srv/ckan pip install -U setuptools pip install flask-debugtoolbar - pip install -e 'git+https://github.com/ckan/ckan.git#egg=ckan' + pip install -e 'git+https://github.com/ckan/ckan.git@8e1cc60b2fa11da6843051678b7ee2cc08c2a7a9#egg=ckan' pip install -r /srv/ckan/src/ckan/requirements-py2.txt # Install CKAN extensions @@ -42,6 +39,6 @@ RUN EOF rm -rf /root/.cache EOF -COPY ckan.lxc +COPY ckan.image.d CMD /bin/s6-svscan /etc/services.d diff --git a/lxc-apps/ckan/ckan.lxc/etc/crontabs/ckan b/lxc-apps/ckan/ckan.image.d/etc/crontabs/ckan similarity index 100% rename from lxc-apps/ckan/ckan.lxc/etc/crontabs/ckan rename to lxc-apps/ckan/ckan.image.d/etc/crontabs/ckan diff --git a/lxc-apps/ckan/ckan.lxc/etc/services.d/.s6-svscan/finish b/lxc-apps/ckan/ckan.image.d/etc/services.d/.s6-svscan/finish similarity index 100% rename from lxc-apps/ckan/ckan.lxc/etc/services.d/.s6-svscan/finish rename to lxc-apps/ckan/ckan.image.d/etc/services.d/.s6-svscan/finish diff --git a/lxc-apps/ckan/ckan.lxc/etc/services.d/ckan/run b/lxc-apps/ckan/ckan.image.d/etc/services.d/ckan/run similarity index 100% rename from lxc-apps/ckan/ckan.lxc/etc/services.d/ckan/run rename to lxc-apps/ckan/ckan.image.d/etc/services.d/ckan/run diff --git a/lxc-apps/ckan/ckan.lxc/etc/services.d/cron/run b/lxc-apps/ckan/ckan.image.d/etc/services.d/cron/run similarity index 100% rename from lxc-apps/ckan/ckan.lxc/etc/services.d/cron/run rename to lxc-apps/ckan/ckan.image.d/etc/services.d/cron/run diff --git a/lxc-apps/ckan/meta b/lxc-apps/ckan/meta deleted file mode 100644 index 9854cf2..0000000 --- a/lxc-apps/ckan/meta +++ /dev/null @@ -1,51 +0,0 @@ -{ - "version": "2.8.2-190620", - "meta": { - "title": "CKAN", - "desc-cs": "DatovĂ˝ sklad", - "desc-en": "Data store", - "license": "GPL" - }, - "containers": { - "ckan": { - "image": "ckan_2.8.2-190620", - "depends": [ - "ckan-datapusher", - "ckan-redis", - "ckan-solr", - "ckan-postgres" - ], - "mounts": [ - ["DIR", "/srv/ckan/ckan_conf", "/etc/ckan"], - ["DIR", "/srv/ckan/ckan_data", "/srv/ckan/storage"] - ] - }, - "ckan-datapusher": { - "image": "ckan-datapusher_0.0.13-190620", - "mounts": [ - ["FILE", "/etc/ssl/services.pem", "/etc/ssl/services.pem"], - ["DIR", "/srv/ckan/datapusher_conf", "/etc/ckan-datapusher"], - ["DIR", "/srv/ckan/datapusher_data", "/srv/ckan-datapusher/data"] - ] - }, - "ckan-redis": { - "image": "redis_4.0.12-190620", - "mounts": [ - ["FILE", "/srv/ckan/redis_conf/redis.conf", "/etc/redis.conf"], - ["DIR", "/srv/ckan/redis_data", "/var/lib/redis"] - ] - }, - "ckan-solr": { - "image": "solr6_6.5.1-190620", - "mounts": [ - ["DIR", "/srv/ckan/solr_data", "/var/lib/solr"] - ] - }, - "ckan-postgres": { - "image": "postgis_2.5.1-190620", - "mounts": [ - ["DIR", "/srv/ckan/postgres_data", "/var/lib/postgresql"] - ] - } - } -}