-
Notifications
You must be signed in to change notification settings - Fork 10
Deploying a Hosted Site
This is a draft page documenting our process for deploying a hosted CKAN site, should become a step-by-step doc for everything for a standard hosted CKAN deployment, including setting up the servers, installing extensions, and doing basic customisations.
Create a custom extension for the site. See: https://github.com/okfn/ckan/wiki/Creating-a-CKAN-Extension-for-a-Custom-Site
The normal process to have one webserver which runs Apache and Nginx, and a dbserver which runs Solr and PostgreSQL. The following process is expected to be run after the bootstrap process which should install all the necessary packages.
Deployments are owned by the okfn user on the server. If you're logged in as a different user, switch to okfn user with
sudo su okfn
Create the directories for the code, configuration, and the filestore.
sudo mkdir -p /etc/ckan/edo
sudo mkdir -p /usr/lib/ckan/edo
sudo mkdir -p /var/lib/ckan/edo
sudo chown okfn /etc/ckan/edo
sudo chown okfn /usr/lib/ckan/edo
sudo chown www-data /var/lib/ckan/edo
Setup a virtualenv in /usr/lib/ckan/edo and activate it
virtualenv --no-site-packages /usr/lib/ckan/edo
source /usr/lib/ckan/edo/bin/activate
Install ckan and switch to the correct branch
pip install -e git://github.com/okfn/ckan.git#egg=ckan
cd /usr/lib/ckan/edo/src/ckan
git checkout release-v2.0
Install the ckan-edo extension (and other extensions that need to be installed).
pip install -e git://github.com/okfn/ckanext-edo.git#egg=ckanext_edo
Install CKAN's dependencies into the virtualenv:
pip install -r /usr/lib/ckan/edo/src/ckan/pip-requirements.txt
Create a configuration file with
paster make-config ckan /etc/ckan/edo/production.ini
Edit the config file appropriately. Will need to come back to this once the database is set up.
Create /etc/ckan/edo/apache.wsgi using https://github.com/okfn/ckanbuild/blob/master/etc/ckan/apache.wsgi as a template. Correct activate_this to os.path.join('/usr/lib/ckan/edo/bin/activate_this.py')
The right packages should be installed on the machine already as part of the ansible process.
Clone ckanbuild
git clone https://github.com/okfn/ckanbuild.git
Create the database. A password will be prompted, use that to set the password of the edo user.
cd ckanbuild/bin
./dbserver.sh createdb edo
Edit the configuration on the webserver to add access to the postgresql db just created.