diff --git a/README.md b/README.md index b25578f..1acf63e 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/environments/development/host_vars/epos-msl b/environments/development/host_vars/epos-msl index 6cc8dee..7e267fa 100644 --- a/environments/development/host_vars/epos-msl +++ b/environments/development/host_vars/epos-msl @@ -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 diff --git a/roles/ckan/defaults/main.yml b/roles/ckan/defaults/main.yml index 9ded777..303101f 100644 --- a/roles/ckan/defaults/main.yml +++ b/roles/ckan/defaults/main.yml @@ -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 diff --git a/roles/ckan/tasks/main.yml b/roles/ckan/tasks/main.yml index 5d9c9f5..a150d7c 100644 --- a/roles/ckan/tasks/main.yml +++ b/roles/ckan/tasks/main.yml @@ -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" diff --git a/roles/ckan/tasks/spatial_plugin.yml b/roles/ckan/tasks/spatial_plugin.yml new file mode 100644 index 0000000..5b4b74b --- /dev/null +++ b/roles/ckan/tasks/spatial_plugin.yml @@ -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 diff --git a/roles/ckan/templates/ckan.ini.j2 b/roles/ckan/templates/ckan.ini.j2 index 942d416..875358b 100644 --- a/roles/ckan/templates/ckan.ini.j2 +++ b/roles/ckan/templates/ckan.ini.j2 @@ -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