Skip to content

Commit 9236200

Browse files
authored
Merge pull request #2 from khaledk2/adjust_vars
Adjust vars
2 parents 9fa0511 + bcead8e commit 9236200

File tree

10 files changed

+47
-89
lines changed

10 files changed

+47
-89
lines changed

defaults/main.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,23 @@ cache_rows: 1000
1616
# I think that the following two variables should be in secret
1717
searchengine_secret_key: search_engine_secret_key
1818
searchengineurlprefix: "searchengine"
19-
IDR_TEST_FILE_URL: "https://raw.githubusercontent.com/IDR/idr.openmicroscopy.org/master/_data/studies.tsv"
19+
idr_test_file_url: "https://raw.githubusercontent.com/IDR/idr.openmicroscopy.org/master/_data/studies.tsv"
2020
elasticsearch_no_nodes: 3
2121
# This should be a separate volume, cloned as part of the routine deployment process.
2222
elasticsearch_backup_folder: "/searchengine_backup"
2323
ca_password: "ca_password"
2424
keystore_password: "keystore_password"
25-
ELASTIC_PASSWORD: "elastic_password"
26-
REDIS_PORT: 6379
27-
REDIS_URL: 10.11.0.15
28-
ASYNCHRONOUS_SEARCH: true
29-
CACHE_FOLDER: /etc/searchengine/cachedata
30-
DATA_DUMP_FOLDER: /data/data_dump/
31-
DEFAULT_DATASOURCE: data_source
25+
elastic_password: "elastic_password"
26+
redis_port: 6379
27+
redis_url: 10.11.0.15
28+
asynchronous_search: true
29+
cache_folder: /etc/searchengine/cachedata
30+
data_dump_folder: /data/data_dump/
3231
elasticsearch_nodes: [ ]
3332
instances_nodes: []
3433
instances: {}
35-
NGINX_PORT: 8080
36-
ES_JAVA_OPTIONS: "-Xms2g -Xmx2g"
34+
nginx_port: 8080
35+
es_java_options: "-Xms2g -Xmx2g"
3736
no_index_processes: 2
3837
test_mode: false
39-
QUIRES_FOLDER: quires/
38+
quires_folder: quires/

molecule/resources/playbook.yml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,11 @@
11
---
22
- name: Converge
33
hosts: all
4-
tasks:
5-
6-
#- name: install redis
7-
# ansible.builtin.dnf:
8-
# name: redis
9-
# state: present
10-
# become: yes
11-
12-
#- name: disable installed redis service installed on the host
13-
# ansible.builtin.systemd_service:
14-
# name: redis
15-
# state: stopped
16-
# enabled: false
17-
# become: yes
184

195
roles:
206
- role: ome.omero_searchengine
21-
ES_JAVA_OPTIONS: "-Xms512m -Xmx512m"
7+
es_java_options: "-Xms512m -Xmx512m"
228
elasticsearch_no_nodes: 1
23-
ELASTIC_PASSWORD: my_password
9+
elastic_password: my_password
2410
test_mode: true
2511

molecule/resources/tests/test_default.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,6 @@ def test_search_elastic_connection(host):
1616
'curl -I -k -u "elastic:my_password" https://127.0.0.1:9201/image_keyvalue_pair_metadata_1')
1717
assert '200' in out
1818

19-
#https://127.0.0.1:9201/image_keyvalue_pair_metadata_1
20-
#def test_nginx_gateway(host):
21-
# out = host.check_output('curl -XGET http://127.0.0.1:8080/searchengine/api/v1/resources/')
22-
# assert 'OMERO search engine (API V1)' in out
23-
24-
#def test_redis_connection(host):
25-
# out = host.check_output('redis-cli ping')
26-
# assert 'PONG' in out
27-
2819
def test_searchengine_connection(host):
2920
out = host.check_output('curl -XGET http://127.0.0.1:5577/searchengine/api/v1/resources/')
3021
assert 'OMERO search engine (API V1)' in out

tasks/elasticsearch.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,11 @@
125125
#ES_JAVA_OPTS: "{{ ES_JAVA_OPTIONS }}"
126126
#this one should be added when the cluster is only one node
127127
# discovery.type: single-node
128-
ES_JAVA_OPTS: " {{ ES_JAVA_OPTIONS }}"
128+
ES_JAVA_OPTS: " {{ es_java_options }}"
129129
ingest.geoip.downloader.enabled: "false"
130130
########################################
131131
es_api_basic_auth_username: "elastic"
132-
ELASTIC_PASSWORD: "{{ ELASTIC_PASSWORD }}"
132+
ELASTIC_PASSWORD: "{{ elastic_password }}"
133133
es_validate_certs: "no"
134134
es_enable_http_ssl: "true"
135135
xpack.security.http.ssl.enabled: "true"
@@ -187,11 +187,11 @@
187187
#ES_JAVA_OPTS: "{{ ES_JAVA_OPTIONS }}"
188188
#this one should be added when the cluster is only one node
189189
discovery.type: single-node
190-
ES_JAVA_OPTS: " {{ ES_JAVA_OPTIONS }}"
190+
ES_JAVA_OPTS: " {{ es_java_options }}"
191191
ingest.geoip.downloader.enabled: "false"
192192
########################################
193193
es_api_basic_auth_username: "elastic"
194-
ELASTIC_PASSWORD: "{{ ELASTIC_PASSWORD }}"
194+
ELASTIC_PASSWORD: "{{ elastic_password }}"
195195
es_validate_certs: "no"
196196
es_enable_http_ssl: "true"
197197
xpack.security.http.ssl.enabled: "true"
@@ -260,11 +260,11 @@
260260
http.host: 0.0.0.0
261261
#http.port: 9200
262262
#ES_JAVA_OPTS: "-Xms1g -Xmx1g"
263-
ES_JAVA_OPTS: " {{ ES_JAVA_OPTIONS }}"
263+
ES_JAVA_OPTS: " {{ es_java_options }}"
264264
ingest.geoip.downloader.enabled: "false"
265265
####################################################################
266266
es_api_basic_auth_username: "elastic"
267-
ELASTIC_PASSWORD: "{{ ELASTIC_PASSWORD }}"
267+
ELASTIC_PASSWORD: "{{ elastic_password }}"
268268
es_validate_certs: "no"
269269
es_enable_http_ssl: "true"
270270
xpack.security.http.ssl.enabled: "true"

tasks/main.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,15 @@
88
state: present
99
become: true
1010

11-
- name: update curl and ca certificates
12-
ansible.builtin.dnf:
13-
name:
14-
- curl
15-
- ca-certificates
16-
# - requests
17-
state: latest
18-
allowerasing: true
19-
become: true
20-
21-
2211
- name: Ensure python3-requests is installed
2312
ansible.builtin.package:
2413
name: python3-requests
2514
state: present
2615
become: yes
2716

28-
2917
- name: Import ome.docker role
3018
ansible.builtin.import_role:
3119
name: ome.docker
32-
#vars:
33-
# docker_systemd_setup: false
3420

3521

3622
- name: Check if a elastic node data folder exists
@@ -114,10 +100,6 @@
114100
when: not elastic_node_data_folder.stat.exists
115101

116102

117-
#- name: deploy optm.yml
118-
# ansible.builtin.include_tasks: optm.yml
119-
# when: not elastic_node_data_folder.stat.exists
120-
121103
- name: deploy elasticsearch cluster
122104
ansible.builtin.include_tasks: elasticsearch.yml
123105
when: not elastic_node_data_folder.stat.exists

tasks/nginx.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,26 @@
3838
- name: host
3939

4040
published_ports:
41-
- "{{ NGINX_PORT }}:{{ NGINX_PORT }}"
41+
- "{{ nginx_port }}:{{ nginx_port }}"
4242
volumes:
4343
- "{{ apps_folder }}/searchengine/nginx/conf.d/searchengine.conf:/etc/nginx/conf.d/searchengine.conf"
4444
- "{{ apps_folder }}/searchengine/nginx/log:/var/log/nginx"
45-
- "{{ apps_folder }}/data_dump:{{ DATA_DUMP_FOLDER }}"
45+
- "{{ apps_folder }}/data_dump:{{ data_dump_folder }}"
4646
state: started
4747
restart_policy: always
4848
tags: [always, nginx]
4949

5050

51+
- name: copy adjust containers files script to the host machine
52+
ansible.builtin.template:
53+
src: adjust_containers_files.sh.j2
54+
dest: /tmp/adjust_containers_files.sh
55+
mode: '0755'
56+
tags: [never, set_nginx_containers_files]
57+
58+
- name: Execute the templated script
59+
become: yes
60+
ansible.builtin.command: bash /tmp/adjust_containers_files.sh
61+
tags: [never, set_nginx_containers_files]
5162

5263
# always qq

tasks/redis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
ipv4_address: 10.11.0.15
2121
# network_mode: "host"
2222
published_ports:
23-
- "6379:6379"
23+
- "{{ redis_port }}:6379"
2424
volumes:
2525
- "{{ apps_folder }}/searchengine/data_dump/redis:/var/lib/redis"
2626
restart_policy: always

tasks/searchengine.yml

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
name: searchengine_IDR_TEST_FILE
127127
cleanup: True
128128
auto_remove: yes
129-
command: "set_idr_test_file -i {{ IDR_TEST_FILE_URL }}"
129+
command: "set_idr_test_file -i {{ idr_test_file_url }}"
130130
state: started
131131
volumes:
132132
- "{{ apps_folder }}/searchengine/searchengine/:/etc/searchengine/"
@@ -139,7 +139,7 @@
139139
name: searchengine_cache
140140
cleanup: True
141141
auto_remove: yes
142-
command: "set_cache_folder -c /etc/searchengine/cachedata"
142+
command: "set_cache_folder -c {{ cache_folder }}"
143143
#networks:
144144
#- name: searchengine-net
145145
#published_ports:
@@ -156,7 +156,7 @@
156156
name: searchengine_quries_folder
157157
cleanup: True
158158
auto_remove: yes
159-
command: "set_queries_folder -q {{ QUIRES_FOLDER }}"
159+
command: "set_queries_folder -q {{ quires_folder }}"
160160
#networks:
161161
#- name: searchengine-net
162162
#published_ports:
@@ -188,7 +188,7 @@
188188
cleanup: True
189189
auto_remove: yes
190190
#auto_remove: yes
191-
command: "set_data_dump_folder -d {{ DATA_DUMP_FOLDER }}"
191+
command: "set_data_dump_folder -d {{ data_dump_folder }}"
192192
state: started
193193
volumes:
194194
- "{{ apps_folder }}/searchengine/searchengine/:/etc/searchengine/"
@@ -216,7 +216,7 @@
216216
cleanup: True
217217
auto_remove: yes
218218
#auto_remove: yes
219-
command: "set_elasticsearch_password -e {{ ELASTIC_PASSWORD }}"
219+
command: "set_elasticsearch_password -e {{ elastic_password }}"
220220
state: started
221221
volumes:
222222
- "{{ apps_folder }}/searchengine/searchengine/:/etc/searchengine/"
@@ -230,7 +230,7 @@
230230
cleanup: True
231231
auto_remove: yes
232232
#auto_remove: yes
233-
command: "set_redis_url -r {{ REDIS_URL }}"
233+
command: "set_redis_url -r {{ redis_url }}"
234234
state: started
235235
volumes:
236236
- "{{ apps_folder }}/searchengine/searchengine/:/etc/searchengine/"
@@ -408,7 +408,7 @@
408408
image: "{{ searchengine_docker_image }}"
409409
name: dump_projects_BFF
410410
cleanup: True
411-
command: "dump_searchengine_data -d {{ default_datasource }} -r project -b True -t {{ DATA_DUMP_FOLDER }}/{{ default_datasource }}/csv_bff -o True"
411+
command: "dump_searchengine_data -d {{ default_datasource }} -r project -b True -t {{ data_dump_folder }}/{{ default_datasource }}/csv_bff -o True"
412412
#dump_searchengine_data -d idr -r project -b True -t /data/data_dump/idr/csv_bff -o True
413413
networks:
414414
- name: searchengine-net
@@ -428,7 +428,7 @@
428428
image: "{{ searchengine_docker_image }}"
429429
name: dump_screens_BFF
430430
cleanup: True
431-
command: "dump_searchengine_data -d {{ default_datasource }} -r screen -b True -t {{ DATA_DUMP_FOLDER }}/{{ default_datasource }}/csv_bff -o True"
431+
command: "dump_searchengine_data -d {{ default_datasource }} -r screen -b True -t {{ data_dump_folder }}/{{ default_datasource }}/csv_bff -o True"
432432
networks:
433433
- name: searchengine-net
434434
#restart: "{{ searchengine_conf_status | changed }}"
@@ -439,16 +439,3 @@
439439
- "{{ apps_folder }}/searchengine/searchengine/logs/:/opt/app-root/src/logs/"
440440
- "{{ apps_folder }}/data_dump:/data/data_dump"
441441
tags: [never, bff_screens]
442-
443-
- name: copy adjust containers files script to the host machine
444-
ansible.builtin.template:
445-
src: adjust_containers_files.sh.j2
446-
dest: /tmp/adjust_containers_files.sh
447-
mode: '0755'
448-
tags: [never, set_nginx_containers_files]
449-
450-
- name: Execute the templated script
451-
become: yes
452-
ansible.builtin.command: bash /tmp/adjust_containers_files.sh
453-
tags: [never, set_nginx_containers_files]
454-
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
find {{ DATA_DUMP_FOLDER }}/{{ default_datasource }}/csv_bff -type d -exec chmod 755 {} \;
2-
find {{ DATA_DUMP_FOLDER }}/{{ default_datasource }}/csv_bff -type f -exec chmod 644 {} \;
3-
chown -R nginx:nginx {{ DATA_DUMP_FOLDER }}/{{ default_datasource }}/csv_bff
4-
chcon -Rt httpd_sys_content_t {{ DATA_DUMP_FOLDER }}/{{ default_datasource }}/csv_bff
1+
#!/bin/sh
2+
3+
find {{ data_dump_folder }}/{{ default_datasource }}/csv_bff -type d -exec chmod 755 {} \;
4+
find {{ data_dump_folder }}/{{ default_datasource }}/csv_bff -type f -exec chmod 644 {} \;
5+
chown -R nginx:nginx {{ data_dump_folder }}/{{ default_datasource }}/csv_bff
6+
chcon -Rt httpd_sys_content_t {{ data_dump_folder }}/{{ default_datasource }}/csv_bff

templates/searchengine.conf.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22

33
server {
4-
listen {{ NGINX_PORT }};
4+
listen {{ nginx_port }};
55

66
location /searchengine {
77

0 commit comments

Comments
 (0)