From be603fcaa478d7881b6f42c027d1a962b1fe45cb Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo Date: Fri, 28 Oct 2022 10:39:17 +0200 Subject: [PATCH 01/18] add es reindex service --- roles/search_enterprise/tasks/main.yml | 8 +++++++ ...elasticsearch-connector-reindex.service.j2 | 24 +++++++++++++++++++ .../elasticsearch-connector.service.j2 | 5 ++++ 3 files changed, 37 insertions(+) create mode 100644 roles/search_enterprise/templates/elasticsearch-connector-reindex.service.j2 diff --git a/roles/search_enterprise/tasks/main.yml b/roles/search_enterprise/tasks/main.yml index 3d6c97892..0d29c5f69 100644 --- a/roles/search_enterprise/tasks/main.yml +++ b/roles/search_enterprise/tasks/main.yml @@ -44,3 +44,11 @@ notify: - enable elasticsearch-connector service - restart elasticsearch-connector service + + - name: Add elasticsearch-connector reindex service + template: + src: elasticsearch-connector-reindex.service.j2 + dest: /etc/systemd/system/elasticsearch-connector-reindex.service + owner: root + group: root + mode: "0640" diff --git a/roles/search_enterprise/templates/elasticsearch-connector-reindex.service.j2 b/roles/search_enterprise/templates/elasticsearch-connector-reindex.service.j2 new file mode 100644 index 000000000..5fe3cbce8 --- /dev/null +++ b/roles/search_enterprise/templates/elasticsearch-connector-reindex.service.j2 @@ -0,0 +1,24 @@ +[Unit] +Description=Alfresco Enterprise Search - Reindex job +After=syslog.target network.target remote-fs.target nss-lookup.target + +[Service] +Type=oneshot + +User={{ username }} + +Environment=SPRING_ELASTICSEARCH_REST_URIS={{ elasticsearch_protocol }}://{{ elasticsearch_host }}:{{ ports_cfg.elasticsearch.http }} +Environment=SPRING_ELASTICSEARCH_REST_USERNAME={{ elasticsearch_username }} +Environment=SPRING_ELASTICSEARCH_REST_PASSWORD={{ elasticsearch_password }} + +Environment=ELASTICSEARCH_INDEXNAME=alfresco + +Environment=ALFRESCO_SHAREDFILESTORE_BASEURL=http://{{ sfs_host }}:{{ ports_cfg.sfs.http }}/alfresco/api/-default-/private/sfs/versions/1/file +Environment=ALFRESCO_ACCEPTED_CONTENT_MEDIA_TYPES_CACHE_BASE_URL=http://{{ trouter_host }}:{{ ports_cfg.transformers.trouter }}/transform/config + +ExecStart={{ java_home }}/bin/java -jar {{ search_enterprise_binaries_dir }}/alfresco-elasticsearch-reindexing-{{ search_enterprise.version }}-app.jar + +WorkingDirectory={{ search_enterprise_binaries_dir }} + +[Install] +WantedBy=multi-user.target diff --git a/roles/search_enterprise/templates/elasticsearch-connector.service.j2 b/roles/search_enterprise/templates/elasticsearch-connector.service.j2 index 2e12b9fc4..8d8d7245d 100644 --- a/roles/search_enterprise/templates/elasticsearch-connector.service.j2 +++ b/roles/search_enterprise/templates/elasticsearch-connector.service.j2 @@ -8,12 +8,17 @@ Type=simple User={{ username }} Environment=SERVER_PORT={{ search_enterprise_port }} + Environment=SPRING_ACTIVEMQ_BROKERURL=failover:({{ activemq_protocol }}://{{ activemq_host }}:{{ ports_cfg.activemq.openwire }}) Environment=SPRING_ACTIVEMQ_USER={{ activemq_username }} Environment=SPRING_ACTIVEMQ_PASSWORD={{ activemq_password }} + Environment=SPRING_ELASTICSEARCH_REST_URIS={{ elasticsearch_protocol }}://{{ elasticsearch_host }}:{{ ports_cfg.elasticsearch.http }} Environment=SPRING_ELASTICSEARCH_REST_USERNAME={{ elasticsearch_username }} Environment=SPRING_ELASTICSEARCH_REST_PASSWORD={{ elasticsearch_password }} + +Environment=ELASTICSEARCH_INDEXNAME=alfresco + Environment=ALFRESCO_SHAREDFILESTORE_BASEURL=http://{{ sfs_host }}:{{ ports_cfg.sfs.http }}/alfresco/api/-default-/private/sfs/versions/1/file Environment=ALFRESCO_ACCEPTED_CONTENT_MEDIA_TYPES_CACHE_BASE_URL=http://{{ trouter_host }}:{{ ports_cfg.transformers.trouter }}/transform/config From 2d5eea7c1b99cef9cfd153b0a2c58019be9088ec Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo Date: Fri, 28 Oct 2022 13:57:25 +0200 Subject: [PATCH 02/18] add necessary configs --- roles/search_enterprise/tasks/main.yml | 16 ++++++++-------- .../templates/elasticsearch-cfg.j2 | 9 +++++++++ .../elasticsearch-connector-reindex.service.j2 | 11 ++++------- .../templates/elasticsearch-connector.service.j2 | 13 +------------ 4 files changed, 22 insertions(+), 27 deletions(-) create mode 100644 roles/search_enterprise/templates/elasticsearch-cfg.j2 diff --git a/roles/search_enterprise/tasks/main.yml b/roles/search_enterprise/tasks/main.yml index 0d29c5f69..b4b37370d 100644 --- a/roles/search_enterprise/tasks/main.yml +++ b/roles/search_enterprise/tasks/main.yml @@ -34,6 +34,14 @@ owner: "{{ username }}" group: "{{ group_name }}" + - name: Add elasticsearch-connector reindex service + template: + src: elasticsearch-connector-reindex.service.j2 + dest: /etc/systemd/system/elasticsearch-connector-reindex.service + owner: root + group: root + mode: "0640" + - name: Add elasticsearch-connector service template: src: elasticsearch-connector.service.j2 @@ -44,11 +52,3 @@ notify: - enable elasticsearch-connector service - restart elasticsearch-connector service - - - name: Add elasticsearch-connector reindex service - template: - src: elasticsearch-connector-reindex.service.j2 - dest: /etc/systemd/system/elasticsearch-connector-reindex.service - owner: root - group: root - mode: "0640" diff --git a/roles/search_enterprise/templates/elasticsearch-cfg.j2 b/roles/search_enterprise/templates/elasticsearch-cfg.j2 new file mode 100644 index 000000000..ad54aca86 --- /dev/null +++ b/roles/search_enterprise/templates/elasticsearch-cfg.j2 @@ -0,0 +1,9 @@ +Environment=ALFRESCO_SHAREDFILESTORE_BASEURL=http://{{ sfs_host }}:{{ ports_cfg.sfs.http }}/alfresco/api/-default-/private/sfs/versions/1/file +Environment=ALFRESCO_ACCEPTED_CONTENT_MEDIA_TYPES_CACHE_BASE_URL=http://{{ trouter_host }}:{{ ports_cfg.transformers.trouter }}/transform/config +Environment=ELASTICSEARCH_INDEXNAME=alfresco +Environment=SPRING_ACTIVEMQ_BROKERURL=failover:({{ activemq_protocol }}://{{ activemq_host }}:{{ ports_cfg.activemq.openwire }}) +Environment=SPRING_ACTIVEMQ_USER={{ activemq_username }} +Environment=SPRING_ACTIVEMQ_PASSWORD={{ activemq_password }} +Environment=SPRING_ELASTICSEARCH_REST_URIS={{ elasticsearch_protocol }}://{{ elasticsearch_host }}:{{ ports_cfg.elasticsearch.http }} +Environment=SPRING_ELASTICSEARCH_REST_USERNAME={{ elasticsearch_username }} +Environment=SPRING_ELASTICSEARCH_REST_PASSWORD={{ elasticsearch_password }} diff --git a/roles/search_enterprise/templates/elasticsearch-connector-reindex.service.j2 b/roles/search_enterprise/templates/elasticsearch-connector-reindex.service.j2 index 5fe3cbce8..502c8767e 100644 --- a/roles/search_enterprise/templates/elasticsearch-connector-reindex.service.j2 +++ b/roles/search_enterprise/templates/elasticsearch-connector-reindex.service.j2 @@ -7,14 +7,11 @@ Type=oneshot User={{ username }} -Environment=SPRING_ELASTICSEARCH_REST_URIS={{ elasticsearch_protocol }}://{{ elasticsearch_host }}:{{ ports_cfg.elasticsearch.http }} -Environment=SPRING_ELASTICSEARCH_REST_USERNAME={{ elasticsearch_username }} -Environment=SPRING_ELASTICSEARCH_REST_PASSWORD={{ elasticsearch_password }} +{% include 'elasticsearch-cfg.j2' %} -Environment=ELASTICSEARCH_INDEXNAME=alfresco - -Environment=ALFRESCO_SHAREDFILESTORE_BASEURL=http://{{ sfs_host }}:{{ ports_cfg.sfs.http }}/alfresco/api/-default-/private/sfs/versions/1/file -Environment=ALFRESCO_ACCEPTED_CONTENT_MEDIA_TYPES_CACHE_BASE_URL=http://{{ trouter_host }}:{{ ports_cfg.transformers.trouter }}/transform/config +Environment=SPRING_DATASOURCE_URL=jdbc:postgresql://{{ db_host }}:{{ ports_cfg.postgres.sql }}/{{ repo_db_name }} +Environment=SPRING_DATASOURCE_USERNAME={{ repo_db_username }} +Environment=SPRING_DATASOURCE_PASSWORD={{ repo_db_password }} ExecStart={{ java_home }}/bin/java -jar {{ search_enterprise_binaries_dir }}/alfresco-elasticsearch-reindexing-{{ search_enterprise.version }}-app.jar diff --git a/roles/search_enterprise/templates/elasticsearch-connector.service.j2 b/roles/search_enterprise/templates/elasticsearch-connector.service.j2 index 8d8d7245d..a72791cf1 100644 --- a/roles/search_enterprise/templates/elasticsearch-connector.service.j2 +++ b/roles/search_enterprise/templates/elasticsearch-connector.service.j2 @@ -9,18 +9,7 @@ User={{ username }} Environment=SERVER_PORT={{ search_enterprise_port }} -Environment=SPRING_ACTIVEMQ_BROKERURL=failover:({{ activemq_protocol }}://{{ activemq_host }}:{{ ports_cfg.activemq.openwire }}) -Environment=SPRING_ACTIVEMQ_USER={{ activemq_username }} -Environment=SPRING_ACTIVEMQ_PASSWORD={{ activemq_password }} - -Environment=SPRING_ELASTICSEARCH_REST_URIS={{ elasticsearch_protocol }}://{{ elasticsearch_host }}:{{ ports_cfg.elasticsearch.http }} -Environment=SPRING_ELASTICSEARCH_REST_USERNAME={{ elasticsearch_username }} -Environment=SPRING_ELASTICSEARCH_REST_PASSWORD={{ elasticsearch_password }} - -Environment=ELASTICSEARCH_INDEXNAME=alfresco - -Environment=ALFRESCO_SHAREDFILESTORE_BASEURL=http://{{ sfs_host }}:{{ ports_cfg.sfs.http }}/alfresco/api/-default-/private/sfs/versions/1/file -Environment=ALFRESCO_ACCEPTED_CONTENT_MEDIA_TYPES_CACHE_BASE_URL=http://{{ trouter_host }}:{{ ports_cfg.transformers.trouter }}/transform/config +{% include 'elasticsearch-cfg.j2' %} ExecStart={{ java_home }}/bin/java -jar {{ search_enterprise_binaries_dir }}/alfresco-elasticsearch-live-indexing-{{ search_enterprise.version }}-app.jar ExecStop=/bin/kill -15 $MAINPID From dcb19cfde771384e945a163c4f8219210fb10a79 Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo Date: Fri, 28 Oct 2022 14:31:04 +0200 Subject: [PATCH 03/18] moar tests --- molecule/elasticsearch/molecule.yml | 1 - molecule/elasticsearch/verify.yml | 49 +++++++++++++++++++ .../molecule/default/verify.yml | 6 +++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 molecule/elasticsearch/verify.yml diff --git a/molecule/elasticsearch/molecule.yml b/molecule/elasticsearch/molecule.yml index 807f083ce..23fc163ad 100644 --- a/molecule/elasticsearch/molecule.yml +++ b/molecule/elasticsearch/molecule.yml @@ -43,6 +43,5 @@ provisioner: host_vars: host_vars playbooks: prepare: ../default/prepare.yml - verify: ../default/verify.yml verifier: name: ansible diff --git a/molecule/elasticsearch/verify.yml b/molecule/elasticsearch/verify.yml new file mode 100644 index 000000000..0787566cf --- /dev/null +++ b/molecule/elasticsearch/verify.yml @@ -0,0 +1,49 @@ +- name: Verify + hosts: all + gather_facts: false + tasks: + - name: Populate service facts + ansible.builtin.service_facts: + + - name: Check that Elasticsearch Connector service is up and running + ansible.builtin.assert: + that: + - ansible_facts.services['elasticsearch-connector.service'] is defined + - ansible_facts.services['elasticsearch-connector.service'].state == 'running' + + - name: Get errors in the journal of Elasticsearch Connector service + become: true + ansible.builtin.shell: journalctl -u elasticsearch-connector.service + register: error_log + + - name: Check logs for errors and warnings + ansible.builtin.assert: + that: + - not error_log.stdout | regex_search(' WARN ') + - not error_log.stderr | regex_search(' ERROR ') + + - name: Check that Elasticsearch Connector reindex service is defined and not running + ansible.builtin.assert: + that: + - ansible_facts.services['elasticsearch-connector-reindex.service'] is defined + - ansible_facts.services['elasticsearch-connector-reindex.service'].state == 'inactive' + + - name: Run the Elasticsearch Connector Reindex once + become: true + ansible.builtin.systemd: + state: started + name: elasticsearch-connector-reindex + + - name: Get errors in the journal of Elasticsearch Connector Reindex service + become: true + ansible.builtin.shell: journalctl -u elasticsearch-connector-reindex.service + register: error_log + + - name: Check logs for errors and warnings + ansible.builtin.assert: + that: + - not error_log.stdout | regex_search(' WARN ') + - not error_log.stderr | regex_search(' ERROR ') + +- name: Run default verify + import_playbook: ../default/verify.yml diff --git a/roles/search_enterprise/molecule/default/verify.yml b/roles/search_enterprise/molecule/default/verify.yml index 42450a97c..8f950a9a7 100644 --- a/roles/search_enterprise/molecule/default/verify.yml +++ b/roles/search_enterprise/molecule/default/verify.yml @@ -27,3 +27,9 @@ - not error_log.stderr | regex_search(' ERROR ') - error_log.stdout | regex_search('{{ log_expected_regex }}') msg: "{{ error_log.stdout }} {{ error_log.stderr }}" + + - name: Check that Elasticsearch Connector reindex is available + ansible.builtin.assert: + that: + - ansible_facts.services['elasticsearch-connector-reindex.service'] is defined + - ansible_facts.services['elasticsearch-connector-reindex.service'].state == 'inactive' From a1e34141b2bda52236ac1bfe9044e6299bd5dda4 Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo Date: Wed, 2 Nov 2022 12:23:13 +0100 Subject: [PATCH 04/18] add playbook and test it --- molecule/elasticsearch/verify.yml | 11 ++++++----- playbooks/search-enterprise-reindex.yml | 9 +++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 playbooks/search-enterprise-reindex.yml diff --git a/molecule/elasticsearch/verify.yml b/molecule/elasticsearch/verify.yml index 0787566cf..efd60fdc0 100644 --- a/molecule/elasticsearch/verify.yml +++ b/molecule/elasticsearch/verify.yml @@ -28,12 +28,13 @@ - ansible_facts.services['elasticsearch-connector-reindex.service'] is defined - ansible_facts.services['elasticsearch-connector-reindex.service'].state == 'inactive' - - name: Run the Elasticsearch Connector Reindex once - become: true - ansible.builtin.systemd: - state: started - name: elasticsearch-connector-reindex +- name: Run the Elasticsearch Connector Reindex + import_playbook: ../../playbooks/search-enterprise-reindex.yml +- name: Verify Reindex + hosts: all + gather_facts: false + tasks: - name: Get errors in the journal of Elasticsearch Connector Reindex service become: true ansible.builtin.shell: journalctl -u elasticsearch-connector-reindex.service diff --git a/playbooks/search-enterprise-reindex.yml b/playbooks/search-enterprise-reindex.yml new file mode 100644 index 000000000..244f826e8 --- /dev/null +++ b/playbooks/search-enterprise-reindex.yml @@ -0,0 +1,9 @@ +- name: Search Enteprise Reindex + hosts: search_enterprise[0] + gather_facts: false + tasks: + - name: Run the Elasticsearch Connector Reindex + become: true + ansible.builtin.systemd: + state: started + name: elasticsearch-connector-reindex From 97808de2ded119626f673cb0895c7b2078f3a49c Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo Date: Wed, 2 Nov 2022 15:09:09 +0100 Subject: [PATCH 05/18] update docs --- docs/deployment-guide.md | 49 +++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/docs/deployment-guide.md b/docs/deployment-guide.md index d9c2a6294..d3f31e109 100644 --- a/docs/deployment-guide.md +++ b/docs/deployment-guide.md @@ -97,19 +97,20 @@ Regardless of role and connection type, a consistent folder structure is used. Y The following systemd services are deployed and can be used to stop and start Alfresco components: -| Service Name | Purpose | -|:------------------------------------|:---------------------------------------------------------------------------------| -| `activemq.service` | ActiveMQ Service | -| `postgresql-.service` | Postgresql DB Service (where `` is 11 for ACS 6.2.N and 13 for ACS 7.x) | -| `nginx.service` | Nginx Service | -| `alfresco-content.service` | Alfresco Content Service | -| `alfresco-search.service` | Alfresco Search Service | -| `alfresco-shared-fs.service` | Alfresco Shared File Store Controller Service | -| `alfresco-sync.service` | Alfresco Sync Service | -| `alfresco-tengine-aio.service` | Alfresco AIO Transform Core Engine | -| `alfresco-transform-router.service` | Alfresco Transformation Router Service | -| `elasticsearch-connector.service` | Alfresco Search Enterprise Service | -| `elasticsearch.service` | ElasticSearch Service | +| Service Name | Purpose | +|:------------------------------------------|:----------------------------------------------------------------------------------------| +| `activemq.service` | ActiveMQ Service | +| `postgresql-.service` | Postgresql DB Service (where `` is 11 for ACS 6.2.N and 13 for ACS 7.x) | +| `nginx.service` | Nginx Service | +| `alfresco-content.service` | Alfresco Content Service | +| `alfresco-search.service` | Alfresco Search Service | +| `alfresco-shared-fs.service` | Alfresco Shared File Store Controller Service | +| `alfresco-sync.service` | Alfresco Sync Service | +| `alfresco-tengine-aio.service` | Alfresco AIO Transform Core Engine | +| `alfresco-transform-router.service` | Alfresco Transformation Router Service | +| `elasticsearch-connector.service` | Alfresco Search Enterprise Service | +| `elasticsearch-connector-reindex.service` | Alfresco Search Enterprise job to force the reindexing of all the contents of the store | +| `elasticsearch.service` | ElasticSearch Service | Please be aware that some configuration changes (e.g. postgres pg_hba, properties files, ...) can trigger a service restart and a consequent @@ -794,11 +795,11 @@ Once ACS has initialized access the system using the following URLs with a brows There are some useful argument you can use with `ansible-playbook` command in many circumstances. Some are highlighted bellow but take a look at [The ansible-playbook documentation](https://docs.ansible.com/ansible/latest/cli/ansible-playbook.html) for complete list of options. -* `-k` : Prompt for SSH password. Usefull when no SSH keys have been deployed but needs to be th same on all hosts (prefer SSH whenever possible) -* `-K` : Prompt for sudo password. Usefull when the user used to connect to the machine is not root +* `-k` : Prompt for SSH password. Useful when no SSH keys have been deployed but needs to be th same on all hosts (prefer SSH whenever possible) +* `-K` : Prompt for sudo password. Useful when the user used to connect to the machine is not root * `-e` : Pass an extra variable or override an existing one (read from file with `-e @file`). * `-l` : Limit the play to a subset of hosts (either groups or individuals hosts or a mix of both) -* `-u user` : specify the username to use to cnnect to all targets (Prefer adding the ànsible_ssh_user` to the inventory file in the right scope, e.g. under the `all`group) +* `-u user` : specify the username to use to connect to all targets (Prefer adding the `ansible_ssh_user` to the inventory file in the right scope, e.g. under the `all`group) ## ACS cluster @@ -833,6 +834,18 @@ In that case, you can add the `cluster_keepoff` variable to one of the `reposito > A typical use case is to have a dedicated Solr tracking node. The playbook will then prefer to use that dedicated node - if it finds one - for solr tracking and only use the other as backup server (no load balancing) +## Maintenance + +After the initial deploy, may arise the need to execute maintenance tasks that are handled via specific playbooks. + +### Search Enterprise Reindexing + +You can trigger the reindexing of existing content in Search Enterprise using a dedicated playbook: + +```bash +pipenv run ansible-playbook playbooks/search-enterprise-reindex.yml -i .yml +``` + ## Cleanup & Uninstallation of ACS What needs to be removed from a system will depend on your inventory configuration. The steps below presume a cleanup and uninstallation of Alfresco content service after deployment of ansible artifacts by using platform-cleanup.yml playbook and platform-uninstall.yml playbook respectively. @@ -842,7 +855,7 @@ What needs to be removed from a system will depend on your inventory configurati This playbook will remove the temporary artifacts which are stored on the hosts.In order to cleanup the system post deployment run the following command: ```bash -pipenv run ansible-playbook playbooks/platform-cleanup.yml -i inventory_ssh.yml +pipenv run ansible-playbook playbooks/platform-cleanup.yml -i .yml ``` > Note: This playbook can break the idempotency i.e Downloaded artifacts again needs to removed by running cleanup playbook. @@ -851,7 +864,7 @@ pipenv run ansible-playbook playbooks/platform-cleanup.yml -i inventory_ssh.yml This playbook will uninstall the sevices which belong to the specific hosts. Below are the services, packages & folders we are removing when uninstalling -1. Stoping and removing the following services: +1. Stopping and removing the following services: * alfresco-transform-router.service * alfresco-shared-fs.service * alfresco-tengine-aio.service From 34c7e5ae6b2290e681de3ae0b9f3a1fcfa8c6649 Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo Date: Wed, 2 Nov 2022 15:12:37 +0100 Subject: [PATCH 06/18] Fixup pre-commit with djlint --- .pre-commit-config.yaml | 2 +- .../templates/elasticsearch-connector-reindex.service.j2 | 2 +- .../templates/elasticsearch-connector.service.j2 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 995fff4a5..bb9143f16 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,7 +15,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/Riverside-Healthcare/djLint - rev: v1.18.0 + rev: v1.19.3 hooks: - id: djlint-jinja diff --git a/roles/search_enterprise/templates/elasticsearch-connector-reindex.service.j2 b/roles/search_enterprise/templates/elasticsearch-connector-reindex.service.j2 index 502c8767e..8cb295daa 100644 --- a/roles/search_enterprise/templates/elasticsearch-connector-reindex.service.j2 +++ b/roles/search_enterprise/templates/elasticsearch-connector-reindex.service.j2 @@ -7,7 +7,7 @@ Type=oneshot User={{ username }} -{% include 'elasticsearch-cfg.j2' %} +{% include "elasticsearch-cfg.j2" %} Environment=SPRING_DATASOURCE_URL=jdbc:postgresql://{{ db_host }}:{{ ports_cfg.postgres.sql }}/{{ repo_db_name }} Environment=SPRING_DATASOURCE_USERNAME={{ repo_db_username }} diff --git a/roles/search_enterprise/templates/elasticsearch-connector.service.j2 b/roles/search_enterprise/templates/elasticsearch-connector.service.j2 index a72791cf1..93325690e 100644 --- a/roles/search_enterprise/templates/elasticsearch-connector.service.j2 +++ b/roles/search_enterprise/templates/elasticsearch-connector.service.j2 @@ -9,7 +9,7 @@ User={{ username }} Environment=SERVER_PORT={{ search_enterprise_port }} -{% include 'elasticsearch-cfg.j2' %} +{% include "elasticsearch-cfg.j2" %} ExecStart={{ java_home }}/bin/java -jar {{ search_enterprise_binaries_dir }}/alfresco-elasticsearch-live-indexing-{{ search_enterprise.version }}-app.jar ExecStop=/bin/kill -15 $MAINPID From ab799469a2756542eb095911464c1429c18fb01c Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo Date: Thu, 3 Nov 2022 10:51:52 +0100 Subject: [PATCH 07/18] add job names to all the jobs --- .github/workflows/enteprise.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/enteprise.yml b/.github/workflows/enteprise.yml index f4ff7638e..8b382b198 100644 --- a/.github/workflows/enteprise.yml +++ b/.github/workflows/enteprise.yml @@ -13,6 +13,7 @@ env: jobs: docker: + name: ${{ matrix.role.name }} on ${{ matrix.molecule_distro.image }} runs-on: ubuntu-latest strategy: fail-fast: true @@ -62,6 +63,7 @@ jobs: command: cd roles/${{ matrix.role.name }} && pipenv run molecule test docker_integration: + name: ${{ matrix.scenario.name }} on ${{ matrix.scenario.name }} if: github.actor != 'dependabot[bot]' needs: - docker @@ -108,10 +110,10 @@ jobs: run: pipenv run molecule test -s ${{ matrix.scenario.name }} ec2: + name: ${{ matrix.molecule_scenario.desc }} if: github.actor != 'dependabot[bot]' needs: - docker - name: ${{ matrix.molecule_scenario.desc }} runs-on: ubuntu-latest strategy: fail-fast: false From 4ebcf13a74cb38cdab13bf256d54fcf09d7dd5a2 Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo Date: Thu, 3 Nov 2022 14:54:14 +0100 Subject: [PATCH 08/18] fixup verify --- molecule/elasticsearch/verify.yml | 38 +++++++++++-------- .../molecule/default/verify.yml | 4 +- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/molecule/elasticsearch/verify.yml b/molecule/elasticsearch/verify.yml index efd60fdc0..0cd9304b7 100644 --- a/molecule/elasticsearch/verify.yml +++ b/molecule/elasticsearch/verify.yml @@ -1,6 +1,8 @@ - name: Verify hosts: all gather_facts: false + vars: + job_name: elasticsearch-connector.service tasks: - name: Populate service facts ansible.builtin.service_facts: @@ -8,43 +10,49 @@ - name: Check that Elasticsearch Connector service is up and running ansible.builtin.assert: that: - - ansible_facts.services['elasticsearch-connector.service'] is defined - - ansible_facts.services['elasticsearch-connector.service'].state == 'running' + - ansible_facts.services[job_name] is defined + - ansible_facts.services[job_name].state == 'running' - name: Get errors in the journal of Elasticsearch Connector service become: true - ansible.builtin.shell: journalctl -u elasticsearch-connector.service + ansible.builtin.shell: journalctl -u {{ job_name }} register: error_log - - name: Check logs for errors and warnings + - name: Assert logs ansible.builtin.assert: that: - - not error_log.stdout | regex_search(' WARN ') - - not error_log.stderr | regex_search(' ERROR ') + - error_log.stdout | regex_search('Started LiveIndexingApp') - - name: Check that Elasticsearch Connector reindex service is defined and not running +- name: Verify Reindex before first run + hosts: all + gather_facts: false + vars: + job_name: elasticsearch-connector-reindex.service + tasks: + - name: Check that {{ job_name }} is defined and not running ansible.builtin.assert: that: - - ansible_facts.services['elasticsearch-connector-reindex.service'] is defined - - ansible_facts.services['elasticsearch-connector-reindex.service'].state == 'inactive' + - ansible_facts.services[job_name] is defined + - ansible_facts.services[job_name].state == 'inactive' - name: Run the Elasticsearch Connector Reindex import_playbook: ../../playbooks/search-enterprise-reindex.yml -- name: Verify Reindex +- name: Verify Reindex after first run hosts: all gather_facts: false + vars: + job_name: elasticsearch-connector-reindex.service tasks: - - name: Get errors in the journal of Elasticsearch Connector Reindex service + - name: Get errors in the journal of {{ job_name }} become: true - ansible.builtin.shell: journalctl -u elasticsearch-connector-reindex.service + ansible.builtin.shell: journalctl -u {{ job_name }} register: error_log - - name: Check logs for errors and warnings + - name: Assert logs ansible.builtin.assert: that: - - not error_log.stdout | regex_search(' WARN ') - - not error_log.stderr | regex_search(' ERROR ') + - error_log.stdout | regex_search('reindexByIds.*COMPLETED.*') - name: Run default verify import_playbook: ../default/verify.yml diff --git a/roles/search_enterprise/molecule/default/verify.yml b/roles/search_enterprise/molecule/default/verify.yml index 8f950a9a7..443692a65 100644 --- a/roles/search_enterprise/molecule/default/verify.yml +++ b/roles/search_enterprise/molecule/default/verify.yml @@ -24,9 +24,9 @@ ansible.builtin.assert: that: - not error_log.stdout | regex_search(' WARN ') - - not error_log.stderr | regex_search(' ERROR ') + - not error_log.stdout | regex_search(' ERROR ') - error_log.stdout | regex_search('{{ log_expected_regex }}') - msg: "{{ error_log.stdout }} {{ error_log.stderr }}" + msg: "{{ error_log.stdout }}" - name: Check that Elasticsearch Connector reindex is available ansible.builtin.assert: From b766222db873c34d8d6760b15b9d3377069a1873 Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo Date: Thu, 3 Nov 2022 15:19:56 +0100 Subject: [PATCH 09/18] fixup workflow name --- .github/workflows/enteprise.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/enteprise.yml b/.github/workflows/enteprise.yml index 8b382b198..f67f2fd40 100644 --- a/.github/workflows/enteprise.yml +++ b/.github/workflows/enteprise.yml @@ -63,7 +63,7 @@ jobs: command: cd roles/${{ matrix.role.name }} && pipenv run molecule test docker_integration: - name: ${{ matrix.scenario.name }} on ${{ matrix.scenario.name }} + name: ${{ matrix.scenario.name }} on ${{ matrix.molecule_distro.image }} if: github.actor != 'dependabot[bot]' needs: - docker From 2702eaa2c469b6c99086ed07e931d4cf23114de4 Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo Date: Thu, 3 Nov 2022 16:59:27 +0100 Subject: [PATCH 10/18] remove unnecessary timetout --- roles/search_enterprise/tasks/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/search_enterprise/tasks/main.yml b/roles/search_enterprise/tasks/main.yml index b4b37370d..e8c532b56 100644 --- a/roles/search_enterprise/tasks/main.yml +++ b/roles/search_enterprise/tasks/main.yml @@ -8,7 +8,6 @@ mode: "0644" url_username: "{{ nexus_user }}" url_password: "{{ nexus_password }}" - timeout: 2 - name: Install & configure Search services become: true From 9fa2ecaf49868f5935059f446b354055c0614a3b Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo Date: Thu, 3 Nov 2022 17:45:20 +0100 Subject: [PATCH 11/18] verify with retries --- molecule/elasticsearch/verify.yml | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/molecule/elasticsearch/verify.yml b/molecule/elasticsearch/verify.yml index 0cd9304b7..48d95f131 100644 --- a/molecule/elasticsearch/verify.yml +++ b/molecule/elasticsearch/verify.yml @@ -13,15 +13,13 @@ - ansible_facts.services[job_name] is defined - ansible_facts.services[job_name].state == 'running' - - name: Get errors in the journal of Elasticsearch Connector service + - name: "Check that {{ job_name }} is really up and running" become: true ansible.builtin.shell: journalctl -u {{ job_name }} register: error_log - - - name: Assert logs - ansible.builtin.assert: - that: - - error_log.stdout | regex_search('Started LiveIndexingApp') + retries: 6 + delay: 10 + until: error_log.stdout | regex_search('Started LiveIndexingApp') - name: Verify Reindex before first run hosts: all @@ -44,15 +42,13 @@ vars: job_name: elasticsearch-connector-reindex.service tasks: - - name: Get errors in the journal of {{ job_name }} + - name: "Check that {{ job_name }} is really up and running" become: true ansible.builtin.shell: journalctl -u {{ job_name }} register: error_log - - - name: Assert logs - ansible.builtin.assert: - that: - - error_log.stdout | regex_search('reindexByIds.*COMPLETED.*') + retries: 6 + delay: 10 + until: error_log.stdout | regex_search('reindexByIds.*COMPLETED.*') - name: Run default verify import_playbook: ../default/verify.yml From 6ec9f2ccceb42ddb8da431bf517e50cb4c729b39 Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo Date: Thu, 3 Nov 2022 17:46:25 +0100 Subject: [PATCH 12/18] Allow Jinja templating inside task and play names --- .ansible-lint | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index ffcb81b0b..539506d26 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,6 +1,5 @@ warn_list: - experimental - - deprecations skip_list: - 'risky-file-permissions' - 'no-changed-when' @@ -11,7 +10,8 @@ skip_list: - 'no-tabs' - 'empty-string-compare' - 'fqcn-builtins' - + # Allow Jinja templating inside task and play names + - name[template] kinds: - yaml: "**/molecule/**/vars*.yml" - yaml: "**/molecule/**/hosts.yml" From afc9f8f482d3aea1d48494f6dad232969d1691d7 Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo Date: Mon, 7 Nov 2022 10:02:05 +0100 Subject: [PATCH 13/18] Will add ubuntu 22 in the 7.3 branch before merging --- .github/workflows/enteprise.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/enteprise.yml b/.github/workflows/enteprise.yml index f67f2fd40..353f711e8 100644 --- a/.github/workflows/enteprise.yml +++ b/.github/workflows/enteprise.yml @@ -72,7 +72,6 @@ jobs: fail-fast: false matrix: molecule_distro: - - image: centos:7 - image: ubuntu:20.04 - image: rockylinux:8 scenario: From d4c451c491d2a654603759d91cd5e8c4f6974c58 Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo Date: Wed, 9 Nov 2022 11:51:15 +0100 Subject: [PATCH 14/18] Apply suggestions from code review Co-authored-by: Alex Chapellon --- molecule/elasticsearch/verify.yml | 6 +++--- roles/search_enterprise/templates/elasticsearch-cfg.j2 | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/molecule/elasticsearch/verify.yml b/molecule/elasticsearch/verify.yml index 48d95f131..f4760b39a 100644 --- a/molecule/elasticsearch/verify.yml +++ b/molecule/elasticsearch/verify.yml @@ -1,5 +1,5 @@ - name: Verify - hosts: all + hosts: search_enterprise gather_facts: false vars: job_name: elasticsearch-connector.service @@ -22,7 +22,7 @@ until: error_log.stdout | regex_search('Started LiveIndexingApp') - name: Verify Reindex before first run - hosts: all + hosts: search_enterprise gather_facts: false vars: job_name: elasticsearch-connector-reindex.service @@ -37,7 +37,7 @@ import_playbook: ../../playbooks/search-enterprise-reindex.yml - name: Verify Reindex after first run - hosts: all + hosts: search_enterprise[0] gather_facts: false vars: job_name: elasticsearch-connector-reindex.service diff --git a/roles/search_enterprise/templates/elasticsearch-cfg.j2 b/roles/search_enterprise/templates/elasticsearch-cfg.j2 index ad54aca86..06a8735ca 100644 --- a/roles/search_enterprise/templates/elasticsearch-cfg.j2 +++ b/roles/search_enterprise/templates/elasticsearch-cfg.j2 @@ -1,7 +1,7 @@ Environment=ALFRESCO_SHAREDFILESTORE_BASEURL=http://{{ sfs_host }}:{{ ports_cfg.sfs.http }}/alfresco/api/-default-/private/sfs/versions/1/file Environment=ALFRESCO_ACCEPTED_CONTENT_MEDIA_TYPES_CACHE_BASE_URL=http://{{ trouter_host }}:{{ ports_cfg.transformers.trouter }}/transform/config Environment=ELASTICSEARCH_INDEXNAME=alfresco -Environment=SPRING_ACTIVEMQ_BROKERURL=failover:({{ activemq_protocol }}://{{ activemq_host }}:{{ ports_cfg.activemq.openwire }}) +Environment=SPRING_ACTIVEMQ_BROKERURL=failover:({{ activemq_protocol }}://{{ activemq_host }}:{{ ports_cfg.activemq[activemq_protocol | default('openwire')] }}) Environment=SPRING_ACTIVEMQ_USER={{ activemq_username }} Environment=SPRING_ACTIVEMQ_PASSWORD={{ activemq_password }} Environment=SPRING_ELASTICSEARCH_REST_URIS={{ elasticsearch_protocol }}://{{ elasticsearch_host }}:{{ ports_cfg.elasticsearch.http }} From e478411753d9febdc4911ff9057ab2076a124813 Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo Date: Wed, 9 Nov 2022 12:34:11 +0100 Subject: [PATCH 15/18] rename activemq_protocol to activemq_transport --- docs/deployment-guide.md | 2 +- molecule/multimachine/prepare.yml | 2 +- roles/common/defaults/main.yml | 4 ++-- roles/repository/templates/alfresco-global.properties.j2 | 2 +- roles/search_enterprise/templates/elasticsearch-cfg.j2 | 2 +- roles/sync/templates/config.yml.j2 | 2 +- roles/transformers/templates/ats-ate-aio.sh.j2 | 2 +- roles/trouter/templates/ats-atr.sh.j2 | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/deployment-guide.md b/docs/deployment-guide.md index d3f31e109..fbc79754b 100644 --- a/docs/deployment-guide.md +++ b/docs/deployment-guide.md @@ -470,7 +470,7 @@ all: whatever.mq.eu-west-1.amazonaws.com: activemq_username: alfresco activemq_port: 61617 - activemq_protocol: tcp # or ssl + activemq_transport: tcp # or ssl external: children: external_activemq: diff --git a/molecule/multimachine/prepare.yml b/molecule/multimachine/prepare.yml index 4dcaded86..1c2b7ee94 100644 --- a/molecule/multimachine/prepare.yml +++ b/molecule/multimachine/prepare.yml @@ -128,7 +128,7 @@ mqattrs: activemq_username: alfresco activemq_port: 61617 - activemq_protocol: ssl + activemq_transport: ssl ansible.builtin.template: src: hosts.yml.j2 dest: hosts.yml diff --git a/roles/common/defaults/main.yml b/roles/common/defaults/main.yml index 555d62760..e46314d5e 100644 --- a/roles/common/defaults/main.yml +++ b/roles/common/defaults/main.yml @@ -27,8 +27,8 @@ activemq_host: >- {% else %} {{- groups.activemq | map('extract', hostvars, ['ansible_default_ipv4','address']) | first -}} {% endif %} -activemq_protocol: >- - {{- groups.external_activemq | default([]) | map('extract', hostvars, ['activemq_protocol']) | first | default('tcp') -}} +activemq_transport: >- + {{- groups.external_activemq | default([]) | map('extract', hostvars, ['activemq_transport']) | first | default('tcp') -}} db_host: "{{ groups['database'] | default([]) | map('extract', hostvars, ['ansible_default_ipv4','address']) | first | default('127.0.0.1') }}" solr_host: "{{ groups['search'] | default([]) | map('extract', hostvars, ['ansible_default_ipv4','address']) | first | default('127.0.0.1') }}" ats_tengine_aio_host: "{{ groups['transformers'] | default([]) | map('extract', hostvars, ['ansible_default_ipv4','address']) | first | default('127.0.0.1') }}" diff --git a/roles/repository/templates/alfresco-global.properties.j2 b/roles/repository/templates/alfresco-global.properties.j2 index 8788e1bf7..242299aba 100644 --- a/roles/repository/templates/alfresco-global.properties.j2 +++ b/roles/repository/templates/alfresco-global.properties.j2 @@ -70,7 +70,7 @@ tika.url=${localTransform.core-aio.url} transform.misc.url=${localTransform.core-aio.url} sfs.url=http://{{ sfs_host }}:{{ ports_cfg.sfs.http }}/ -messaging.broker.url=failover:({{ activemq_protocol }}://{{ activemq_host }}:{{ ports_cfg.activemq.openwire }})?timeout=3000 +messaging.broker.url=failover:({{ activemq_transport }}://{{ activemq_host }}:{{ ports_cfg.activemq.openwire }})?timeout=3000 messaging.broker.username={{ activemq_username }} messaging.broker.password={{ activemq_password }} diff --git a/roles/search_enterprise/templates/elasticsearch-cfg.j2 b/roles/search_enterprise/templates/elasticsearch-cfg.j2 index 06a8735ca..7397e6058 100644 --- a/roles/search_enterprise/templates/elasticsearch-cfg.j2 +++ b/roles/search_enterprise/templates/elasticsearch-cfg.j2 @@ -1,7 +1,7 @@ Environment=ALFRESCO_SHAREDFILESTORE_BASEURL=http://{{ sfs_host }}:{{ ports_cfg.sfs.http }}/alfresco/api/-default-/private/sfs/versions/1/file Environment=ALFRESCO_ACCEPTED_CONTENT_MEDIA_TYPES_CACHE_BASE_URL=http://{{ trouter_host }}:{{ ports_cfg.transformers.trouter }}/transform/config Environment=ELASTICSEARCH_INDEXNAME=alfresco -Environment=SPRING_ACTIVEMQ_BROKERURL=failover:({{ activemq_protocol }}://{{ activemq_host }}:{{ ports_cfg.activemq[activemq_protocol | default('openwire')] }}) +Environment=SPRING_ACTIVEMQ_BROKERURL=failover:({{ activemq_transport }}://{{ activemq_host }}:{{ ports_cfg.activemq[activemq_transport | default('openwire')] }}) Environment=SPRING_ACTIVEMQ_USER={{ activemq_username }} Environment=SPRING_ACTIVEMQ_PASSWORD={{ activemq_password }} Environment=SPRING_ELASTICSEARCH_REST_URIS={{ elasticsearch_protocol }}://{{ elasticsearch_host }}:{{ ports_cfg.elasticsearch.http }} diff --git a/roles/sync/templates/config.yml.j2 b/roles/sync/templates/config.yml.j2 index e1b89fef5..ef8c06ed3 100644 --- a/roles/sync/templates/config.yml.j2 +++ b/roles/sync/templates/config.yml.j2 @@ -30,7 +30,7 @@ messaging: broker: host: {{ activemq_host }} port: {{ ports_cfg.activemq.openwire }} - protocol: {{ activemq_protocol }} + protocol: {{ activemq_transport }} endpoint: ${messaging.broker.protocol}://${messaging.broker.host}:${messaging.broker.port} url: failover:(${messaging.broker.endpoint}?wireFormat.maxInactivityDurationInitalDelay=30000)?timeout=3000&jms.useCompression=true&startupMaxReconnectAttempts=0&jms.redeliveryPolicy.maximumRedeliveries=${messaging.events.repo.node.maxConsumers} pool: diff --git a/roles/transformers/templates/ats-ate-aio.sh.j2 b/roles/transformers/templates/ats-ate-aio.sh.j2 index 93af00f33..a3f3c1e5f 100644 --- a/roles/transformers/templates/ats-ate-aio.sh.j2 +++ b/roles/transformers/templates/ats-ate-aio.sh.j2 @@ -9,7 +9,7 @@ export JAVA_OPTS="${JAVA_OPTS} -DPDFRENDERER_EXE={{ ats_home }}/alfresco-pdf-ren export JAVA_OPTS="${JAVA_OPTS} -DLIBREOFFICE_HOME=${LIBREOFFICE_HOME}" export JAVA_OPTS="${JAVA_OPTS} -DIMAGEMAGICK_ROOT=${IMAGEMAGICK_HOME} -DIMAGEMAGICK_DYN=${IMAGEMAGICK_DYN} -DIMAGEMAGICK_EXE=${IMAGEMAGICK_EXE} -DIMAGEMAGICK_CONFIG=${IMAGEMAGICK_CONFIG} -DIMAGEMAGICK_CODERS=${IMAGEMAGICK_CODERS}" {% if acs.edition == 'Enterprise' %} -export JAVA_OPTS="${JAVA_OPTS} -DACTIVEMQ_URL=failover:({{ activemq_protocol }}://{{ activemq_host }}:{{ ports_cfg.activemq.openwire }})?timeout=3000" +export JAVA_OPTS="${JAVA_OPTS} -DACTIVEMQ_URL=failover:({{ activemq_transport }}://{{ activemq_host }}:{{ ports_cfg.activemq.openwire }})?timeout=3000" export JAVA_OPTS="${JAVA_OPTS} -DACTIVEMQ_USER={{ activemq_username }}" export JAVA_OPTS="${JAVA_OPTS} -DACTIVEMQ_PASSWORD={{ activemq_password }}" export JAVA_OPTS="${JAVA_OPTS} -DFILE_STORE_URL=http://${ATS_SHARED_FS_HOST}:{{ ports_cfg.sfs.http }}/alfresco/api/-default-/private/sfs/versions/1/file" diff --git a/roles/trouter/templates/ats-atr.sh.j2 b/roles/trouter/templates/ats-atr.sh.j2 index 3ee875a1d..e7d296043 100644 --- a/roles/trouter/templates/ats-atr.sh.j2 +++ b/roles/trouter/templates/ats-atr.sh.j2 @@ -7,7 +7,7 @@ fi . {{ config_folder }}/setenv.sh export JAVA_OPTS="${JAVA_OPTS} -DCORE_AIO_URL=http://${ATS_TENGINE_AIO_HOST}:{{ ports_cfg.transformers.tengine }}" export JAVA_OPTS="${JAVA_OPTS} -DCORE_AIO_QUEUE=org.alfresco.transform.engine.aio.acs" -export JAVA_OPTS="${JAVA_OPTS} -DACTIVEMQ_URL=failover:({{ activemq_protocol }}://{{ activemq_host }}:{{ ports_cfg.activemq.openwire }})?timeout=3000" +export JAVA_OPTS="${JAVA_OPTS} -DACTIVEMQ_URL=failover:({{ activemq_transport }}://{{ activemq_host }}:{{ ports_cfg.activemq.openwire }})?timeout=3000" export JAVA_OPTS="${JAVA_OPTS} -DACTIVEMQ_USER={{ activemq_username }}" export JAVA_OPTS="${JAVA_OPTS} -DACTIVEMQ_PASSWORD={{ activemq_password }}" export JAVA_OPTS="${JAVA_OPTS} -DFILE_STORE_URL=http://{{ sfs_host }}:{{ ports_cfg.sfs.http }}/alfresco/api/-default-/private/sfs/versions/1/file" From ed28497b5416162bec9d5c9676c2cdf662f53879 Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo Date: Wed, 9 Nov 2022 12:36:48 +0100 Subject: [PATCH 16/18] introduce activemq_protocol to handle port selection --- playbooks/prerequisite-checks.yml | 6 +++--- roles/common/defaults/main.yml | 1 + roles/repository/templates/alfresco-global.properties.j2 | 2 +- roles/search_enterprise/templates/elasticsearch-cfg.j2 | 2 +- roles/sync/templates/config.yml.j2 | 2 +- roles/transformers/handlers/main.yml | 4 ++-- roles/transformers/templates/ats-ate-aio.sh.j2 | 2 +- roles/trouter/templates/ats-atr.sh.j2 | 2 +- 8 files changed, 11 insertions(+), 10 deletions(-) diff --git a/playbooks/prerequisite-checks.yml b/playbooks/prerequisite-checks.yml index 3d3cedce8..b035647b8 100644 --- a/playbooks/prerequisite-checks.yml +++ b/playbooks/prerequisite-checks.yml @@ -16,7 +16,7 @@ include_tasks: "../roles/helper_modules/tasks/check_port.yml" vars: checked_host: "{% if groups.activemq | length == 0 %}127.0.0.1{% else %}{{ hostvars[groups.activemq[0]].ansible_host | default('127.0.0.1') }}{% endif %}" - checked_port: "{{ ports_cfg.activemq.openwire }}" + checked_port: "{{ ports_cfg.activemq[activemq_protocol] }}" delegate_target: "{{ groups.activemq | first }}" - name: check search connection include_tasks: "../roles/helper_modules/tasks/check_port.yml" @@ -72,7 +72,7 @@ include_tasks: "../roles/helper_modules/tasks/check_port.yml" vars: checked_host: "{% if groups.activemq | length == 0 %}127.0.0.1{% else %}{{ hostvars[groups.activemq[0]].ansible_host | default('127.0.0.1') }}{% endif %}" - checked_port: "{{ ports_cfg.activemq.openwire }}" + checked_port: "{{ ports_cfg.activemq[activemq_protocol] }}" delegate_target: "{{ groups.activemq | first }}" - name: prerequisite checks @@ -91,7 +91,7 @@ include_tasks: "../roles/helper_modules/tasks/check_port.yml" vars: checked_host: "{% if groups.activemq | length == 0 %}127.0.0.1{% else %}{{ hostvars[groups.activemq[0]].ansible_host | default('127.0.0.1') }}{% endif %}" - checked_port: "{{ ports_cfg.activemq.openwire }}" + checked_port: "{{ ports_cfg.activemq[activemq_protocol] }}" delegate_target: "{{ groups.activemq | first }}" - name: prerequisite checks diff --git a/roles/common/defaults/main.yml b/roles/common/defaults/main.yml index e46314d5e..8ec5f93b9 100644 --- a/roles/common/defaults/main.yml +++ b/roles/common/defaults/main.yml @@ -29,6 +29,7 @@ activemq_host: >- {% endif %} activemq_transport: >- {{- groups.external_activemq | default([]) | map('extract', hostvars, ['activemq_transport']) | first | default('tcp') -}} +activemq_protocol: openwire db_host: "{{ groups['database'] | default([]) | map('extract', hostvars, ['ansible_default_ipv4','address']) | first | default('127.0.0.1') }}" solr_host: "{{ groups['search'] | default([]) | map('extract', hostvars, ['ansible_default_ipv4','address']) | first | default('127.0.0.1') }}" ats_tengine_aio_host: "{{ groups['transformers'] | default([]) | map('extract', hostvars, ['ansible_default_ipv4','address']) | first | default('127.0.0.1') }}" diff --git a/roles/repository/templates/alfresco-global.properties.j2 b/roles/repository/templates/alfresco-global.properties.j2 index 242299aba..6afa1f92a 100644 --- a/roles/repository/templates/alfresco-global.properties.j2 +++ b/roles/repository/templates/alfresco-global.properties.j2 @@ -70,7 +70,7 @@ tika.url=${localTransform.core-aio.url} transform.misc.url=${localTransform.core-aio.url} sfs.url=http://{{ sfs_host }}:{{ ports_cfg.sfs.http }}/ -messaging.broker.url=failover:({{ activemq_transport }}://{{ activemq_host }}:{{ ports_cfg.activemq.openwire }})?timeout=3000 +messaging.broker.url=failover:({{ activemq_transport }}://{{ activemq_host }}:{{ ports_cfg.activemq[activemq_protocol] }})?timeout=3000 messaging.broker.username={{ activemq_username }} messaging.broker.password={{ activemq_password }} diff --git a/roles/search_enterprise/templates/elasticsearch-cfg.j2 b/roles/search_enterprise/templates/elasticsearch-cfg.j2 index 7397e6058..f170c3e61 100644 --- a/roles/search_enterprise/templates/elasticsearch-cfg.j2 +++ b/roles/search_enterprise/templates/elasticsearch-cfg.j2 @@ -1,7 +1,7 @@ Environment=ALFRESCO_SHAREDFILESTORE_BASEURL=http://{{ sfs_host }}:{{ ports_cfg.sfs.http }}/alfresco/api/-default-/private/sfs/versions/1/file Environment=ALFRESCO_ACCEPTED_CONTENT_MEDIA_TYPES_CACHE_BASE_URL=http://{{ trouter_host }}:{{ ports_cfg.transformers.trouter }}/transform/config Environment=ELASTICSEARCH_INDEXNAME=alfresco -Environment=SPRING_ACTIVEMQ_BROKERURL=failover:({{ activemq_transport }}://{{ activemq_host }}:{{ ports_cfg.activemq[activemq_transport | default('openwire')] }}) +Environment=SPRING_ACTIVEMQ_BROKERURL=failover:({{ activemq_transport }}://{{ activemq_host }}:{{ ports_cfg.activemq[activemq_protocol] }}) Environment=SPRING_ACTIVEMQ_USER={{ activemq_username }} Environment=SPRING_ACTIVEMQ_PASSWORD={{ activemq_password }} Environment=SPRING_ELASTICSEARCH_REST_URIS={{ elasticsearch_protocol }}://{{ elasticsearch_host }}:{{ ports_cfg.elasticsearch.http }} diff --git a/roles/sync/templates/config.yml.j2 b/roles/sync/templates/config.yml.j2 index ef8c06ed3..11d62b1b8 100644 --- a/roles/sync/templates/config.yml.j2 +++ b/roles/sync/templates/config.yml.j2 @@ -29,7 +29,7 @@ messaging: bean: org.apache.activemq:type=Broker,brokerName=localhost,destinationType=${messaging.events.repo.node.endpoint.type},destinationName=${messaging.events.repo.node.endpoint.name} broker: host: {{ activemq_host }} - port: {{ ports_cfg.activemq.openwire }} + port: {{ ports_cfg.activemq[activemq_protocol] }} protocol: {{ activemq_transport }} endpoint: ${messaging.broker.protocol}://${messaging.broker.host}:${messaging.broker.port} url: failover:(${messaging.broker.endpoint}?wireFormat.maxInactivityDurationInitalDelay=30000)?timeout=3000&jms.useCompression=true&startupMaxReconnectAttempts=0&jms.redeliveryPolicy.maximumRedeliveries=${messaging.events.repo.node.maxConsumers} diff --git a/roles/transformers/handlers/main.yml b/roles/transformers/handlers/main.yml index a6a2cec8f..65419ca6c 100644 --- a/roles/transformers/handlers/main.yml +++ b/roles/transformers/handlers/main.yml @@ -1,10 +1,10 @@ --- # handlers file for roles/transformers -- name: Wait for activemq on {{ activemq_host }}:{{ ports_cfg.activemq.openwire }} +- name: Wait for activemq on {{ activemq_host }}:{{ ports_cfg.activemq[activemq_protocol] }} listen: wait-for-activemq wait_for: host: "{{ activemq_host }}" - port: "{{ ports_cfg.activemq.openwire }}" + port: "{{ ports_cfg.activemq[activemq_protocol] }}" timeout: 300 connect_timeout: 5 diff --git a/roles/transformers/templates/ats-ate-aio.sh.j2 b/roles/transformers/templates/ats-ate-aio.sh.j2 index a3f3c1e5f..1c64e3434 100644 --- a/roles/transformers/templates/ats-ate-aio.sh.j2 +++ b/roles/transformers/templates/ats-ate-aio.sh.j2 @@ -9,7 +9,7 @@ export JAVA_OPTS="${JAVA_OPTS} -DPDFRENDERER_EXE={{ ats_home }}/alfresco-pdf-ren export JAVA_OPTS="${JAVA_OPTS} -DLIBREOFFICE_HOME=${LIBREOFFICE_HOME}" export JAVA_OPTS="${JAVA_OPTS} -DIMAGEMAGICK_ROOT=${IMAGEMAGICK_HOME} -DIMAGEMAGICK_DYN=${IMAGEMAGICK_DYN} -DIMAGEMAGICK_EXE=${IMAGEMAGICK_EXE} -DIMAGEMAGICK_CONFIG=${IMAGEMAGICK_CONFIG} -DIMAGEMAGICK_CODERS=${IMAGEMAGICK_CODERS}" {% if acs.edition == 'Enterprise' %} -export JAVA_OPTS="${JAVA_OPTS} -DACTIVEMQ_URL=failover:({{ activemq_transport }}://{{ activemq_host }}:{{ ports_cfg.activemq.openwire }})?timeout=3000" +export JAVA_OPTS="${JAVA_OPTS} -DACTIVEMQ_URL=failover:({{ activemq_transport }}://{{ activemq_host }}:{{ ports_cfg.activemq[activemq_protocol] }})?timeout=3000" export JAVA_OPTS="${JAVA_OPTS} -DACTIVEMQ_USER={{ activemq_username }}" export JAVA_OPTS="${JAVA_OPTS} -DACTIVEMQ_PASSWORD={{ activemq_password }}" export JAVA_OPTS="${JAVA_OPTS} -DFILE_STORE_URL=http://${ATS_SHARED_FS_HOST}:{{ ports_cfg.sfs.http }}/alfresco/api/-default-/private/sfs/versions/1/file" diff --git a/roles/trouter/templates/ats-atr.sh.j2 b/roles/trouter/templates/ats-atr.sh.j2 index e7d296043..60b097ef1 100644 --- a/roles/trouter/templates/ats-atr.sh.j2 +++ b/roles/trouter/templates/ats-atr.sh.j2 @@ -7,7 +7,7 @@ fi . {{ config_folder }}/setenv.sh export JAVA_OPTS="${JAVA_OPTS} -DCORE_AIO_URL=http://${ATS_TENGINE_AIO_HOST}:{{ ports_cfg.transformers.tengine }}" export JAVA_OPTS="${JAVA_OPTS} -DCORE_AIO_QUEUE=org.alfresco.transform.engine.aio.acs" -export JAVA_OPTS="${JAVA_OPTS} -DACTIVEMQ_URL=failover:({{ activemq_transport }}://{{ activemq_host }}:{{ ports_cfg.activemq.openwire }})?timeout=3000" +export JAVA_OPTS="${JAVA_OPTS} -DACTIVEMQ_URL=failover:({{ activemq_transport }}://{{ activemq_host }}:{{ ports_cfg.activemq[activemq_protocol] }})?timeout=3000" export JAVA_OPTS="${JAVA_OPTS} -DACTIVEMQ_USER={{ activemq_username }}" export JAVA_OPTS="${JAVA_OPTS} -DACTIVEMQ_PASSWORD={{ activemq_password }}" export JAVA_OPTS="${JAVA_OPTS} -DFILE_STORE_URL=http://{{ sfs_host }}:{{ ports_cfg.sfs.http }}/alfresco/api/-default-/private/sfs/versions/1/file" From aabf8197e2faf6102f9b5e2be4e3bc889a2537f6 Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo Date: Wed, 9 Nov 2022 13:09:42 +0100 Subject: [PATCH 17/18] support adding reindex parameters --- roles/search_enterprise/defaults/main.yml | 2 ++ .../default/host_vars/search-ent-instance.yml | 1 + .../molecule/default/verify.yml | 18 +++++++++++++++++- .../elasticsearch-connector-reindex.service.j2 | 2 +- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/roles/search_enterprise/defaults/main.yml b/roles/search_enterprise/defaults/main.yml index 671a800bd..33866f8d8 100644 --- a/roles/search_enterprise/defaults/main.yml +++ b/roles/search_enterprise/defaults/main.yml @@ -1,3 +1,5 @@ --- # defaults file for search_enterprise search_enterprise_port: 8081 +# see https://docs.alfresco.com/search-enterprise/latest/admin/#alfresco-elasticsearch-connector +search_enterprise_reindex_options: '' diff --git a/roles/search_enterprise/molecule/default/host_vars/search-ent-instance.yml b/roles/search_enterprise/molecule/default/host_vars/search-ent-instance.yml index 146ddd8e0..478cb93fe 100644 --- a/roles/search_enterprise/molecule/default/host_vars/search-ent-instance.yml +++ b/roles/search_enterprise/molecule/default/host_vars/search-ent-instance.yml @@ -1 +1,2 @@ ansible_user: ansible +search_enterprise_reindex_options: '--alfresco.reindex.concurrentProcessors=6' diff --git a/roles/search_enterprise/molecule/default/verify.yml b/roles/search_enterprise/molecule/default/verify.yml index 443692a65..e5759cb8d 100644 --- a/roles/search_enterprise/molecule/default/verify.yml +++ b/roles/search_enterprise/molecule/default/verify.yml @@ -1,6 +1,6 @@ --- - name: Verify - hosts: all + hosts: search_enterprise gather_facts: false tasks: - name: Populate service facts @@ -33,3 +33,19 @@ that: - ansible_facts.services['elasticsearch-connector-reindex.service'] is defined - ansible_facts.services['elasticsearch-connector-reindex.service'].state == 'inactive' + + - name: Retrieve contents of elasticsearch-connector-reindex.service + become: true + ansible.builtin.slurp: + src: /etc/systemd/system/elasticsearch-connector-reindex.service + register: service_file + + - name: Check reindex service contains the expected ExecStart line + become: true + vars: + service_file_content: "{{ service_file['content'] | b64decode }}" + expected_exec_start: "ExecStart=/opt/openjdk-11.0.15/bin/java -jar /opt/alfresco/enterprise-search-3.1.1/alfresco-elasticsearch-reindexing-3.1.1-app.jar --alfresco.reindex.concurrentProcessors=6" + ansible.builtin.assert: + that: + - "expected_exec_start in service_file_content" + msg: "{{ service_file_content }}" diff --git a/roles/search_enterprise/templates/elasticsearch-connector-reindex.service.j2 b/roles/search_enterprise/templates/elasticsearch-connector-reindex.service.j2 index 8cb295daa..3736889f5 100644 --- a/roles/search_enterprise/templates/elasticsearch-connector-reindex.service.j2 +++ b/roles/search_enterprise/templates/elasticsearch-connector-reindex.service.j2 @@ -13,7 +13,7 @@ Environment=SPRING_DATASOURCE_URL=jdbc:postgresql://{{ db_host }}:{{ ports_cfg.p Environment=SPRING_DATASOURCE_USERNAME={{ repo_db_username }} Environment=SPRING_DATASOURCE_PASSWORD={{ repo_db_password }} -ExecStart={{ java_home }}/bin/java -jar {{ search_enterprise_binaries_dir }}/alfresco-elasticsearch-reindexing-{{ search_enterprise.version }}-app.jar +ExecStart={{ java_home }}/bin/java -jar {{ search_enterprise_binaries_dir }}/alfresco-elasticsearch-reindexing-{{ search_enterprise.version }}-app.jar {{ search_enterprise_reindex_options }} WorkingDirectory={{ search_enterprise_binaries_dir }} From 8e769bd7abe0d2cb8beaba47b54b7eb7de2b8c6c Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo Date: Wed, 9 Nov 2022 13:12:16 +0100 Subject: [PATCH 18/18] fixup wrong tag --- playbooks/acs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playbooks/acs.yml b/playbooks/acs.yml index 5e2f606b2..a8343f4dd 100644 --- a/playbooks/acs.yml +++ b/playbooks/acs.yml @@ -186,7 +186,7 @@ marker_begin: SEARCH_ENTERPRISE_BEGIN marker_end: SEARCH_ENTERPRISE_END tags: - - sfs + - search_enterprise - name: Alfresco Digital Workspace Role hosts: adw