Call CKAN virtual env binaries directly

This commit is contained in:
Disassembler 2017-11-22 20:38:40 +01:00
parent 1c2596c949
commit b1aad14c5c
2 changed files with 9 additions and 15 deletions

View File

@ -11,12 +11,10 @@ apt-get -y --no-install-recommends install openjdk-8-jre-headless lsof
# Install CKAN python virtual environment # Install CKAN python virtual environment
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/activate /srv/ckan/bin/pip install -e 'git+https://github.com/ckan/ckan.git#egg=ckan'
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'
pip install -e 'git+https://github.com/ckan/datapusher.git#egg=datapusher' /srv/ckan/bin/pip install -r /srv/ckan/src/ckan/requirements.txt
pip install -r /srv/ckan/src/ckan/requirements.txt /srv/ckan/bin/pip install -r /srv/ckan/src/datapusher/requirements.txt
pip install -r /srv/ckan/src/datapusher/requirements.txt
deactivate
# Donwload Solr # 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 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 /srv/ckan/update-ip.sh
# Populate database # Populate database
. /srv/ckan/bin/activate sudo -u ckan /srv/ckan/bin/paster --plugin=ckan db init -c /etc/ckan/ckan.ini
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
paster --plugin=ckan datastore set-permissions -c /etc/ckan/ckan.ini | sudo -u postgres psql
# 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=$(uuidgen -r)
export CKAN_ADMIN_APIKEY=$(uuidgen -r) export CKAN_ADMIN_APIKEY=$(uuidgen -r)
export CKAN_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) 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" export CKAN_ADMIN_EMAIL="admin@example.com"
envsubst <${SOURCE_DIR}/ckan/tmp/ckan-adminpwd.sql >/tmp/ckan-adminpwd.sql envsubst <${SOURCE_DIR}/ckan/tmp/ckan-adminpwd.sql >/tmp/ckan-adminpwd.sql
sudo -u postgres psql -f /tmp/ckan-adminpwd.sql ckan sudo -u postgres psql -f /tmp/ckan-adminpwd.sql ckan
rm /tmp/ckan-adminpwd.sql rm /tmp/ckan-adminpwd.sql
deactivate
# Create uwsgi and nginx app definition # Create uwsgi and nginx app definition
cp ${SOURCE_DIR}/ckan/etc/uwsgi/apps-available/ckan.ini /etc/uwsgi/apps-available/ckan.ini cp ${SOURCE_DIR}/ckan/etc/uwsgi/apps-available/ckan.ini /etc/uwsgi/apps-available/ckan.ini

View File

@ -1,6 +1,4 @@
#!/bin/sh #!/bin/sh
. /srv/ckan/bin/activate /srv/ckan/bin/paster --plugin=ckan tracking update -c /etc/ckan/ckan.ini && \
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
paster --plugin=ckan search-index rebuild -r -c /etc/ckan/ckan.ini
deactivate