Skip to content

Commit

Permalink
Add optional ckanext-spatial plugin
Browse files Browse the repository at this point in the history
For now, it will be disabled by default.
  • Loading branch information
stsnel committed Apr 24, 2024
1 parent d280961 commit 2ea1e6b
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ The main configuration settings are:
|msl_api_asset_url | asset URL for the MSL API web service, e.g. https://epos-catalog.mydomain.nl/webservice |
|ckan_api_token | the MSL API uses this value to authenticate to the CKAN API. this should currently be the API key (not API token!) of the ckanadmin account. The current way to use this field is: deploy the catalog using a dummy value for this parameter, log in on CKAN using the ckanadmin account, generate an API key, replace the dummy value in the host\_vars file with the real API key, and run the playbook a second time.
|msl_api_app_key | the MSL API application key. The current way to configure this is to deploy the application, generate the app key by running `sudo -u www-data /usr/bin/php8.0 artisan key:generate && sudo -u www-data /usr/bin/php8.0 artisan config:cache` in /var/www/msl\_api. Finally copy the generated key in /var/www/msl\_api/.env to the host\_vars file.
| ckan_install_spatial_plugin | whether to install the ckanext-spatial plugin (default: false) |
| ckan_spatial_plugin_repo | Github repository to use for the ckanext-spatial plugin |
| ckan_spatial_plugin_version | Branch or tag to use for the ckanext-spatial plugin |

## CKAN catalog

Expand Down
1 change: 1 addition & 0 deletions environments/development/host_vars/epos-msl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ epos_msl_environment: development # EPOS-MSL environment: development,
ckan_database_password: test # CKAN Postgresql database password
ckan_admin_password: testtest # CKAN admin user ('ckanadmin') password
ckan_harvest_password: testtest # CKAN harvest user ('harvest') password
ckan_install_spatial_plugin: true

##########################
# MSL API configuration
Expand Down
4 changes: 4 additions & 0 deletions roles/ckan/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ ckan_msl_core_plugin_version: 1.4.0
ckan_msl_core_plugin_branch: 1.4.0
ckan_msl_util_plugin_branch: 1.0.0
ckan_msl_vocabularies_endpoint: https://epos-msl.ckan.test/webservice/api/vocabularies

ckan_install_spatial_plugin: false
ckan_spatial_plugin_repo: ckan/ckanext-spatial
ckan_spatial_plugin_version: v2.1.1
5 changes: 5 additions & 0 deletions roles/ckan/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@
virtualenv: /usr/lib/ckan/default


- name: Install CKAN spatial plugin, if enabled
ansible.builtin.import_tasks: spatial_plugin.yml
when: ckan_install_spatial_plugin


- name: Install CKAN scheming plugin
ansible.builtin.pip:
name: "https://github.com/ckan/ckanext-scheming/archive/{{ ckanext_scheming_version }}.tar.gz"
Expand Down
33 changes: 33 additions & 0 deletions roles/ckan/tasks/spatial_plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
# copyright Utrecht University
#
- name: Install spatial CKAN plugin package dependencies
ansible.builtin.apt:
pkg:
- python-dev
- libxml2-dev
- libxslt1-dev
- libgeos-c1v5
state: present


- name: Clone spatial CKAN plugin
ansible.builtin.git:
repo: "https://github.com/{{ ckan_spatial_plugin_repo }}"
dest: /usr/lib/ckan/ckanext-spatial
version: "{{ ckan_spatial_plugin_version }}"


- name: Install spatial CKAN plugin Python dependencies
ansible.builtin.pip:
requirements: /usr/lib/ckan/ckanext-spatial/requirements.txt
virtualenv: /usr/lib/ckan/default
notify: Restart ckan-uwsgi


- name: Install spatial CKAN plugin
ansible.builtin.pip:
name: /usr/lib/ckan/ckanext-spatial
virtualenv: /usr/lib/ckan/default
extra_args: "-e"
notify: Restart ckan-uwsgi
4 changes: 4 additions & 0 deletions roles/ckan/templates/ckan.ini.j2
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ solr_url = http://127.0.0.1:{{ solr_port }}/solr/ckan
# Add ``resource_proxy`` to enable resorce proxying and get around the
# same origin policy
#ckan.plugins = stats text_view image_view recline_view
{% if ckan_install_spatial_plugin %}
ckan.plugins = stats text_view image_view recline_view msl_ckan scheming_datasets scheming_groups scheming_organizations msl_custom_facets msl_repeating_fields spatial_metadata spatial_query
{% else %}
ckan.plugins = stats text_view image_view recline_view msl_ckan scheming_datasets scheming_groups scheming_organizations msl_custom_facets msl_repeating_fields
{% endif %}

scheming.dataset_schemas = ckanext.msl_ckan:schemas/datasets/data_publication.yml ckanext.msl_ckan:schemas/datasets/labs.json
scheming.organization_schemas = ckanext.msl_ckan:schemas/organizations/organization.json
Expand Down

0 comments on commit 2ea1e6b

Please sign in to comment.