Skip to content

Commit

Permalink
Merge pull request #5 from khaledk2/new_ms_release
Browse files Browse the repository at this point in the history
New ms release
  • Loading branch information
jburel authored Sep 5, 2024
2 parents a007606 + 859aca8 commit 64540e9
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 52 deletions.
80 changes: 55 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
OMERO MS Image Region
=====================

[![Actions Status](https://github.com/ome/ansible-role-omero-server/workflows/Molecule/badge.svg)](https://github.com/ome/ansible-role-omero-server/actions)
[![Ansible Role](https://img.shields.io/badge/ansible--galaxy-omero_ms_image_region-blue.svg)](https://galaxy.ansible.com/ui/standalone/roles/ome/omero_server/)
[![Actions Status](https://github.com/ome/ansible-role-omero-ms-image-region/workflows/Molecule/badge.svg)](https://github.com/ome/ansible-role-omero-ms-image-region/actions)
[![Ansible Role](https://img.shields.io/badge/ansible-galaxy-omero_ms_image_region-blue.svg)](https://galaxy.ansible.com/ui/standalone/roles/ome/omero_ms_image_region/)

Installs and configures OMERO ms image region
Installs and configures the OMERO microservice image region.

Dependencies
------------
Expand All @@ -15,31 +15,31 @@ OMERO.server and OMERO.web are required.
Role Variables
--------------

- omero_ms_image_region_user: Microservice user, the defaults is 'omero-server'
- omero_ms_image_region_folder: Microservice installation folder
- omero_ms_image_region_port: Microservice port
- omero_ms_image_region_db_url: OMERO database URL
- omero_ms_image_region_db_port: OMERO database server port
- omero_ms_image_region_db_name: OMERO database name
- omero_ms_image_region_db_username: OMERO database user name
- omero_ms_image_region_db_pass: OMERO database user password
- omero_ms_image_region_log_level: Logging level, allowed values: ``info``, ``debug``, ``error``
- omero_data_dir: OMERO data folder
- omero_script_repo_root: OMERO scripts folder
- omero_ms_image_region_worker_pool_size: No of Microservice workers, the default is double the number of processors which the machine has
- session_id: OMERO Session id, if you do not know it, you may get it using this command:
- omero_ms_image_region_max_active_channels: Max number of channels to allow per request default is 10
- `omero_ms_image_region_user`: The microservice user, the default is `omero-server`
- `omero_ms_image_region_folder`: The microservice installation folder
- `omero_ms_image_region_port`: The microservice port
- `omero_ms_image_region_db_url`: The OMERO database URL
- `omero_ms_image_region_db_port`: The OMERO database server port
- `omero_ms_image_region_db_name`: The OMERO database name
- `omero_ms_image_region_db_username`: The OMERO database user name
- `omero_ms_image_region_db_pass`: The OMERO database user password
- `omero_ms_image_region_log_level`: The logging level, allowed values: ``info``, ``debug``, ``error``
- `omero_data_dir`: The OMERO data folder
- `omero_script_repo_root`: The OMERO scripts folder
- `omero_ms_image_region_worker_pool_size`: Number of microservice workers, the default is double the number of available processors
- `session_id`: The OMERO session identifier, if you do not know it, you may get it using this command:

/opt/omero/web/OMERO.web/bin/omero config get omero.web.session_cookie_name
/opt/omero/web/OMERO.web/bin/omero config get omero.web.session_cookie_name

- omero_ms_image_region_update_nginx: if false, it will not update the nginx config file
- `omero_ms_image_region_max_active_channels`: The maximum number of channels to allow per request, the default is `10`
- `omero_ms_image_region_update_nginx`: if set to `false`, it will not update the NGINX configuration file
- `omero_ms_image_region_download_URL`: The download URL for the distributed microservice build (zip file)
- `omero_ms_image_region_package_sha256`: The sha256 for the distributed microservice build
- `java_version`: The Java version matching the server version. Supported versions are 11, 17 and 21

- omero_ms_image_region_download_URL: The download URl for the distibuted ms build (zip file)
- omero_ms_image_region_package_sha256: The sha256 for the distibuted ms build

The ms build should be compatible with the installed OMERO.server, i.e.:
- The bio-format version for the Microservice should match the Bio-Formats version of the OMERO.server
- Also, in case of using ngff data, the version of OMEZarrReader should be the same for both of the Microsevice and the OMERO.server.
The microservice build **must be compatible** with the installed OMERO.server:
- The Bio-Formats version used in the microservice must match the Bio-Formats version of the OMERO.server.
- Also, in the case of using NGFF data, the version of OMEZarrReader should be the same for both the Microsevice and the OMERO.server.

Example Playbook
----------------
Expand All @@ -48,3 +48,33 @@ Example Playbook
roles:
- role: ome.omero_ms_image_region
omero_ms_image_region_update_nginx: true

Another example:
----------------
The following example is used to deploy in multiple nodes and configure the microservice download url and other roles variables.
For example, it can be used to deploy the microservice on the IDR omeroreadonly servers. The variable values inside the playbook should be modified for the IDR environment in which the microservice will be deployed.

- hosts: nodes
become: true

roles:
- role: ome.omero_ms_image_region
omero_ms_image_region_update_nginx: true
omero_ms_image_region_db_url: databse_url
omero_ms_image_region_db_name: database_name
omero_ms_image_region_db_username: database_username
omero_ms_image_region_db_pass: database_password
omero_data_dir: /data/OMERO
omero_ms_image_region_session_id: sessionid
# URL pointing to the micro service omero-ms-region-download
# It is important to have a version of the micro service using a version of Bio-Formats and OMEZarrReader that
# match the versions running on the server
omero_ms_image_region_download_URL: 'https://github.com/ome/omero-ms-image-region/releases/download/2024.07.15/omero-ms-image-region-0.10.0_b16.zip'
# sha256 for the Latest build
omero_ms_image_region_package_sha256: 77bd3df2241c2beb439001fb00bfd8b207a06de63b8ee78c7170916d6dde963e


Author Information
------------------

[email protected]
19 changes: 15 additions & 4 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,22 @@ omero_ms_image_region_session_id: 'sessionid'
# Controls updating of the nginx config file (omero-web.conf). If False, the file does not get update
omero_ms_image_region_update_nginx: false

# Microservice download URL should be updated to match Bio-Formats versions of the Microservice and OMERO.server.
#Also, the OMEZarrReader (if NGFF is used) versions of the Microservice and OMERO.server must match.
omero_ms_image_region_download_URL: 'https://github.com/khaledk2/ice-archh-64/releases/download/new_tag/omero-ms-image-region-0.8.7.zip'
java_version: 11

all_omero_ms_image_region_download_URL:
11:
url: "https://github.com/ome/omero-ms-image-region/releases/download/2024.08.13/omero-ms-image-region-0.10.0_11.zip"
sha256: f45fb83cf55b4c87bb15b58a5c314ebd355d59cab9225d1bb598130d32fb86d9
17:
url: "https://github.com/ome/omero-ms-image-region/releases/download/2024.08.13/omero-ms-image-region-0.10.0_17.zip"
sha256: 694114e67dfe20f5d03803591e37e20e9835b3247d26bcc3534876711ec3a4a9
21:
url: "https://github.com/ome/omero-ms-image-region/releases/download/2024.08.13/omero-ms-image-region-0.10.0_21.zip"
sha256: 9f80c421ae6a746a8bf1199b65425e0616d539b26979a41220056d9e10bf7723

omero_ms_image_region_download_URL: "{{ all_omero_ms_image_region_download_URL[java_version]['url'] }}"
omero_ms_image_region_package_sha256: "{{ all_omero_ms_image_region_download_URL[java_version]['sha256'] }}"

omero_ms_image_region_package_sha256: 9da1606fb1141b1044e0544451c92305710bca4c378febf003214b920ff510d2

omero_ms_image_region_name: "{{ omero_ms_image_region_download_URL | basename }}"

Expand Down
2 changes: 1 addition & 1 deletion handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- name: restart omero-ms-image-region service
become: true
ansible.builtin.service:
state: started
state: restarted
daemon_reload: true
name: omero-ms-image-region.service

Expand Down
3 changes: 3 additions & 0 deletions molecule/resources/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
password: omero
databases: [ omero ]

- role: ome.java
java_versions: 11

- role: ome.omero_server
omero_server_release: 5.6.10
postgresql_version: "14"
Expand Down
1 change: 1 addition & 0 deletions molecule/resources/requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
- src: ome.omero_server
- src: ome.postgresql
- src: ome.omero_web
- src: ome.java
20 changes: 7 additions & 13 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
- import_tasks: pre_tasks.yml
when:
- stat_ssh256.stat.checksum is undefined or omero_ms_image_region_package_sha256 != stat_ssh256.stat.checksum
- not stat_result.stat.exists

- name: omero-ms-image-region | set redis uri in protected mode
ansible.builtin.set_fact:
Expand All @@ -33,35 +32,28 @@

- name: omero-ms-image-region | copy config file
become: true
become_user: "{{ omero_ms_image_region_user }}"
ansible.builtin.template:
dest: "{{ omero_ms_image_region_folder }}/omero-ms-image-region/conf/config.yaml"
src: config.yaml.j2
notify:
- enable omero-ms-image-region service
- restart omero-ms-image-region service

- name: omero-ms-image-region | copy log config file
become: true
become_user: "{{ omero_ms_image_region_user }}"
ansible.builtin.template:
dest: "{{ omero_ms_image_region_folder }}/omero-ms-image-region/conf/logback.xml"
src: logback.xml.j2


- name: omero-ms-image-region | copy run.sh
become: true
become_user: "{{ omero_ms_image_region_user }}"
ansible.builtin.template:
dest: "{{ omero_ms_image_region_folder }}/omero-ms-image-region/run.sh"
src: run.sh.j2
mode: +x

- name: omero-ms-image-region | copy stop.sh
become: true
become_user: "{{ omero_ms_image_region_user }}"
ansible.builtin.template:
dest: "{{ omero_ms_image_region_folder }}/omero-ms-image-region/stop.sh"
src: stop.sh.j2
mode: +x

- name: omero-ms-image-region | systemd service
- name: omero-ms-image-region | copy systemd service
become: true
ansible.builtin.template:
dest: /etc/systemd/system/omero-ms-image-region.service
Expand All @@ -73,6 +65,8 @@

- name: omero-ms-image-region | selinux http_port_t for ms port
become: true
ignore_errors: true

ansible.builtin.seport:
ports: "{{ omero_ms_image_region_port }}"
proto: tcp
Expand Down
8 changes: 7 additions & 1 deletion tasks/pre_tasks.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
---
- name: omero-ms-image-region | delete ms folder if it exists
become: true
ansible.builtin.file:
path: "{{ omero_ms_image_region_folder }}"
state: absent
when: stat_result.stat.exists

- name: omero-ms-image-region | create ms folder
become: true
Expand All @@ -16,7 +22,7 @@
deploy_archive_sha256: "{{ omero_ms_image_region_package_sha256 }}"
deploy_archive_symlink: "{{ omero_ms_image_region_folder }}/omero-ms-image-region"
deploy_archive_internal_root: >-
omero-ms-image-region-0.8.7
{{ omero_ms_image_region_name | splitext | first | replace(java_version,'') | replace('_','') }}
- name: omero-ms-image-region | chown to ms-user
become: true
Expand Down
5 changes: 2 additions & 3 deletions templates/omero-ms-image-region.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ Requires=redis.service
After=network.service

[Service]
USER=omero-server
User=omero-server
UMask=0002
Type=simple
WorkingDirectory={{ omero_ms_image_region_folder }}/omero-ms-image-region
ExecStart={{ omero_ms_image_region_folder }}/omero-ms-image-region/run.sh
ExecStop={{ omero_ms_image_region_folder }}/omero-ms-image-region/stop.sh
ExecStart=/bin/bash {{ omero_ms_image_region_folder }}/omero-ms-image-region/run.sh
Restart=always
RestartSec=3

Expand Down
5 changes: 3 additions & 2 deletions templates/omero-web.conf.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
proxy_cache_path /tmp/cache levels=1:2 keys_zone=ms_cache:10m max_size={{ nginx_cache_max_size }} inactive={{ nginx_cache_inactive_time }} use_temp_path=off;

upstream image_region_backend {
server 127.0.0.1:{{ omero_ms_image_region_port }} git push
proxy_cache_path /tmp/cache levels=1:2 keys_zone=ms_cache:10m max_size={{ nginx_cache_max_size }} inactive={{ nginx_cache_inactive_time }} use_temp_path=off;
server 127.0.0.1:{{ omero_ms_image_region_port }} fail_timeout=0 max_fails=0;
}

{{ nginx_contents['content'] | b64decode | regex_replace('}$', '') }}

Expand Down
2 changes: 1 addition & 1 deletion templates/run.sh.j2
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#! /bin/bash
sudo -u {{ omero_ms_image_region_user }} JAVA_OPTS="-Dlogback.configurationFile=conf/logback.xml" bash bin/omero-ms-image-region
JAVA_OPTS="-Dlogback.configurationFile=conf/logback.xml" bash bin/omero-ms-image-region
2 changes: 0 additions & 2 deletions templates/stop.sh.j2

This file was deleted.

0 comments on commit 64540e9

Please sign in to comment.