Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create bie and bie-offline collection if not exists #695

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ansible/roles/solrcloud/tasks/docker-facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- docker
- docker-service
- docker-compose
- solr_config
- gatus

- name: Create Sorlcloud zk host list
Expand All @@ -32,6 +33,7 @@
- docker
- docker-service
- docker-compose
- solr_config
- gatus

- name: Create Sorlcloud solr_url
Expand All @@ -41,3 +43,4 @@
- docker
- docker-service
- docker-compose
- solr_config
4 changes: 2 additions & 2 deletions ansible/roles/solrcloud/tasks/docker-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
tags:
- solrcloud
- solr_config
- solrcloud_config
- docker
- docker-service

Expand Down Expand Up @@ -47,6 +48,7 @@
tags:
- solrcloud
- solrcloud_config
- solr_config
- docker
- docker-service

Expand Down Expand Up @@ -130,7 +132,6 @@
vars:
name: la_solrcloud_solr_1
run_once: true
when: docker_development_mode is defined and docker_development_mode == false
tags:
- solr_config

Expand All @@ -139,7 +140,6 @@
name: la_solrcloud_solr_1
port: 8983
run_once: true
when: docker_development_mode is defined and docker_development_mode == false
tags:
- solr_config

Expand Down
1 change: 1 addition & 0 deletions ansible/roles/solrcloud/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
- solrcloud_num_shards: 1
when: deployment_type == 'swarm'

# We can let this port open during development
- name: Remove previous socat container for solr tunnel
import_tasks: ../../docker-common/tasks/socat-rm.yml
vars:
Expand Down
41 changes: 29 additions & 12 deletions ansible/roles/solrcloud_config/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
- solrcloud_config

- name: Get Solr container ID on the specific node if using docker
shell: "docker service ps la_sorlcloud_solr_1 --format '{{ '{{' }}.Node{{ '}}' }}' | head -1"
shell: "docker service ps la_solrcloud_solr_1 --format '{{ '{{' }}.Node{{ '}}' }}' | head -1"
register: solr_node
run_once: true
when: deployment_type == 'swarm'
Expand Down Expand Up @@ -86,17 +86,34 @@
- solrcloud_config
- zookeeper_config

- name: Delete biocache collection if it exists
get_url: url="http://{{ solr_config_host }}:{{ solr_port }}/solr/admin/collections?action=DELETE&name=biocache" dest=/tmp/delete-collection.txt force=yes
- name: Check if collections exist
uri:
url: "http://{{ solr_config_host }}:{{ solr_port }}/solr/admin/collections?action=LIST&wt=json"
return_content: true
register: solr_collections
delegate_to: "{{ solr_node.stdout if deployment_type == 'swarm' else inventory_hostname }}"
tags:
- solrcloud_create_collection
ignore_errors: true
run_once: true
when: solrcloud_config_create_biocache_collection == True
- solrcloud_config
- zookeeper_config

- name: Create biocache collection
get_url: url="http://{{ solr_config_host }}:{{ solr_port }}/solr/admin/collections?action=CREATE&name=biocache&maxShardsPerNode=2&numShards={{ solrcloud_num_shards | default(4)}}&replicationFactor={{ solr_hosts | default(2) }}&collection.configName=biocache" dest=/tmp/create-collection.txt force=yes timeout=30
tags:
- solrcloud_create_collection
- name: Create SolrCloud collections if they don't exist
uri:
url: "http://{{ solr_config_host }}:{{ solr_port }}/solr/admin/collections"
method: POST
body_format: form-urlencoded
body:
action: CREATE
name: "{{ item.collection_name }}"
numShards: "{{ solrcloud_num_shards | default(4) }}"
replicationFactor: "{{ solr_hosts | default(2) }}"
collection.configName: "{{ item.configset_name }}"
when: item.collection_name not in solr_collections.content | from_json | json_query("collections")
delegate_to: "{{ solr_node.stdout if deployment_type == 'swarm' else inventory_hostname }}"
run_once: true
when: solrcloud_config_create_biocache_collection == True
loop:
- {collection_name: "biocache", configset_name: "biocache"}
- {collection_name: "bie", configset_name: "bie"}
- {collection_name: "bie-offline", configset_name: "bie"}
tags:
- solrcloud_config
- zookeeper_config