diff --git a/30-ckan.sh b/30-ckan.sh index 15d4b22..55a6c0e 100755 --- a/30-ckan.sh +++ b/30-ckan.sh @@ -11,12 +11,10 @@ apt-get -y --no-install-recommends install openjdk-8-jre-headless lsof # Install CKAN python virtual environment mkdir -p /srv/ckan virtualenv --no-site-packages --python=/usr/bin/python2.7 /srv/ckan -. /srv/ckan/bin/activate -pip install -e 'git+https://github.com/ckan/ckan.git#egg=ckan' -pip install -e 'git+https://github.com/ckan/datapusher.git#egg=datapusher' -pip install -r /srv/ckan/src/ckan/requirements.txt -pip install -r /srv/ckan/src/datapusher/requirements.txt -deactivate +/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/datapusher/requirements.txt # Donwload Solr wget http://archive.apache.org/dist/lucene/solr/6.5.1/solr-6.5.1.tgz -O /tmp/solr-6.5.1.tgz @@ -70,21 +68,19 @@ cp ${SOURCE_DIR}/ckan/srv/ckan/update-ip.sh /srv/ckan/update-ip.sh /srv/ckan/update-ip.sh # Populate database -. /srv/ckan/bin/activate -paster --plugin=ckan db init -c /etc/ckan/ckan.ini -paster --plugin=ckan datastore set-permissions -c /etc/ckan/ckan.ini | sudo -u postgres psql +sudo -u ckan /srv/ckan/bin/paster --plugin=ckan db init -c /etc/ckan/ckan.ini +sudo -u ckan /srv/ckan/bin/paster --plugin=ckan datastore set-permissions -c /etc/ckan/ckan.ini | sudo -u postgres psql # Create admin account export CKAN_ADMIN_USER="admin" export CKAN_ADMIN_UUID=$(uuidgen -r) export CKAN_ADMIN_APIKEY=$(uuidgen -r) export CKAN_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) -export CKAN_ADMIN_HASH=$(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" envsubst <${SOURCE_DIR}/ckan/tmp/ckan-adminpwd.sql >/tmp/ckan-adminpwd.sql sudo -u postgres psql -f /tmp/ckan-adminpwd.sql ckan rm /tmp/ckan-adminpwd.sql -deactivate # Create uwsgi and nginx app definition cp ${SOURCE_DIR}/ckan/etc/uwsgi/apps-available/ckan.ini /etc/uwsgi/apps-available/ckan.ini diff --git a/ckan/srv/ckan/cron-pageviews.sh b/ckan/srv/ckan/cron-pageviews.sh index 4f2a871..983bc8e 100755 --- a/ckan/srv/ckan/cron-pageviews.sh +++ b/ckan/srv/ckan/cron-pageviews.sh @@ -1,6 +1,4 @@ #!/bin/sh -. /srv/ckan/bin/activate -paster --plugin=ckan tracking update -c /etc/ckan/ckan.ini && \ -paster --plugin=ckan search-index rebuild -r -c /etc/ckan/ckan.ini -deactivate +/srv/ckan/bin/paster --plugin=ckan tracking update -c /etc/ckan/ckan.ini && \ +/srv/ckan/bin/paster --plugin=ckan search-index rebuild -r -c /etc/ckan/ckan.ini