Package: ckanext-syndicate
CKAN plugin to syndicate datasets to another CKAN instance.This plugin provides a mechanism to syndicate datasets to another instance of
CKAN. If a dataset has thesyndicateflag set toTruein its custom
metadata, any updates to the dataset will be reflected in the syndicated
version. Resources in the syndicated dataset are stored as the URLs of the
resources in the original. You must have the API key of a user on the target
instance of CKAN. See the Config Settings section below.Plugins can modify data sent for syndication by implementing the actionupdate_dataset_for_syndicationand modifying thedataset_dictvalue. This is useful if the schemas are different between CKAN instances.RequirementsTested with CKAN 2.5.2RequiresceleryTo work over SSL, requirespyOpenSSL,ndg-httpsclientandpyasn1It may be useful to run Celery in a production environment throughsupervisorInstallationTo install ckanext-syndicate:Activate your CKAN virtual environment, for example:. /usr/lib/ckan/default/bin/activateInstall the ckanext-syndicate Python package into your virtual environment:pip install ckanext-syndicateAddsyndicateto theckan.pluginssetting in your CKAN
config file (by default the config file is located at/etc/ckan/default/production.ini).Restart CKAN. For example if you’ve deployed CKAN with Apache on Ubuntu:sudo service apache2 reloadYou will also need to set up celery. In a development environment this can be done with the following paster command from within your virtual environment:paster --plugin=ckan celeryd run -c /etc/ckan/default/development.iniIn a production environment, celery can be configured through supervisor, for example/etc/supervisor/conf.d/celery.conf:[program:celery]
autorestart=true
autostart=true
command=/usr/lib/ckan/default/bin/paster --plugin=ckan celeryd --config=/etc/ckan/default/production.ini
numprocs=1
priority=998
redirect_stderr=true
startsecs=10
stderr_logfile=/var/log/celeryd.log
stdout_logfile=/var/log/celeryd.log
stopwaitsecs=600
user=www-dataConfig Settings# The URL of the site to be syndicated to
ckan.syndicate.ckan_url = https://data.humdata.org/

# The API key of the user on the syndicated site
ckan.syndicate.api_key = 9efdd954-c643-444a-97a1-c9c374cef861

# The custom metadata flag used for syndication
# (optional, default: syndicate).
ckan.syndicate.flag = syndicate_to_hdx

# The custom metadata field to store the syndicated dataset ID
# on the original dataset
# (optional, default: syndicated_id)
ckan.syndicate.id = hdx_id

# A prefix to apply to the name of the syndicated dataset
# (optional, default: )
ckan.syndicate.name_prefix = my-prefix

# The name of the organization on the target CKAN to use when creating
# the syndicated datasets
# (optional, default: None)
ckan.syndicate.organization = my-org-nameDevelopment InstallationTo install ckanext-syndicate for development, activate your CKAN virtualenv and
do:git clone https://github.com/aptivate/ckanext-syndicate.git
cd ckanext-syndicate
python setup.py develop
pip install -r dev-requirements.txtSee also InstallationRunning the TestsTo run the tests, do:nosetests --nologcapture --with-pylons=test.iniTo run the tests and produce a coverage report, first make sure you have
coverage installed in your virtualenv (pip install coverage) then run:nosetests --nologcapture --with-pylons=test.ini --with-coverage --cover-package=ckanext.syndicate --cover-inclusive --cover-erase --cover-testsRegistering ckanext-syndicate on PyPIckanext-syndicate should be availabe on PyPI ashttps://pypi.python.org/pypi/ckanext-syndicate. If that link doesn’t work, then
you can register the project on PyPI for the first time by following these
steps:Create a source distribution of the project:python setup.py sdistRegister the project:python setup.py registerUpload the source distribution to PyPI:python setup.py sdist uploadTag the first release of the project on GitHub with the version number from
thesetup.pyfile. For example if the version number insetup.pyis
0.0.1 then do:git tag 0.0.1
git push --tagsReleasing a New Version of ckanext-syndicateckanext-syndicate is availabe on PyPI ashttps://pypi.python.org/pypi/ckanext-syndicate.
To publish a new version to PyPI follow these steps:Update the version number in thesetup.pyfile.
SeePEP 440for how to choose version numbers.Create a source distribution of the new version:python setup.py sdistUpload the source distribution to PyPI:python setup.py sdist uploadTag the new release of the project on GitHub with the version number from
thesetup.pyfile. For example if the version number insetup.pyis
0.0.2 then do:git tag 0.0.2
git push --tags