PEVA Connector management scripts

Scripts that install, update, run and back up the PEVA Connector — the integration service that downloads archival fund descriptions from the PEvA2 system (Portál NAČR) and feeds them into Elza — on a Linux host. They are built on the shared Lightcomp deployment engine; one config file (peva-connector-env) holds everything environment-specific.

Install

On the target host, as a user with sudo:

curl -fsSL https://get.lightcomp.com/peva-connector/peva-connector-bootstrap.sh | bash -s -- --home /opt/peva-connector

This downloads the script bundle (checksum-verified) into /opt/peva-connector/scripts, renders the product-named commands and systemd units, and seeds the configuration file. Then:

  1. Edit /opt/peva-connector/scripts/peva-connector-env — uncomment only the values that differ from the defaults (database name, health URL, CSC account …).
  2. If the file holds the CSC secret, restrict it — but keep it readable for the app user (the backup and health services read it as elza through the file's group; do not use chmod 600):
    sudo chgrp elza /opt/peva-connector/scripts/peva-connector-env
    sudo chmod 640 /opt/peva-connector/scripts/peva-connector-env
  3. Provide the application configuration (config/peva-connector.yml — PEvA, Elza and database credentials).
  4. Check the resolved configuration: /opt/peva-connector/scripts/peva-connector-deploy --show-config
  5. Deploy a release: sudo /opt/peva-connector/scripts/peva-connector-deploy --auto (or a specific version: peva-connector-deploy 1.0.0).

Add --channel main to the install command for the latest (snapshot) scripts instead of stable; the choice is remembered for updates.

Application configuration

Separate from the deploy config above, the application itself reads config/peva-connector.yml in the install directory (spring.config.name=peva-connector). Create it from the template shipped in the distribution package and fill in the PEvA endpoint/credentials, the Elza connection and the PostgreSQL URL/credentials. The service listens on port 8081 by default and exposes a health endpoint at /actuator/health.

Upgrading

1. Updating the scripts themselves

Re-run the installed bootstrap — no arguments needed. It locates the installation from its own path, keeps the channel it was installed from and never overwrites your peva-connector-env. When the published build is unchanged nothing is downloaded (safe to run as often as you like):

/opt/peva-connector/scripts/peva-connector-bootstrap.sh

2. Updating the application

sudo /opt/peva-connector/scripts/peva-connector-deploy --auto

The flow is: stop service → pre-update DB backup → activate the new release (atomic symlink switch) → start → verify. The result is reported to the Lightcomp Customer Service Center (CSC) when an account is configured.

Downgrade warning: switching back to an older release is not a safe rollback by itself — Liquibase migrates the database schema forward on startup. Restore the matching pre-update dump first.

3. Unattended updates

Install the peva-connector-update service (below), then enable per instance in peva-connector-env:

AUTOUPDATE=on

The timer checks hourly and applies a newly confirmed version outside working hours (default Mo-Fr 06:00-18:00, configurable via AUTOUPDATE_WORKHOURS; set it empty to update any hour — typical for TEST instances).

Setting up the services (systemd)

The bundle ships unit templates in /opt/peva-connector/scripts/systemd/, already rendered with your install path and the elza service account filled in — copy and enable, no editing needed. Each service is a separate decision; install only what the instance needs.

UnitPurposeRuns asSchedule
peva-connector.service the application (current/peva-connector.jar) elzaalways
peva-connector-backup.timer database backup elzaweekly, Sun 02:30
peva-connector-health.timer health heartbeat to CSC elza every 10 min; send rate = HEARTBEAT_INTERVAL
peva-connector-update.timer unattended update root hourly, outside AUTOUPDATE_WORKHOURS

Application — peva-connector.service

Required on every instance.

sudo cp /opt/peva-connector/scripts/systemd/peva-connector.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now peva-connector.service

Verify: systemctl status peva-connector; application log in logs/peva-connector.log.

Database backup — peva-connector-backup

Recommended on production. Runs weekly as the app user (BACKUP_AS=dbuser — the DB password is read from peva-connector.yml), so peva-connector-env must be readable by that user (the chgrp/chmod 640 step in Install). Retention is configured in peva-connector-env (BACKUP_KEEP_DAYS, default 14 days).

sudo cp /opt/peva-connector/scripts/systemd/peva-connector-backup.{service,timer} /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now peva-connector-backup.timer
sudo systemctl start peva-connector-backup.service   # run one backup now to verify

Health heartbeat — peva-connector-health

Install when the instance has a CSC account; without one the service is a harmless no-op. Recommended config in peva-connector-env: HEALTH_URL=http://127.0.0.1:8081/actuator/health so the heartbeat distinguishes "process up" from "really serving".

sudo cp /opt/peva-connector/scripts/systemd/peva-connector-health.{service,timer} /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now peva-connector-health.timer
sudo systemctl start peva-connector-health.service   # send one heartbeat now to verify

Verify locally without sending: /opt/peva-connector/scripts/peva-connector-health --check.

Unattended updates — peva-connector-update

Opt-in. The unit runs as root (it stops/starts the service; no sudo setup) and stays inert until you set AUTOUPDATE=on in peva-connector-env.

sudo cp /opt/peva-connector/scripts/systemd/peva-connector-update.{service,timer} /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now peva-connector-update.timer

Verify: systemctl list-timers 'peva-connector-*' shows the next run; activity: journalctl -u peva-connector-update.service -n 50.

Files

FilePurpose
peva-connector-bootstrap.sh installer / updater of the scripts (stable)
peva-connector-scripts.tar.gz (.sha256) the script bundle, stable channel
snapshots/main/ main channel (latest) — same file names