smallmedia / iod-ckan

iod-ckan
http://new.iranopendata.org
Other
3 stars 1 forks source link
ckan project

Small Media CKAN Notes

  1. vagrant up should get you a working local install
  2. vagrant ssh to login to the vagrant machine
  3. From the /vagrant directory (which is the default), run paster serve /etc/ckan/default/ckan.ini
  4. Visit the app at http://192.168.33.10:5000/

Working with paster on local or live

Deploy to iod-ckan-live

First of all add your ssh key to your github profile to have access to the private repo with ssh key. then add the following SSH configuration to your ~/.ssh/config file:

Host [server-address-here]
HostName [ip-address-here]
ForwardAgent yes

This enables forwarding keys loaded into ssh-agent to remote SSH connections.

Check which keys are loaded currently using ssh-add -l, and add any additional required keys using ssh-add ~/.ssh/key-here.

Now run the ansible playbook:

  1. Go to the deploy folder: cd deploy
  2. Run the deploy script: ansible-playbook live.yml

Working with paster on iod-ckan-live

Update View Tracking

If you already deployed the ckan, set ckan.tracking_enabled to true in the [app:main] section of your CKAN configuration file (e.g /etc/ckan/default/ckan.ini):

[app:main]
ckan.tracking_enabled = true

Otherwise the ckan config file will be created based on ckan.ini.j2 witch the tracking_enabled is true by default.

To update tracking summary: paster tracking update -c /etc/ckan/default/ckan.ini

To rebuild the serch index: paster search-index rebuild -c /etc/ckan/default/ckan.ini

Also it's possible to create a cron job to do the updating and rebuilding periodically. run crontab -e and add this line to current cron file:

@hourly /usr/lib/ckan/bin/paster --plugin=ckan tracking update -c /etc/ckan/default/ckan.ini && /usr/lib/ckan/bin/paster --plugin=ckan search-index rebuild -r -c /etc/ckan/default/ckan.ini

Be sure that the path of the paster is correct. The @hourly can be replaced with @daily, @weekly or @monthly.

Showcase

To install showcase:

cd ckanext-showcase
python setup.py develop
pip install -r dev-requirements.txt

Showcase will create it's tables. CKAN timeout when Showcase is enabled for the first time. to solve the problem you need to disable all plugins. Edit the local config file: sudo vi /etc/ckan/default/ckan.ini and comment out the ckan.plugins line. then add this line instead: ckan.plugins = showcase and run the CKAN. After creating the tables, enable all plugins again.

at the end, restart the webapp: service supervisor restart