Skip to content

Commit

Permalink
YDA-5610: February 2024 update
Browse files Browse the repository at this point in the history
To MSL_CKAN_Core v1.4.0 and MSL-API v1.5.0.

Starting with version v1.4.0 of the core plugin, the Solr schema
will be bundled with the plugin, so the Solr schema template in
the Ansible playbook has been removed.
  • Loading branch information
stsnel committed Feb 26, 2024
1 parent b2c0ea8 commit fc1109e
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 407 deletions.
5 changes: 3 additions & 2 deletions roles/ckan/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ ckanext_scheming_version: release-2.1.0
# whereas the branch parameter is used for updating the code. They are separate parameters
# so that we can reference a specific commit in the code base while still getting
# the correct Solr schema. They would usually be the same, however.
ckan_msl_core_plugin_version: 1.3.0
ckan_msl_core_plugin_branch: 1.3.0
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
81 changes: 45 additions & 36 deletions roles/ckan/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,27 +135,66 @@
when: not ansible_check_mode


# Needed for preventing warnings/error when installing MSL plugins
- name: Install wheel package
ansible.builtin.pip:
name: wheel
virtualenv: /usr/lib/ckan/default


- name: Install CKAN scheming plugin
ansible.builtin.pip:
name: "https://github.com/ckan/ckanext-scheming/archive/{{ ckanext_scheming_version }}.tar.gz"
virtualenv: /usr/lib/ckan/default
extra_args: "--upgrade"
notify: Restart ckan-uwsgi


- name: Install CKAN MSL Core plugin
ansible.builtin.pip:
name: "git+https://github.com/UtrechtUniversity/msl_ckan_core@{{ ckan_msl_core_plugin_branch }}"
virtualenv: /usr/lib/ckan/default
extra_args: "--upgrade"
notify: Restart ckan-uwsgi


- name: Clone CKAN MSL Core plugin for copying images
ansible.builtin.git:
repo: "https://github.com/UtrechtUniversity/msl_ckan_core"
dest: /usr/lib/ckan/msl_ckan_core
version: "{{ ckan_msl_core_plugin_branch }}"


# Workaround for issue where pip doesn't install static images in MSL core plugin
- name: Synchronize MSL Core plugin images
ansible.posix.synchronize:
src: /usr/lib/ckan/msl_ckan_core/ckanext/msl_ckan/public/
dest: /usr/lib/ckan/default/lib/python3.8/site-packages/ckanext/msl_ckan/public/
delegate_to: "{{ inventory_hostname }}"


- name: Check Solr schema
ansible.builtin.stat:
path: /etc/solr/conf/schema.xml
register: solrschema


- name: Ensure default schema has been backed up
ansible.builtin.command: "mv /etc/solr/conf/schema.xml /etc/solr/conf/schema.xml.orig"
ansible.builtin.command:
cmd: "mv /etc/solr/conf/schema.xml /etc/solr/conf/schema.xml.orig"
creates: /etc/solr/conf/schema.xml.orig
when: solrschema.stat.exists and solrschema.stat.isreg is defined and solrschema.stat.isreg


- name: Use custom Solr scheme for EPOS-MSL
become_user: root
become: true
ansible.builtin.template:
src: solrschema.xml.j2
ansible.posix.synchronize:
src: /usr/lib/ckan/msl_ckan_core/ckanext/msl_ckan/config/solr/schema.xml
dest: /etc/solr/conf/schema.xml
owner: root
group: root
mode: "0644"
notify: Restart Solr
delegate_to: "{{ inventory_hostname }}"
when: not ansible_check_mode


- name: Check who.ini
Expand All @@ -178,36 +217,6 @@
state: link


# Needed for preventing warnings/error when installing MSL plugins
- name: Install wheel package
ansible.builtin.pip:
name: wheel
virtualenv: /usr/lib/ckan/default


- name: Install CKAN scheming plugin
ansible.builtin.pip:
name: "https://github.com/ckan/ckanext-scheming/archive/{{ ckanext_scheming_version }}.tar.gz"
virtualenv: /usr/lib/ckan/default
extra_args: "--upgrade"
notify: Restart ckan-uwsgi


- name: Install CKAN MSL Core plugin
ansible.builtin.pip:
name: "git+https://github.com/UtrechtUniversity/msl_ckan_core@{{ ckan_msl_core_plugin_branch }}"
virtualenv: /usr/lib/ckan/default
extra_args: "--upgrade"
notify: Restart ckan-uwsgi


- name: Clone CKAN MSL Core plugin for copying images
ansible.builtin.git:
repo: "https://github.com/UtrechtUniversity/msl_ckan_core"
dest: /usr/lib/ckan/msl_ckan_core
version: "{{ ckan_msl_core_plugin_branch }}"


# Workaround for issue where pip doesn't install static images in MSL core plugin
- name: Synchronize MSL Core plugin images
ansible.posix.synchronize:
Expand Down
11 changes: 3 additions & 8 deletions roles/ckan/templates/ckan.ini.j2
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,14 @@ solr_url = http://127.0.0.1:{{ solr_port }}/solr
ckan.plugins = stats text_view image_view recline_view msl_ckan scheming_datasets scheming_groups scheming_organizations msl_custom_facets msl_repeating_fields

scheming.dataset_schemas = ckanext.msl_ckan:schemas/datasets/data_publication.yml ckanext.msl_ckan:schemas/datasets/labs.json
scheming.group_schemas = ckanext.msl_ckan:schemas/groups/custom_group_msl_subdomain.json
scheming.organization_schemas = ckanext.msl_ckan:schemas/organizations/custom_org_institute.json
scheming.organization_schemas = ckanext.msl_ckan:schemas/organizations/organization.json

mslfacets.dataset_config = ckanext.msl_ckan:config/facets.json

mslindexfields.field_config = ckanext.msl_ckan:config/msl_index_fields.json

mslvocabularies.endpoint_root = {{ ckan_msl_vocabularies_endpoint }}

# Define which views should be created by default
# (plugins must be loaded in ckan.plugins)
ckan.views.default_views = image_view text_view recline_view
Expand Down Expand Up @@ -267,12 +268,6 @@ formatter = generic
[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s] %(message)s

# Settings for EPOS-MSL plugins

# msl_ckan settings
scheming.dataset_schemas = ckanext.msl_ckan:schemas/datasets/data_publication.yml ckanext.msl_ckan:schemas/datasets/labs.json
scheming.group_schemas = ckanext.msl_ckan:schemas/groups/custom_group_msl_subdomain.json
scheming.organization_schemas = ckanext.msl_ckan:schemas/organizations/custom_org_institute.json
# msl_ckan_util settings
ckan.mslfacets.dataset_config = ckanext.msl_ckan_util:samples/facets.json
ckan.mslindexfields.fields_config = ckanext.msl_ckan_util:samples/msl_index_fields.json
Loading

0 comments on commit fc1109e

Please sign in to comment.