The Voucher Cleanup Process
Overview
The voucher-cleanup.pl
program runs as an ongoing process and
regularly reviews the vouchers in the voucher database to trigger
state changes (such as removing old vouchers).
When deployed to a standard OS image this is process is run as a systemd service. The necessary
systemd configuration files are installed by the n2vs-svc
package and
are run on the backend-middleware (N2SVCD execution) environment for
N2VS (not the GUI, frontend-middleware (Jarvis), or DB servers).
Note that as this process connects to the SMF database, the voucher database, and the backend service API over HTTP, this program can run from any suitable container or VM.
Running voucher-cleanup.pl --help
will show the program usage.
Command Line Options
The following common options may be specified when executing:
Option | Type | Default | Description |
---|---|---|---|
--voucher-db-connect |
MongoDB Connection String | mongodb://n2vs:xxx@n2vs-mongo-db:27017/vouchers?authSource=admin |
A Perl MongoDB connection string to connect to the voucher database. This can be a read-only database connection (all changes are made via the backend processing system of N2VS |
--db-connect |
PSQL DB Connection String | dbi:Pg:dbname=n2in;host=n2vs-pg-db;port=5432 |
A Perl DBI PostgreSQL connection string. See PostgreSQL Connection Strings for more information. |
--db-user |
String | n2vs_owner |
The username of the user to connect to the PostgreSQL database instance with. |
--db-password |
String | The password for the user specified with --db-user to connect to the PostgreSQL database instance with. |
|
--service-channel-code |
String | deployment dependent | The API code to use when communicating with the N2VS password. This must match a service channel configured in the SMF database. |
--backend-url |
HTTP URL String | http://n2vs-backend:8080/api/ |
The backend API URL to communicate with the N2VS N2SVCD backend API. For production installations this should be reconfigured to use a TLS load balancer. |
Scalability
A single instance of this process is sufficiently efficient for all installations, however it is recommended at least two instances of this process are configured to execute on separate service nodes for redundancy.
Voucher Processing Lifecycle
The following table highlights the various lifecycles that will be applied to vouchers by the voucher cleanup process.
If a combination of voucher and voucher batch state is not mentioned then no processing will be applied by the voucher cleanup process.
The Cleanup Process Actions
applied will be calculated by the Time Since Last State Change
of the latest state change.
Voucher Batch State | Voucher State | Default Time Since Last State Change | Cleanup Process Actions |
---|---|---|---|
Redeemable , Locked |
Active , Locked , Redeemed |
365 Days | Transition Voucher to Dormant |
Dormant |
Dormant |
365 Days | Voucher Deleted |
Any | No Vouchers Remaining | N/A | Transition Voucher Batch to Removed |
Void |
Any | 365 Days | Delete all remaining Vouchers and transition Voucher Batch to Removed |