Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
stsnel committed Feb 29, 2024
2 parents 00025fd + 69c179e commit 055b22e
Show file tree
Hide file tree
Showing 30 changed files with 105 additions and 447 deletions.
1 change: 1 addition & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ skip_list:
- no-changed-when # Commands should not change things if nothing needs doing
- no-handler # Tasks that run when changed should likely be handlers
- experimental # all rules tagged as experimental
- schema[meta]
2 changes: 1 addition & 1 deletion .github/workflows/ansible-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v2

- name: Lint Ansible Playbook
uses: ansible/ansible-lint-action@main
uses: ansible/ansible-lint-action@v6.15.0

# [optional]
# Arguments to be passed to the ansible-lint
Expand Down
2 changes: 1 addition & 1 deletion playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
- solr
- redis
- ckan
- msl-api
- msl_api
2 changes: 1 addition & 1 deletion roles/acme_certificates/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ galaxy_info:
author: Lazlo Westerhof
description: Install Let's Encrypt certificates
license: GPLv3
min_ansible_version: 2.7
min_ansible_version: "2.7"
platforms:
- name: CentOS
version: 7
8 changes: 4 additions & 4 deletions roles/certificates/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
dest: '{{ openssl_certs_dir }}/{{ openssl_crt_signed_and_chain }}'
owner: root
group: root
mode: 0644
mode: "0644"
when: cert_mode == "static"


Expand Down Expand Up @@ -94,7 +94,7 @@
content: '{{ static_cert_crt }}'
owner: root
group: root
mode: 0644
mode: "0644"
when: cert_mode == "static"


Expand All @@ -104,7 +104,7 @@
content: '{{ static_cert_chain }}'
owner: root
group: root
mode: 0644
mode: "0644"
when: cert_mode == "static"


Expand Down Expand Up @@ -137,7 +137,7 @@
- name: Ensure certificate files have correct permissions
ansible.builtin.file:
path: '{{ item }}'
mode: 0644
mode: "0644"
group: 'root'
owner: 'root'
state: file
Expand Down
6 changes: 4 additions & 2 deletions roles/ckan/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ ckan_package_file: /tmp/ckan_package.deb
ckan_package_upgrade: false
ckan_ini_file: /etc/ckan/default/ckan.ini
ckan_storage_path: /ckandata
ckan_search_facets_limit: 10000

ckan_session_timeout: 3600

Expand All @@ -39,6 +40,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
12 changes: 6 additions & 6 deletions roles/ckan/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ galaxy_info:
# - CC-BY
license: GPLv3

min_ansible_version: 2.7
min_ansible_version: "2.7"

# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
Expand Down Expand Up @@ -62,8 +62,8 @@ galaxy_info:


dependencies:
- common
- solr
- redis
- postgresql
- nginx
- role: common
- role: solr
- role: redis
- role: postgresql
- role: nginx
89 changes: 49 additions & 40 deletions roles/ckan/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
state: directory
owner: www-data
group: www-data
mode: 0775
mode: "0775"


- name: Install CKAN package
Expand Down Expand Up @@ -92,7 +92,7 @@
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: 0755
mode: "0755"
owner: root
with_items:
- /usr/lib/ckan
Expand Down Expand Up @@ -131,31 +131,70 @@
dest: "{{ ckan_ini_file }}"
owner: www-data
group: www-data
mode: 0644
mode: "0644"
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 Expand Up @@ -290,7 +299,7 @@
dest: "/etc/nginx/sites-available/ckan"
owner: root
group: root
mode: 0644
mode: "0644"
notify: Restart Nginx webserver


Expand Down
14 changes: 6 additions & 8 deletions roles/ckan/templates/ckan.ini.j2
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ beaker.session.secret = {{ session_secret.stdout }}
# a config file.
app_instance_uuid = {{ app_instance_uuid.stdout }}

# Default number of search facets returned in a query
search.facets.limit = {{ ckan_search_facets_limit }}

# repoze.who config
who.config_file = %(here)s/who.ini
who.log_level = warning
Expand Down Expand Up @@ -124,13 +127,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 +271,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 055b22e

Please sign in to comment.