Split CKAN and Datapusher virtual envs

This commit is contained in:
Disassembler 2017-11-30 10:11:59 +01:00
parent da93d34c0d
commit b084668c01
3 changed files with 14 additions and 10 deletions

19
ckan.sh
View File

@ -3,7 +3,7 @@
SOURCE_DIR=$(realpath $(dirname "${0}")) SOURCE_DIR=$(realpath $(dirname "${0}"))
# Install dependencies for CKAN # Install dependencies for CKAN
apt-get -y --no-install-recommends install gcc libpq-dev python-dev python-virtualenv redis-server uuid-runtime virtualenv apt-get -y --no-install-recommends install gcc libpq-dev python-dev python-virtualenv redis-server virtualenv
# Install dependencies for Solr # Install dependencies for Solr
apt-get -y --no-install-recommends install openjdk-8-jre-headless lsof apt-get -y --no-install-recommends install openjdk-8-jre-headless lsof
@ -12,9 +12,13 @@ apt-get -y --no-install-recommends install openjdk-8-jre-headless lsof
mkdir -p /srv/ckan mkdir -p /srv/ckan
virtualenv --no-site-packages --python=/usr/bin/python2.7 /srv/ckan virtualenv --no-site-packages --python=/usr/bin/python2.7 /srv/ckan
/srv/ckan/bin/pip install -e 'git+https://github.com/ckan/ckan.git#egg=ckan' /srv/ckan/bin/pip install -e 'git+https://github.com/ckan/ckan.git#egg=ckan'
/srv/ckan/bin/pip install -e 'git+https://github.com/ckan/datapusher.git#egg=datapusher'
/srv/ckan/bin/pip install -r /srv/ckan/src/ckan/requirements.txt /srv/ckan/bin/pip install -r /srv/ckan/src/ckan/requirements.txt
/srv/ckan/bin/pip install -r /srv/ckan/src/datapusher/requirements.txt
# Install Datapusher python virtual environment
mkdir -p /srv/ckan-datapusher
virtualenv --no-site-packages --python=/usr/bin/python2.7 /srv/ckan-datapusher
/srv/ckan-datapusher/bin/pip install -e 'git+https://github.com/ckan/datapusher.git#egg=datapusher'
/srv/ckan-datapusher/bin/pip install -r /srv/ckan-datapusher/src/datapusher/requirements.txt
# Install CKAN extensions # Install CKAN extensions
/srv/ckan/bin/pip install -e 'git+https://github.com/ckan/ckanext-basiccharts#egg=ckanext_basiccharts' /srv/ckan/bin/pip install -e 'git+https://github.com/ckan/ckanext-basiccharts#egg=ckanext_basiccharts'
@ -31,7 +35,7 @@ virtualenv --no-site-packages --python=/usr/bin/python2.7 /srv/ckan
/srv/ckan/bin/pip install -r /srv/ckan/src/ckanext-datasetthumbnail/requirements.txt /srv/ckan/bin/pip install -r /srv/ckan/src/ckanext-datasetthumbnail/requirements.txt
/srv/ckan/bin/pip install -r /srv/ckan/src/ckanext-dgvat-xls/requirements.txt /srv/ckan/bin/pip install -r /srv/ckan/src/ckanext-dgvat-xls/requirements.txt
# Donwload Solr # Download Solr
wget http://archive.apache.org/dist/lucene/solr/6.5.1/solr-6.5.1.tgz -O /tmp/solr-6.5.1.tgz wget http://archive.apache.org/dist/lucene/solr/6.5.1/solr-6.5.1.tgz -O /tmp/solr-6.5.1.tgz
tar xzf /tmp/solr-6.5.1.tgz -C /opt/ tar xzf /tmp/solr-6.5.1.tgz -C /opt/
mv /opt/solr-6.5.1 /opt/solr mv /opt/solr-6.5.1 /opt/solr
@ -49,6 +53,7 @@ adduser --system --group --home /srv/ckan --shell /bin/false ckan
chown -R ckan:ckan /srv/ckan/ chown -R ckan:ckan /srv/ckan/
mkdir /var/lib/ckan mkdir /var/lib/ckan
chown ckan:ckan /var/lib/ckan chown ckan:ckan /var/lib/ckan
chown ckan:ckan /var/lib/ckan-datapusher
# Create Solr OS user # Create Solr OS user
adduser --system --group --home /var/lib/solr --shell /bin/false solr adduser --system --group --home /var/lib/solr --shell /bin/false solr
@ -70,7 +75,7 @@ systemctl restart solr
# Configure CKAN # Configure CKAN
export CKAN_SECRET=$(head -c 18 /dev/urandom | base64) export CKAN_SECRET=$(head -c 18 /dev/urandom | base64)
export CKAN_UUID=$(uuidgen -r) export CKAN_UUID=$(python -c "import uuid; print uuid.uuid4()")
mkdir /etc/ckan mkdir /etc/ckan
envsubst <${SOURCE_DIR}/ckan/etc/ckan/ckan.ini >/etc/ckan/ckan.ini envsubst <${SOURCE_DIR}/ckan/etc/ckan/ckan.ini >/etc/ckan/ckan.ini
cp ${SOURCE_DIR}/ckan/etc/ckan/datapusher.wsgi /etc/ckan/datapusher.wsgi cp ${SOURCE_DIR}/ckan/etc/ckan/datapusher.wsgi /etc/ckan/datapusher.wsgi
@ -86,8 +91,8 @@ sudo -u ckan /srv/ckan/bin/paster --plugin=ckan datastore set-permissions -c /et
# Create admin account # Create admin account
export CKAN_ADMIN_USER="admin" export CKAN_ADMIN_USER="admin"
export CKAN_ADMIN_UUID=$(uuidgen -r) export CKAN_ADMIN_UUID=$(python -c "import uuid; print uuid.uuid4()")
export CKAN_ADMIN_APIKEY=$(uuidgen -r) export CKAN_ADMIN_APIKEY=$(python -c "import uuid; print uuid.uuid4()")
export CKAN_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export CKAN_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
export CKAN_ADMIN_HASH=$(/srv/ckan/bin/python ${SOURCE_DIR}/ckan/ckan-adminpwd.py ${CKAN_ADMIN_PWD}) export CKAN_ADMIN_HASH=$(/srv/ckan/bin/python ${SOURCE_DIR}/ckan/ckan-adminpwd.py ${CKAN_ADMIN_PWD})
export CKAN_ADMIN_EMAIL="admin@example.com" export CKAN_ADMIN_EMAIL="admin@example.com"

View File

@ -2,7 +2,7 @@
import os import os
activate_this = os.path.join('/srv/ckan/bin/activate_this.py') activate_this = '/srv/ckan-datapusher/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this)) execfile(activate_this, dict(__file__=activate_this))
import ckanserviceprovider.web as web import ckanserviceprovider.web as web

View File

@ -2,7 +2,6 @@
uid = ckan uid = ckan
gid = ckan gid = ckan
chown-socket = www-data:www-data chown-socket = www-data:www-data
chdir = /srv/ckan chdir = /srv/ckan-datapusher
exec-asap = /srv/ckan/update-ip.sh
disable-logging = true disable-logging = true
file = /etc/ckan/datapusher.wsgi file = /etc/ckan/datapusher.wsgi