Adjust CKAN for spotter-appmgr

This commit is contained in:
Disassembler 2018-03-25 22:55:15 +02:00
parent d44b5e7ba3
commit c054be6dac
No known key found for this signature in database
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 && patch -p0 </srv/ckan-datapusher/ssl_verify.patch
VOLUME ["/etc/ckan-datapusher", "/srv/ckan-datapusher/data"] VOLUME ["/etc/ckan-datapusher", "/srv/ckan-datapusher/data"]
EXPOSE 8004 EXPOSE 8080
USER ckan-datapusher 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' SQLALCHEMY_DATABASE_URI = 'sqlite:////srv/ckan-datapusher/data/jobs.db'
HOST = '0.0.0.0' HOST = '0.0.0.0'
PORT = 8004 PORT = 8080
SSL_VERIFY = False SSL_VERIFY = False
FROM_EMAIL = 'ckan@spotter.ngo' 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) export CKAN_UUID=$(cat /proc/sys/kernel/random/uuid)
envsubst <${SOURCE_DIR}/srv/ckan/conf/ckan.ini >/srv/ckan/conf/ckan.ini 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/conf/who.ini /srv/ckan/conf/who.ini
cp ${SOURCE_DIR}/srv/ckan/update-ip.sh /srv/ckan/update-ip.sh cp ${SOURCE_DIR}/srv/ckan/update-url.sh /srv/ckan/update-url.sh
/srv/ckan/update-ip.sh
# Set "production values" (increases performance) only if the DEBUG environment variable is not set # Set "production values" (increases performance) only if the DEBUG environment variable is not set
if [ ${DEBUG:-0} -eq 0 ]; then 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 rc-update add ckan
service ckan start 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 # Install cron job
cp ${SOURCE_DIR}/etc/periodic/hourly/ckan /etc/periodic/hourly/ckan cp ${SOURCE_DIR}/etc/periodic/hourly/ckan /etc/periodic/hourly/ckan
# Add portal application definition # Add application definition
portal-app-manager ckan "https://{host}:8403/" "${CKAN_ADMIN_USER}" "${CKAN_ADMIN_PWD}" 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 && rm -rf /root/.cache
VOLUME ["/etc/ckan", "/srv/ckan/storage"] VOLUME ["/etc/ckan", "/srv/ckan/storage"]
EXPOSE 8003 EXPOSE 8080
USER ckan USER ckan
CMD ["paster", "serve", "/etc/ckan/ckan.ini"] CMD ["paster", "serve", "/etc/ckan/ckan.ini"]

View File

@ -8,10 +8,6 @@ depend() {
after ckan-datapusher redis solr after ckan-datapusher redis solr
} }
start_pre() {
/srv/ckan/update-ip.sh
}
start() { start() {
/usr/bin/docker run -d --rm \ /usr/bin/docker run -d --rm \
--name ckan \ --name ckan \
@ -22,12 +18,15 @@ start() {
--link redis \ --link redis \
--link solr \ --link solr \
--link ckan-datapusher \ --link ckan-datapusher \
-p 127.0.0.1:8003:8003 \
-v /srv/ckan/conf:/etc/ckan \ -v /srv/ckan/conf:/etc/ckan \
-v /srv/ckan/data:/srv/ckan/storage \ -v /srv/ckan/data:/srv/ckan/storage \
ckan ckan
} }
start_post() {
/usr/local/bin/spotter-appmgr update-hosts ckan
}
stop() { stop() {
/usr/bin/docker stop ckan /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] [server:main]
use = egg:Paste#http use = egg:Paste#http
host = 0.0.0.0 host = 0.0.0.0
port = 8003 port = 8080
[app:main] [app:main]
use = egg:ckan use = egg:ckan
@ -177,7 +177,7 @@ ckan.max_image_size = 10
# Make sure you have set up the DataStore # 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.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 #ckan.datapusher.assume_task_stale_after = 3600
# Resource Proxy settings # 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