Skip to content

Commit

Permalink
4.4.0 (4.3.1) release
Browse files Browse the repository at this point in the history
Add userDetails base url : AtlasOfLivingAustralia/alerts#326
Change logback format
  • Loading branch information
qifeng-bai committed Nov 13, 2024
1 parent 5b5f480 commit c5e7d45
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 1 deletion.
67 changes: 67 additions & 0 deletions ansible/roles/alerts/files/4.3.1_update_records.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
-- One-time update for the 4.3.1 release:

-- 1. Annotations now uses its own template. To update the template, run the following query:
update alerts.query set email_template='/email/annotations' where name='Annotations';

-- 2. My Annotations now uses its own template. To update the template, run the following query:
update alerts.query set email_template='/email/myAnnotations' where name='My Annotations';

-- 3. Annotation on records for Dataset / collections / species now uses its "Annotation" template. To update the template, run the following query:

UPDATE alerts.query
SET email_template = '/email/annotations'
WHERE name LIKE 'New annotations on%';

-- 4. Species List Annotations now share the same template with datasets. To update the template, run the following query:
-- 4.1 Update fire_when_change to false for species list queries

UPDATE alerts.property_path
SET fire_when_change = false
WHERE query_id IN (
SELECT query_id
FROM query
WHERE email_template = '/email/specieslists'
);

-- 4.2
update alerts.query set email_template="/email/datasets" where email_template='/email/specieslists';

-- 5. Data Resource using Collectory Service now share the same template with datasets. To update the template, run the following query:
-- 5.1
-- update alerts.query set email_template="/email/datasets" where email_template='/email/dataresource';


-- 6. Check base_url and query_path for the queries which name is "Annotations" and "My Annotations"

-- if base_url is like:
-- https://biocache.ala.org.au
-- and query_path is like:
-- /ws/occurrences/search?fq=user_assertions:*&q=last_assertion_date:[___DATEPARAM___%20TO%20*]&sort=last_assertion_date&dir=desc&pageSize=20&facets=basis_of_record
--
-- then they should be changed to:
-- https://biocache.ala.org.au/ws
-- and
-- /occurrences/search?fq=user_assertions:*&q=last_assertion_date:[___DATEPARAM___%20TO%20*]&sort=last_assertion_date&dir=desc&pageSize=20&facets=basis_of_record

UPDATE alerts.query
SET
base_url = CONCAT(base_url, '/ws'), -- Add '/ws' to the end of base_url
query_path = SUBSTRING(query_path, 4) -- Remove '/ws' from the start of query_path
WHERE
query_path LIKE '/ws%'; -- Only apply if query_path starts with '/ws'


-- Update some queries using api.test.ala.org.au and api.ala.org.au

UPDATE alerts.query
SET
base_url = 'https://biocache-ws-test.ala.org.au/ws'
WHERE
base_url LIKE 'https://api.test.ala.org.au/occurrences%';


UPDATE alerts.query
SET
base_url = 'https://biocache.ala.org.au/ws'
WHERE
base_url LIKE 'https://api.ala.org.au/occurrences%';
19 changes: 19 additions & 0 deletions ansible/roles/alerts/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,25 @@
- db
- alerts

#- name: Copy 4.3.1 database records update SQL script
# ansible.builtin.copy:
# src: files/4.3.1_update_records.sql
# dest: /tmp
# tags:
# - 4.3.1
#
#- name: Update queries records for 4.3.1
# community.mysql.mysql_db:
# name: "{{ alerts_db_name }}" # Database name to apply the SQL script to
# state: import
# target: "{{ item }}" # SQL script file
# login_user: "{{ alerts_db_username }}" # Database username
# login_password: "{{ alerts_db_password }}" # Database password
# with_items:
# - /tmp/4.3.1_update_records.sql
# tags:
# - 4.3.1

- name: ensure target directories exist [data subdirectories etc.]
file: path={{item}} state=directory owner={{ tomcat_user }} group={{ tomcat_user }}
with_items:
Expand Down
1 change: 1 addition & 0 deletions ansible/roles/alerts/templates/alerts-config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ collectory.baseURL={{ collectory_url | default('https://collections.ala.org.au')
collectoryService.baseURL: {{ collectory_service_url | default('https://collections.ala.org.au') }}
ala.userDetailsURL={{ alerts_userdetails_url | default(userdetails_url) | default('https://auth.ala.org.au/userdetails') }}/userDetails/getUserListFull
lists.baseURL={{ lists_url | default('https://lists.ala.org.au') }}
userDetails.web.url ={{ user_details_url | default('https://auth.ala.org.au/userdetails') }}

# Emails
postie.enableEmail={{ enable_email | default('') }}
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/alerts/templates/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<maxFileSize>10MB</maxFileSize>
</triggeringPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %5p --- %-40.40logger{39} : %m%n%wex</pattern>
<pattern>%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(%logger{39} [%file:%line]){cyan} %clr(:){faint} %m%n%wex</pattern>
</encoder>
</appender>

Expand Down

0 comments on commit c5e7d45

Please sign in to comment.