Skip to content

Commit d7cb881

Browse files
Merge branch 'main' into PLAT-235-logstash-dev-mount
2 parents 8d34b8f + f3bf5c2 commit d7cb881

File tree

14 files changed

+136
-60
lines changed

14 files changed

+136
-60
lines changed

.env.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ LOGSTASH_MEMORY_RESERVE=500M
8888
# ES_ELASTIC - Required for Logstash, set in the "Analytics Datastore - Elastic Search" section
8989
LS_JAVA_OPTS=-Xmx2g -Xms2g
9090

91-
# Dashboard Visualiser - JS Reports
91+
# Dashboard Visualiser - JS Report
9292

9393
JS_REPORT_INSTANCES=1
9494
JS_REPORT=dev_password_only

.env.local

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,15 @@ LS_JAVA_OPTS=-Xmx2g -Xms2g
5252
LOGSTASH_DEV_MOUNT=false
5353
LOGSTASH_PACKAGE_PATH=
5454

55-
# Dashboard Visualiser - JS Reports
55+
# Dashboard Visualiser - JS Report
5656

5757
JS_REPORT_INSTANCES=1
5858
JS_REPORT=dev_password_only
5959
JS_REPORT_USERNAME=admin
6060
JS_REPORT_SECRET=dev_secret_only
6161
JS_REPORT_SSL=false
6262
JS_REPORT_CONFIG_FILE=export.jsrexport
63+
64+
# MAKE SURE YOU HAVE RUN 'set-permissions.sh' SCRIPT BEFORE AND AFTER RUNNING JS REPORT
65+
JS_REPORT_DEV_MOUNT=false
66+
JS_REPORT_PACKAGE_PATH=
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# JS Report metadata files
2+
fs.journal
3+
fs.version
4+
monitoring
5+
settings
6+
profiles
7+
storage

dashboard-visualiser-jsreport/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,18 @@ JS Reports is a visualisation tool, which in our use case, is querying informati
55
## Accessing the services
66

77
- JS Reports <http://localhost:5488/> - (u: admin p: dev_password_only) - for pixel-perfect PDF reporting
8+
9+
## Developing the JS Report scripts/templates locally
10+
11+
When seeking to make changes to the JS Report scripts/templates without having to repeatedly start and stop the service, one can set the `JS_REPORT_DEV_MOUNT`
12+
env var in your .env file to `true` to attach the service's content files to those on your local machine.
13+
14+
- You have to run the `set-permissions.sh` script before launching JS Report when `JS_REPORT_DEV_MOUNT=true`.
15+
- `NB!!! REMEMBER TO EXPORT THE JSREXPORT FILE WHEN YOU'RE DONE EDITING THE SCRIPTS` (https://jsreport.net/learn/import-export)
16+
17+
## Notes
18+
19+
- With `JS_REPORT_DEV_MOUNT=true`, you have to set the `JS_REPORT_PACKAGE_PATH` variable with the absolute path to the JS Report package on your local machine, i.e., `LOGSTASH_PACKAGE_PATH=/home/user/Documents/Projects/platform/dashboard-visualiser-jsreport`.
20+
21+
- Remember to shutdown JS Report before changing git branches if `JS_REPORT_DEV_MOUNT=true`, otherwise the dev mount will persist the JS Report scripts/templates across your branches.
22+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: '3.9'
2+
3+
services:
4+
dashboard-visualiser-jsreport:
5+
volumes:
6+
- ${JS_REPORT_PACKAGE_PATH}/scripts/:/app/jsreport/data/

dashboard-visualiser-jsreport/docker-compose.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ services:
1919
co.elastic.metrics/metricsets: 'cpu,memory,diskio,info,healthcheck,container'
2020
environment:
2121
allowLocalFilesAccess: 'true'
22-
extensions_fs-store_dataDirectory: 'jsreport/data'
22+
extensions_fsStore_dataDirectory: 'jsreport/data'
23+
extensions_fsStore_externalModificationsSync: 'true'
2324
extensions_authentication_cookieSession_secret: ${JS_REPORT_SECRET:-dev_secret_only}
2425
extensions_authentication_admin_username: 'admin'
2526
extensions_authentication_admin_password: ${JS_REPORT:-dev_password_only}
3 Bytes
Binary file not shown.

dashboard-visualiser-jsreport/package-metadata.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
"JS_REPORT_CPU_LIMIT": "0.8",
1717
"JS_REPORT_MEMORY_LIMIT": "3G",
1818
"JS_REPORT_CPU_RESERVE": "0.05",
19-
"JS_REPORT_MEMORY_RESERVE": "500M"
19+
"JS_REPORT_MEMORY_RESERVE": "500M",
20+
"JS_REPORT_DEV_MOUNT": "false",
21+
"JS_REPORT_PACKAGE_PATH": ""
2022
}
2123
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "elasticSearchConnTestScript",
3+
"scope": "global",
4+
"shortid": "LWSXMjRQeQ",
5+
"creationDate": {
6+
"$$date": 1652944733948
7+
},
8+
"modificationDate": {
9+
"$$date": 1652944733948
10+
},
11+
"inheritedReadPermissions": [],
12+
"inheritedEditPermissions": [],
13+
"_id": "4JSx1OQ519Ru98za",
14+
"$entitySet": "scripts"
15+
}
16+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Use the "beforeRender" or "afterRender" hook
2+
// to manipulate and control the report generation
3+
const axios = require('axios')
4+
5+
async function beforeRender (req, res) {
6+
const resData = await axios({
7+
method: 'get',
8+
url: `http://analytics-datastore-elastic-search:9200/_cat/health/`,
9+
headers: {
10+
'Content-Type': 'application/json',
11+
Authorization: `Basic ${new Buffer(
12+
`elastic:dev_password_only`
13+
).toString('base64')}`
14+
}
15+
})
16+
17+
req.data = Object.assign({}, {healthcheck: resData.data})
18+
}

0 commit comments

Comments
 (0)