Shorten CKAN Datapusher handle
This commit is contained in:
parent
551d71750a
commit
d1a7c4922b
@ -1,17 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/ckan-datapusher
|
||||
|
||||
# Build Docker container
|
||||
docker build -t ckan-datapusher ${SOURCE_DIR}
|
||||
|
||||
# Configure CKAN DataPusher
|
||||
mkdir -p /srv/ckan-datapusher/conf /srv/ckan-datapusher/data
|
||||
cp ${SOURCE_DIR}/srv/ckan-datapusher/conf/datapusher.wsgi /srv/ckan-datapusher/conf/datapusher.wsgi
|
||||
cp ${SOURCE_DIR}/srv/ckan-datapusher/conf/datapusher_settings.py /srv/ckan-datapusher/conf/datapusher_settings.py
|
||||
chown -R 8004:8004 /srv/ckan-datapusher/data
|
||||
|
||||
# Configure CKAN DataPusher service
|
||||
cp ${SOURCE_DIR}/etc/init.d/ckan-datapusher /etc/init.d/ckan-datapusher
|
||||
rc-update add ckan-datapusher
|
||||
service ckan-datapusher start
|
@ -1,21 +0,0 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
description="CKAN DataPusher docker container"
|
||||
|
||||
depend() {
|
||||
need docker net
|
||||
use dns logger netmount
|
||||
}
|
||||
|
||||
start() {
|
||||
/usr/bin/docker run -d --rm \
|
||||
--name ckan-datapusher \
|
||||
-h ckan-datapusher \
|
||||
-v /srv/ckan-datapusher/conf:/etc/ckan-datapusher \
|
||||
-v /srv/ckan-datapusher/data:/srv/ckan-datapusher/data \
|
||||
ckan-datapusher
|
||||
}
|
||||
|
||||
stop() {
|
||||
/usr/bin/docker stop ckan-datapusher
|
||||
}
|
2
ckan.sh
2
ckan.sh
@ -3,7 +3,7 @@
|
||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/ckan
|
||||
|
||||
# Check prerequisites
|
||||
docker image ls | grep -q ckan-datapusher || $(realpath $(dirname "${0}"))/ckan-datapusher.sh
|
||||
docker image ls | grep -q ckandp || $(realpath $(dirname "${0}"))/ckandp.sh
|
||||
docker image ls | grep -q postfix || $(realpath $(dirname "${0}"))/postfix.sh
|
||||
docker image ls | grep -q postgres || $(realpath $(dirname "${0}"))/postgres.sh
|
||||
docker image ls | grep -q redis || $(realpath $(dirname "${0}"))/redis.sh
|
||||
|
@ -5,14 +5,14 @@ description="CKAN docker container"
|
||||
depend() {
|
||||
need docker net postgres
|
||||
use dns logger netmount postfix
|
||||
after ckan-datapusher redis solr
|
||||
after ckandp redis solr
|
||||
}
|
||||
|
||||
start() {
|
||||
/usr/bin/docker run -d --rm \
|
||||
--name ckan \
|
||||
-h ckan \
|
||||
--link ckan-datapusher \
|
||||
--link ckandp \
|
||||
--link postfix \
|
||||
--link postgres \
|
||||
--link redis \
|
||||
|
@ -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:8080/
|
||||
ckan.datapusher.url = http://ckandp:8080/
|
||||
#ckan.datapusher.assume_task_stale_after = 3600
|
||||
|
||||
# Resource Proxy settings
|
||||
|
17
ckandp.sh
Executable file
17
ckandp.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/ckandp
|
||||
|
||||
# Build Docker container
|
||||
docker build -t ckandp ${SOURCE_DIR}
|
||||
|
||||
# Configure CKAN DataPusher
|
||||
mkdir -p /srv/ckandp/conf /srv/ckandp/data
|
||||
cp ${SOURCE_DIR}/srv/ckandp/conf/datapusher.wsgi /srv/ckandp/conf/datapusher.wsgi
|
||||
cp ${SOURCE_DIR}/srv/ckandp/conf/datapusher_settings.py /srv/ckandp/conf/datapusher_settings.py
|
||||
chown -R 8004:8004 /srv/ckandp/data
|
||||
|
||||
# Configure CKAN DataPusher service
|
||||
cp ${SOURCE_DIR}/etc/init.d/ckandp /etc/init.d/ckandp
|
||||
rc-update add ckandp
|
||||
service ckandp start
|
@ -17,24 +17,24 @@ RUN \
|
||||
# Install build dependencies
|
||||
apk --no-cache add --virtual .deps build-base git libffi-dev libressl-dev libxml2-dev libxslt-dev py2-pip python2-dev \
|
||||
# Install CKAN DataPusher
|
||||
&& mkdir -p /srv/ckan-datapusher \
|
||||
&& cd /srv/ckan-datapusher \
|
||||
&& mkdir -p /srv/ckandp \
|
||||
&& cd /srv/ckandp \
|
||||
&& 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 \
|
||||
&& sed -i 's/\[security\]//' /srv/ckandp/src/datapusher/requirements.txt \
|
||||
&& pip install -r /srv/ckandp/src/datapusher/requirements.txt \
|
||||
# Create OS user
|
||||
&& addgroup -S -g 8004 ckan-datapusher \
|
||||
&& adduser -S -u 8004 -h /srv/ckan-datapusher -s /bin/false -g ckan-datapusher -G ckan-datapusher ckan-datapusher \
|
||||
&& chown -R ckan-datapusher:ckan-datapusher /srv/ckan-datapusher \
|
||||
&& addgroup -S -g 8004 ckandp \
|
||||
&& adduser -S -u 8004 -h /srv/ckandp -s /bin/false -g ckandp -G ckandp ckandp \
|
||||
&& chown -R ckandp:ckandp /srv/ckandp \
|
||||
# Cleanup
|
||||
&& apk --no-cache del .deps \
|
||||
&& find /srv/ckan-datapusher/src -name '.git*' -exec rm -rf {} + \
|
||||
&& find /srv/ckandp/src -name '.git*' -exec rm -rf {} + \
|
||||
&& rm -rf /root/.cache
|
||||
|
||||
VOLUME ["/etc/ckan-datapusher", "/srv/ckan-datapusher/data"]
|
||||
VOLUME ["/etc/ckandp", "/srv/ckandp/data"]
|
||||
EXPOSE 8080
|
||||
|
||||
USER ckan-datapusher
|
||||
CMD ["uwsgi", "--plugin", "python", "--http-socket", "0.0.0.0:8080", "--wsgi-file", "/etc/ckan-datapusher/datapusher.wsgi", "--enable-threads"]
|
||||
USER ckandp
|
||||
CMD ["uwsgi", "--plugin", "python", "--http-socket", "0.0.0.0:8080", "--wsgi-file", "/etc/ckandp/datapusher.wsgi", "--enable-threads"]
|
21
ckandp/etc/init.d/ckandp
Executable file
21
ckandp/etc/init.d/ckandp
Executable file
@ -0,0 +1,21 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
description="CKAN DataPusher docker container"
|
||||
|
||||
depend() {
|
||||
need docker net
|
||||
use dns logger netmount
|
||||
}
|
||||
|
||||
start() {
|
||||
/usr/bin/docker run -d --rm \
|
||||
--name ckandp \
|
||||
-h ckandp \
|
||||
-v /srv/ckandp/conf:/etc/ckandp \
|
||||
-v /srv/ckandp/data:/srv/ckandp/data \
|
||||
ckandp
|
||||
}
|
||||
|
||||
stop() {
|
||||
/usr/bin/docker stop ckandp
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
import os
|
||||
import ckanserviceprovider.web as web
|
||||
|
||||
os.environ['JOB_CONFIG'] = '/etc/ckan-datapusher/datapusher_settings.py'
|
||||
os.environ['JOB_CONFIG'] = '/etc/ckandp/datapusher_settings.py'
|
||||
web.init()
|
||||
|
||||
import datapusher.jobs as jobs
|
@ -10,7 +10,7 @@ PASSWORD = str(uuid.uuid4())
|
||||
|
||||
NAME = 'datapusher'
|
||||
|
||||
SQLALCHEMY_DATABASE_URI = 'sqlite:////srv/ckan-datapusher/data/jobs.db'
|
||||
SQLALCHEMY_DATABASE_URI = 'sqlite:////srv/ckandp/data/jobs.db'
|
||||
|
||||
HOST = '0.0.0.0'
|
||||
PORT = 8080
|
Loading…
Reference in New Issue
Block a user