Skip to content

Commit

Permalink
4.2.0 release
Browse files Browse the repository at this point in the history
#188 biosecurity and blog email templates
  • Loading branch information
qifeng-bai committed Jun 27, 2024
1 parent 917424f commit 23bde45
Show file tree
Hide file tree
Showing 41 changed files with 2,151 additions and 897 deletions.
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,38 @@ Scheduling is handled by Quartz plugin in the app. It works like RSS - it checks

[![Build Status](https://api.travis-ci.com/AtlasOfLivingAustralia/alerts.svg?branch=develop)](https://app.travis-ci.com/github/AtlasOfLivingAustralia/alerts)

# Dev environment set up
# Dev environment set up

## Recommend:
Go folder ```./docker```, run ```docker-compose up```

Docker-compose runs MySql 8.1 on 3306, smtp4dev on 3000, 2525


## Alternative, you can install your own environment

What the docker-compose does:
1. Install MySql
1. Log in as root
1. ```create user 'alerts_user'@'localhost' identified as 'alerts_user';```
1. ```grant all privileges on *.* to 'alerts_user'@'localhost';```
1. ```create database alerts```
1. Create /data/alerts/config/alerts-config.properties
1. Use the template in ala-install to get the necessary values
1. Use the template in ala-install to get the necessary values


## To check email sending on local dev environment
### To check email sending on local dev environment
Run [smtp4dev](https://github.com/rnwood/smtp4dev) via Docker:

`docker run -p 3000:80 -p 2525:25 -d --name smtpdev rnwood/smtp4dev`

Emails will be sent on SMTP port 2525 (configure sending emails via `postie.enableEmail=true`, `grails.mail.port=2525` and `grails.mail.server=localhost`. Note: emails will not be delivered externally so you don't have to worry about spamming users.
Emails will be sent on SMTP port 2525 (configure sending emails via `mail.enabled=true`, `grails.mail.port=2525` and `grails.mail.server=localhost`. Note: emails will not be delivered externally so you don't have to worry about spamming users.

You can view all sent emails via the smtp4dev UI on http://localhost:3000/, inlcuding HTML emails which are nicely displayed.


### 4.2.0 Release

Change logs
DB schema update:
``` ALTER TABLE alerts.query_result MODIFY logs TEXT NULL; ```
13 changes: 8 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* rights and limitations under the License.
*/
buildscript {
version "4.0.0"
version "4.2.0"
group "au.org.ala"
}

Expand All @@ -25,9 +25,7 @@ plugins {
id "com.bertramlabs.asset-pipeline"
id "application"
id "eclipse"

id "com.gorylenko.gradle-git-properties" version "2.4.1"

id "maven-publish"
}

Expand Down Expand Up @@ -105,6 +103,8 @@ dependencies {
implementation "org.grails.plugins:hibernate5"
implementation("org.hibernate:hibernate-core:5.6.15.Final")
implementation "org.hibernate:hibernate-jcache"
implementation 'org.codehaus.groovy.modules.http-builder:http-builder:latest.release'

compileOnly("io.micronaut:micronaut-inject-groovy")

implementation "org.grails.plugins:gsp"
Expand Down Expand Up @@ -132,7 +132,10 @@ dependencies {
implementation "org.apache.httpcomponents:httpcore:4.4.16"

implementation 'dk.glasius:external-config:3.1.1'
implementation 'org.grails.plugins:mail:3.0.0'

//Using AWS SES as email provider
implementation 'org.grails.plugins:mail:4.0.0'
implementation 'au.org.ala:ala-mail:1.0.0-SNAPSHOT'

implementation 'org.grails.plugins:schwartz-monitor:2.0.1.ALA-SNAPSHOT'
implementation 'org.grails.plugins:quartz:2.0.13'
Expand All @@ -156,7 +159,7 @@ dependencies {
runtimeOnly 'xalan:xalan:2.7.3'
implementation 'com.jayway.jsonpath:json-path:2.7.0'
implementation 'com.jayway.jsonpath:json-path-assert:2.7.0'
implementation 'au.org.ala.plugins:openapi:1.1.0'
implementation 'au.org.ala.plugins:openapi:1.3.0'
}
//
//bootRun {
Expand Down
1 change: 1 addition & 0 deletions docker/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
COMPOSE_PROJECT_NAME=alerts
23 changes: 23 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

services:
mysql:
container_name: mysql-alerts
image: "mysql:8.1.0"
environment:
MYSQL_DATABASE: 'alerts'
MYSQL_USER: 'alerts_user'
MYSQL_PASSWORD: 'password'
MYSQL_ROOT_PASSWORD: 'password'
command: --default-authentication-plugin=mysql_native_password
ports:
- "3309:3306"
expose:
- '3309'
smtpdev:
image: rnwood/smtp4dev
ports:
- "3000:80"
- "2525:25"
container_name: smtpdev-alerts

version: "2"
Binary file added grails-app/assets/images/email/ALA-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added grails-app/assets/images/email/banner-ocean.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added grails-app/assets/images/email/logo-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added grails-app/assets/images/email/ncris.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added grails-app/assets/images/email/no-img-gray-bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 31 additions & 1 deletion grails-app/assets/stylesheets/alerts.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,34 @@ a.btn-ala {

.biosecurityTableColumn {
width: 20%;
}
}

.bioscecrurity-padding {
padding: 20px 0px 20px 0px;
}

.more-button {
background-color: #C44D34;
cursor: pointer;
border: 0;
border-radius: 10px;
color: white;
padding: 11px 19px;
text-align: center;
display: inline-block;
font-size: 16px;
}

.badge-info {
background-color: #17a2b8; /* Adjust the color as needed */
color: #fff;
}

.custom-list {
counter-reset: list-counter;
}

.indented-text {
text-indent: -2ch;
padding-left: 3ch;
}
80 changes: 65 additions & 15 deletions grails-app/conf/application.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
---
# mail.enabled: true will send email via a mail server depending on the mail.ses.enabled

# Set mail.ses.enabled true will use AWS SES, it requires the AWS credentials to be set in the environment variables
# Set false will use the default grails mail plugin, we need to config the mail server and port in grails.mail
# In dev, email will be posted to Postie docker container, which can be accessed via http://localhost:3000

mail:
enabled: true
ses:
enabled: false
details:
sender: "alerts@ala.org.au"
alertAddressTitle: "Atlas alerts"
infoSender: "alerts@ala.org.au"
infoAddressTitle: "Atlas of Living Australia"
defaultResourceName: "Atlas of Living Australia"
# forceAllAlertsGetSent results in emails getting sent regardless if data has changed - only use in DEV env
forceAllAlertsGetSent: false

grails:
#default mail service
mail:
port: 2525
server: localhost
profile: web
cache:
clearAtStartup: true
Expand Down Expand Up @@ -115,15 +138,6 @@ security:
adminRole: ROLE_ADMIN
uriFilterPattern: ["/","/alaAdmin/*","/testAuth/*","/query/*","/admin/*","/admin/user/*","/admin/user/debug/*","/admin/debug/all","/notification/myAlerts","/notification/changeFrequency","/notification/addMyAlert","/notification/addMyAlert/*","/notification/deleteMyAlert/*","/notification/deleteMyAlert/*","/notification/deleteMyAlertWR/*","/webservice/*","/webservice/createTaxonAlert","/webservice/taxonAlerts","/webservice/createRegionAlert","/webservice/regionAlerts","/webservice/deleteTaxonAlert/*","/webservice/create*","/webservice/createSpeciesGroupRegionAlert","/ws/*","/ws/createTaxonAlert","/ws/taxonAlerts","/ws/createRegionAlert","/ws/regionAlerts","/ws/deleteTaxonAlert/*","/ws/createTaxonRegionAlert","/ws/createSpeciesGroupRegionAlert","/admin/runChecksNow"]

postie:
emailSender: "atlas-alerts@ala.org.au"
emailAlertAddressTitle: "Atlas alerts"
emailInfoAddressTitle: "Atlas of Living Australia"
emailInfoSender: "atlas-alerts@ala.org.au"
defaultResourceName: "Atlas of Living Australia"
enableEmail: false
# forceAllAlertsGetSent results in emails getting sent regardless if data has changed - only use in DEV env
forceAllAlertsGetSent: false
ala:
baseURL: "https://www.ala.org.au"
userDetailsURL: "https://auth.ala.org.au/userdetails/userDetails/getUserListFull"
Expand Down Expand Up @@ -156,6 +170,11 @@ useBlogsAlerts: true
useCitizenScienceAlerts: true
biosecurity:
cronExpression: '0 30 9 ? * WED'
query:
template:
authoritativeList: /occurrences/search?q=species_list_uid:___LISTIDPARAM___&fq=decade:2020&fq=country:Australia&fq=first_loaded_date:[___DATEPARAM___%20TO%20*]&fq=occurrence_date:[___LASTYEARPARAM___%20TO%20*]&sort=first_loaded_date&dir=desc&disableAllQualityFilters=true
nonAuthoritativeList: /occurrences/search?q=species_list:___LISTIDPARAM___&fq=decade:2020&fq=country:Australia&fq=first_loaded_date:[___DATEPARAM___%20TO%20*]&fq=occurrence_date:[___LASTYEARPARAM___%20TO%20*]&sort=first_loaded_date&dir=desc&disableAllQualityFilters=true
maxRecords: 500
moreinfo:
link: https://www.ala.org.au/blogs-news/ala-helps-to-stop-pests-in-their-tracks/
dir: /data/alerts/emails
Expand All @@ -172,7 +191,7 @@ biosecurity:
lgaField: cl10923
shape: cl11033:"Namadgi" OR cl11033:"Tidbinbilla" OR cl11033:"Bimberi"
#shape: spatialObject:9223660
eventDateAge: 29
eventDateAge: 150
firstLoadedDateAge: 8

environments:
Expand All @@ -182,16 +201,41 @@ environments:
mail:
host: "localhost"
port: 1025
username: postie.emailSender
#username: postie.emailSender
security:
cas:
appServerName: "http://localhost:8080"
userdetails:
web:
url: https://aws-auth-test-2023.test.ala.org.au/userdetails/
api:
url: https://api.test.ala.org.au/userdetails/cognito/
mail:
details:
sender: "alerts-test@ala.org.au"
alertAddressTitle: "Atlas alerts [Dev]"
infoAddressTitle: "Atlas of Living Australia [Dev]"
infoSender: "alerts-test@ala.org.au"
test:
grails:
serverURL: "http://dev.ala.org.au:8080"
mail:
host: "localhost"
port: 25
security:
cas:
appServerName: "https://auth.ala.org.au"
userdetails:
web:
url: https://aws-auth-test-2023.test.ala.org.au/userdetails/
api:
url: https://api.test.ala.org.au/userdetails/cognito/
mail:
details:
sender: "alerts-test@ala.org.au"
alertAddressTitle: "Atlas alerts [Test]"
infoAddressTitle: "Atlas of Living Australia [Test]"
infoSender: "alerts-test@ala.org.au"
production:
grails:
serverURL: "https://auth.ala.org.au/alerts"
Expand All @@ -201,6 +245,11 @@ environments:
security:
cas:
appServerName: "https://auth.ala.org.au"
userdetails:
web:
url: https://auth.ala.org.au/userdetails/
api:
url: https://api.ala.org.au/userdetails/cognito/

---
hibernate:
Expand Down Expand Up @@ -229,7 +278,7 @@ dataSource:
validationQueryTimeout: 10 # seconds (default: -1 i.e. disabled)
validationInterval: 30000 # milliseconds, default is 30000 (30 seconds)
removeAbandoned: true # # default: false
removeAbandonedTimeout: 300 # seconds (default: 60)
removeAbandonedTimeout: 3600 # seconds (default: 60), must be > quartz job duration
logAbandoned: true # adds some overhead to every borrow from the pool, disable if it becomes a performance issue
logValidationErrors: true # default: false, logs validation errors at SEVERE
# NOTE: removeAbandoned: true OR testWhileIdle: true enables the Pool Cleaner. There is a bug with the
Expand Down Expand Up @@ -259,9 +308,11 @@ environments:
username: sa
password:
url: jdbc:h2:mem:testDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
userDetails:
url: https://aws-auth-test-2023.test.ala.org.au/userdetails/
production:
dataSource:
dbCreate: none
dbCreate: update

myannotation:
enabled: false
Expand All @@ -270,8 +321,7 @@ webservice:
jwt: true
jwt-scopes: "openid users/read"

userDetails:
url: https://aws-auth-dev.ala.org.au/userdetails/


security:
cas:
Expand Down
Loading

0 comments on commit 23bde45

Please sign in to comment.