-
Notifications
You must be signed in to change notification settings - Fork 3
Module Deployments PIA Interface
The page lists manual additions that are required when configuring a template based project to use the pia_interface module. It applies to version 2.7 of the pia_interface module.
- Import JS: pia_interface needs to be imported into your application
- RQ Worker: and an RQ worker to process requests to PIA.
- PIA Configuration: Configuration of PIA credentials and settings
if there are custom application definition files main.*.js Import the pia interface into the appropriate file.
import initPiaInterface from 'modules/pia_interface/js/main.pia_interface';
initPiaInterface();
if the project doesn't need a custom application definition then pia_interface can be added to NMT by including the append-pia-interface.sh script along side your dockerfile.build, and adding following to the custom section of dockerfile.build
append-pia-interface.sh
#!/bin/bash
# Inject the PIA interface initialization into the main comms JS file
JS_FILE="${MODULES}/comms/public/js/main.mywcom.js"
if ! grep -q "initPiaInterface" "$JS_FILE"; then
cat <<EOF >> "$JS_FILE"
import initPiaInterface from 'modules/pia_interface/js/main.pia_interface';
initPiaInterface();
EOF
fi
Custom changes to dockerfile.build
# START CUSTOM SECTION
#Need to add pia_interface to comms application
COPY --chmod=744 --chown=www-data:www-data deployment/append-pia-interface.sh /opt/iqgeo/data/append-pia-interface.sh
RUN /opt/iqgeo/data/append-pia-interface.sh
# END CUSTOM SECTION
pia_interface v2.7 predates the release of the Long Running Task (LRT) framework, but with a few modifications to dockerfile.tools we can use the standard iqgeo-worker.
We need an entrypoint to start the RQ Worker. Add 990-start-rq.sh to a new folder entrypoint.d_tools. This folder should be along side the entrypoint.d folder already used by dockerfile.appserver
900-start-rq.sh
#!/bin/bash
rq worker --url "${RQ_REDIS_URL}" --with-scheduler --path /opt/iqgeo/platform/WebApps pia
Update dockerfile.tools with the following customisation.
# add additional entrypoint scripts (build db, ...)
# START CUSTOM SECTION
COPY --chown=www-data:www-data entrypoint.d_tools/* /entrypoint.d/
# Update paths to enable rq
ENV PYTHONPATH=/opt/iqgeo/platform/Externals/lib/python3.10/site-packages
ENV PATH="$PYTHONPATH/bin:$PATH"
# END CUSTOM SECTION
The following environment variables should be passed to both the iqgeo and iqgeo-worker services. Be sure to handle credentials securely, for example using secrets.
- PIA_BASE_URI
- PIA_CLIENT_ID
- PIA_CLIENT_SECRET
- PIA_DUNS
Update pia_interface.misc_settings in the Configuration > Settings page, and other settings as required.
For example:
{
"max_len": 1000,
"pia_key": "objectid",
"application_name": "PIA",
"email": "placeholder",
"agent_name": "placeholder",
"agent_tele": "placeholder_telephone" ,
"minimum_duct_length": 0.05,
"grid_type": "LONGLAT",
"use_notifications": false
}