Deploy search engine#359
Conversation
… using ansible playbooks
|
After copying the vars files to match the name of the group and removing the variable pointing to a local path (idr-ansible) (base) sbesson@ls30630:ansible ((db001bb...)) $ diff group_vars/searchengine_vars.yml group_vars/management-hosts.yml
11d10
< ansible_python_interpreter: path/to/bin/pythonthe playbook executed until Possible options to move forward are:
|
|
auto_remove instructs to delete the container after it runs. I think we may comment on it for the time being, what do you think? |
|
Agreed, let's comment it out and come back to it later in the testing. |
|
Sorry, I should mention before that I have commented on auto_remove and push the playbooks yesterday. |
|
Added a minimal configuration allowing to proxy the 5567 port under the Following this morning's discussion, we are currently running into two issues:
|
…aching and set secret key for search engine and client
|
sbesson
left a comment
There was a problem hiding this comment.
With the last set of commits, I was able to successfully deploy the search engine application and launch the indexing/caching processes on a fresh test104 deployment.
The following local changes to the idr-proxy.yml playbook/variables were also applied to deploy the client under the /searchengine endpoint:
diff --git a/ansible/group_vars/proxy-hosts.yml b/ansible/group_vars/proxy-hosts.yml
index e082a821..63dc5cd8 100644
--- a/ansible/group_vars/proxy-hosts.yml
+++ b/ansible/group_vars/proxy-hosts.yml
@@ -38,6 +38,8 @@ nginx_proxy_upstream_servers:
servers: "{{ omero_omeroreadonly_hosts_external | map('regex_replace', '^(.*)$', '\\1:4065') | sort }}"
- name: omeroreadwrite
servers: "{{ omero_omeroreadwrite_hosts }}"
+- name: searchengine
+ servers: "{{ searchengine_hosts | map('regex_replace', '^(.*)$', '\\1:5567') | sort }}"
# The regex is getting complicated, so unroll it into a list and join
_nginx_proxy_omero_locations:
@@ -100,11 +102,19 @@ _nginx_proxy_backends_prometheus_federate:
server: "http://{{ management_host_ansible | default('localhost') }}:9090/federate"
cache_validity: 15s
+_nginx_proxy_backends_searchengine:
+- name: prometheusfederate
+ location: "^~ /searchengine"
+ server: http://searchengine/
+ host_header: "$host/searchengine"
+
+
nginx_proxy_backends: >
{{ _nginx_proxy_backends_omero +
_nginx_proxy_backends_omerowebsockets +
_nginx_proxy_backends_grafana_render +
- _nginx_proxy_backends_prometheus_federate
+ _nginx_proxy_backends_prometheus_federate +
+ _nginx_proxy_backends_searchengine
}}
diff --git a/ansible/idr-proxy.yml b/ansible/idr-proxy.yml
index edc0db47..adb601f2 100644
--- a/ansible/idr-proxy.yml
+++ b/ansible/idr-proxy.yml
@@ -61,6 +61,12 @@
idr_environment | default('idr') + '-management-hosts'][0]]
['ansible_' + (idr_net_iface | default('eth0'))]['ipv4']['address']
}}
+ searchengine_hosts: >-
+ {{
+ groups[idr_environment | default('idr') + '-management-hosts'] |
+ map('extract', hostvars,
+ ['ansible_' + (idr_net_iface | default('eth0')), 'ipv4', 'address']) | list
+ }}
when: groups[idr_environment | default('idr') + '-management-hosts'] is defined
roles:A few inline comments and the client probably needs some testing once the indexing/caching has completed.
From a code perspective, I think we are approaching thew point where this playbook can be safely merged into the repository. Importantly, as things stand, this app is not included by default and needs to be deployed manually. Probably the biggest question for the IDR team is whether we would consider deploying it on all prod deployment as an experimental endpoint and/or the steps to move towards this target.
| database_user_password: "{{ idr_secret_postgresql_password_ro | default('omero') }}" | ||
| searchenginecache_folder: /data/searchengine/searchengine/cacheddata/ | ||
| search_engineelasticsearch_docker_image: docker.elastic.co/elasticsearch/elasticsearch:7.16.2 | ||
| searchengine_docker_image: openmicroscopy/omero-searchengine:latest |
There was a problem hiding this comment.
For a deployment from scratch this will do the job but as soon as we want to update Docker image, it will be preferable to use named tagged images rather than latest.
| searchengine_index: searchengine_index | ||
| cache_rows: 10000 | ||
| # I think that the following two variables should be in secret | ||
| searchengine_secret_key: "fagfdssf3fgdnvhg56ghhgfhgfgh45f" |
There was a problem hiding this comment.
Proposing to update the valoue of these keys and migrate them as private variables
| * If the Postgresql database server is located at the same machine which hosts the searchengine, it is needed to: | ||
| * Edit pg_hba.conf file (one of the postgresql configuration files) and add two client ips (i.e. 10.11.0.10 and 10.11.0.11) | ||
| * Reload the configuration; so the PostgreSQL accepts the connection from indexing and caching services. | ||
| * As the caching and indexing processes take a long time, there are another two playbooks that enable the user to check if they have finished or not: |
There was a problem hiding this comment.
Unlike the service set-up playbook, I am less convinced of the value of running and checking the indexing/caching via Ansible playbooks.
Unless there is an obvious alternative, happy to keep things as they are right now and revisit this behaviorin the future. I suspect this will become apparent as we start run these workflows during the app lifecycle e.g. before release.
…ervice as all the cached data now is saved in Elasticsearch.
|
I have pushed changes to run on the searchengine-hosts group and removed hdf5 caching service as all the cached data now is saved in Elasticsearch. |
|
I have renamed the files and increased cache_rows to 50000, I think we can increase it more than that. |
This reverts commit 4781f0f.
|
I have reverted renaming dockermanager-hosts.yml and renamed the files |
sbesson
left a comment
There was a problem hiding this comment.
With the change to the hosts section of idr-searchengine.yml, I was able to deploy the searchengine stack on pilot-idr0000 and start the indexing process which completed in ~12h.
|
These are the modifications to fix the issues of displaying swagger documents using the searchengineapi url I have added a variable to the "searchengine-hosts.yml"; its value equals the URL prefix part (searchengineapi) It will be used to set the script_name when running the gunicorn Also, I have changed the Nginx configuration at the searchengineapi section
|
sbesson
left a comment
There was a problem hiding this comment.
With the latest set of changes and #367, I was able to successfully deploy the search engine stack onto a newly create pilot using the new group.
The API is available when forwarding the port 5577 and the client is available when accessing the port 5556.
The playbook is currently set up so that it will only run when executed manually against VMs with the correct groups.
As discussed this morning as part of the weekly IDR call, merging this so that we can make incremental progresses towards a production release of the new service via smaller PRs. I will capture the outstanding issues as todos.
I have added playbooks to deploy searchengine, searchengine client and ELasticsearch.
"management-searchengine.yml" is used to configure and run all three applications.
There is a variables file (searchengine_vars.yml) that the user needs to customize before running the playbook
After deploying the apps using the playbook, it is needed to run another playbook (run_searchengine_index_cache_services.yml) for caching and indexing
As the caching and indexing processes take a long time, there are another two playbooks that enable the user to check if they have finished or not i.e. check_indexing_service.yml and check_caching_service.yml.