Alpinize + Dockerize CKAN DataPusher
This commit is contained in:
parent
2b63a7a17d
commit
fc74de15b2
@ -64,5 +64,5 @@ vi 00-install.sh
|
||||
| Solr | 8983 | N/A |
|
||||
| Sahana | 8001 | 8401 |
|
||||
| CKAN | 8003 | 8403 |
|
||||
| CKAN Datapusher | 8004 | 8404 |
|
||||
| CKAN Datapusher | 8004 | N/A |
|
||||
| OpenMapKit | 8007 | 8407 |
|
||||
|
25
ckan-datapusher.sh
Executable file
25
ckan-datapusher.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
SOURCE_DIR=${SOURCE_DIR}/ckan-datapusher
|
||||
|
||||
# Build Docker container
|
||||
docker build -t ckan-datapusher ${SOURCE_DIR}
|
||||
|
||||
# Configure CKAN DataPusher
|
||||
mkdir -p /srv/ckan-datapusher/conf
|
||||
mkdir /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 boot
|
||||
service ckan-datapusher start
|
||||
|
||||
# Create nginx app definition
|
||||
cp ${SOURCE_DIR}/etc/nginx/apps/ckan-datapusher /etc/nginx/apps/ckan-datapusher
|
||||
cp ${SOURCE_DIR}/etc/nginx/conf.d/ckan-datapusher.conf /etc/nginx/conf.d/ckan-datapusher.conf
|
||||
|
||||
# Reload nginx configuration
|
||||
service nginx reload
|
27
ckan-datapusher/Dockerfile
Normal file
27
ckan-datapusher/Dockerfile
Normal file
@ -0,0 +1,27 @@
|
||||
FROM alpine:3.7
|
||||
MAINTAINER Disassembler <disassembler@dasm.cz>
|
||||
|
||||
RUN apk --no-cache add python2
|
||||
|
||||
RUN apk --no-cache add libxml2 libxslt
|
||||
|
||||
RUN apk --no-cache add libffi libressl libxml2 libxslt uwsgi-python \
|
||||
&& apk --no-cache add --virtual .deps build-base git libffi-dev libressl-dev libxml2-dev libxslt-dev py2-pip python2-dev \
|
||||
&& mkdir -p /srv/ckan-datapusher \
|
||||
&& cd /srv/ckan-datapusher \
|
||||
&& pip install -U setuptools \
|
||||
&& pip install -e 'git+https://github.com/ckan/datapusher.git#egg=datapusher' \
|
||||
&& pip install -r /srv/ckan-datapusher/src/datapusher/requirements.txt \
|
||||
&& 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 \
|
||||
&& apk del .deps \
|
||||
&& find /srv/ckan-datapusher/src -name '.git*' -exec rm -rf {} + \
|
||||
&& rm -rf /root \
|
||||
&& mkdir /root
|
||||
|
||||
VOLUME ["/etc/ckan-datapusher", "/srv/ckan-datapusher/data"]
|
||||
EXPOSE 8004
|
||||
|
||||
USER ckan-datapusher
|
||||
CMD ["uwsgi", "--plugin", "python", "--http-socket", "0.0.0.0:8004", "--wsgi-file", "/etc/ckan-datapusher/datapusher.wsgi", "--enable-threads"]
|
16
ckan-datapusher/etc/init.d/ckan-datapusher
Executable file
16
ckan-datapusher/etc/init.d/ckan-datapusher
Executable file
@ -0,0 +1,16 @@
|
||||
#!/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 -p 127.0.0.1:9004:8004 -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
|
||||
}
|
9
ckan-datapusher/etc/nginx/apps/ckan-datapusher
Normal file
9
ckan-datapusher/etc/nginx/apps/ckan-datapusher
Normal file
@ -0,0 +1,9 @@
|
||||
access_log /var/log/nginx/ckan-datapusher.access.log;
|
||||
error_log /var/log/nginx/ckan-datapusher.error.log;
|
||||
|
||||
location / {
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header X-Forwarded-Host $host:$server_port;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_pass http://127.0.0.1:9004;
|
||||
}
|
5
ckan-datapusher/etc/nginx/conf.d/ckan-datapusher.conf
Normal file
5
ckan-datapusher/etc/nginx/conf.d/ckan-datapusher.conf
Normal file
@ -0,0 +1,5 @@
|
||||
server {
|
||||
listen 127.0.0.1:8004;
|
||||
listen [::1]:8004;
|
||||
include apps/ckan-datapusher;
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
import os
|
||||
import ckanserviceprovider.web as web
|
||||
|
||||
os.environ['JOB_CONFIG'] = '/etc/ckan/datapusher_settings.py'
|
||||
os.environ['JOB_CONFIG'] = '/etc/ckan-datapusher/datapusher_settings.py'
|
||||
web.init()
|
||||
|
||||
import datapusher.jobs as jobs
|
@ -10,10 +10,10 @@ PASSWORD = str(uuid.uuid4())
|
||||
|
||||
NAME = 'datapusher'
|
||||
|
||||
SQLALCHEMY_DATABASE_URI = 'sqlite:////srv/ckan-datapusher/jobs.db'
|
||||
SQLALCHEMY_DATABASE_URI = 'sqlite:////srv/ckan-datapusher/data/jobs.db'
|
||||
|
||||
HOST = '0.0.0.0'
|
||||
PORT = 8098
|
||||
PORT = 8004
|
||||
SSL_VERIFY = False
|
||||
|
||||
FROM_EMAIL = 'ckan@spotter.ngo'
|
@ -1,11 +0,0 @@
|
||||
diff -ruN orig/python2.7/site-packages/ckanserviceprovider/web.py lib/python2.7/site-packages/ckanserviceprovider/web.py
|
||||
--- orig/python2.7/site-packages/ckanserviceprovider/web.py 2017-12-01 08:55:57.595353323 +0100
|
||||
+++ lib/python2.7/site-packages/ckanserviceprovider/web.py 2017-12-01 08:56:37.819592364 +0100
|
||||
@@ -733,6 +733,7 @@
|
||||
try:
|
||||
result = requests.post(
|
||||
result_url,
|
||||
+ verify=False,
|
||||
data=json.dumps(job_dict, cls=DatetimeJsonEncoder),
|
||||
headers=headers)
|
||||
|
Loading…
Reference in New Issue
Block a user