#!/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
