Upgrade On-Premises

Pro Custodibus can be upgraded generally by stopping the API service, replacing the old distribution content with the new, and restarting the API; keeping the old database and configuration files the same.

Before upgrading, check the API changelog and app changelog files for any migration steps or other breaking changes of which you need to be aware.

To find the version of API you currently have installed, inspect its lib/api-*/priv/build.json file:

$ docker run --rm procustodibus/api-ce:1.0.0 sh -c \
    'cat /srv/procustodibus/api/lib/api*/priv/build.json'
{
    "commit": "b959c6b7cf31e957acee51243fbf3920ee27915c",
    "tag": "1.0.0",
    "date": "2023-08-08T14:14:16-07:00",
    "host": "j2",
    "user": "justin"
}

And for the app, inspect its data/build.json file:

$ docker run --rm procustodibus/app-ce:1.0.0 \
    cat /srv/procustodibus/app/data/build.json
{
    "commit": "f37e93238c559ff16c713a39b251a8f642bc0b3b",
    "tag": "1.0.0",
    "date": "2023-08-08T14:48:49-07:00",
    "host": "j2",
    "user": "justin"
}

Docker

To upgrade the Pro Custodibus Docker containers, if you are running the latest version of the Pro Custodibus images, pull the latest images:

$ docker pull procustodibus/app-ee:latest
Using default tag: latest
latest: Pulling from procustodibus/app-ee
7264a8db6415: Already exists
518c62654cf0: Already exists
d8c801465ddf: Already exists
ac28ec6b1e86: Already exists
eb8fb38efa48: Already exists
e92e38a9a0eb: Already exists
58663ac43ae7: Already exists
2f545e207252: Already exists
f85d072a4868: Already exists
5414e8be9602: Pull complete
ad2561ef820c: Pull complete
4f4fb700ef54: Pull complete
Digest: sha256:f0585d121cbf54f86ac1c47b6460a15a8a7f7b9d01c6c9093b90b62a95b4746b
Status: Downloaded newer image for procustodibus/app-ee:latest
docker.io/procustodibus/app-ee:latest
$ sudo docker pull procustodibus/api-ee:latest
Using default tag: latest
latest: Pulling from procustodibus/api-ee
14726c8f7834: Already exists
8d0f9f8b6b41: Already exists
656e632e0567: Pull complete
4f4fb700ef54: Pull complete
3ff4bb9b7d7e: Pull complete
Digest: sha256:aba75a1a4898a6b2b15ff5b274b927927e49db79659687f45cf6048313081493
Status: Downloaded newer image for procustodibus/api-ee:latest
docker.io/procustodibus/api-ee:latest

If you want to use a specific version, pull that version (eg 1.2.3) instead of latest.

Then restart the containers:

$ cd /srv/containers/procustodibus
$ sudo docker-compose up
Recreating procustodibus_app_1 ... done
Recreating procustodibus_api_1 ... done
Starting procustodibus_db_1  ... done
Attaching to procustodibus_db_1, procustodibus_app_1, procustodibus_api_1
app_1  | 2023/08/30 20:47:43 [notice] 14#14: using the "epoll" event method
app_1  | 2023/08/30 20:47:43 [notice] 14#14: nginx/1.25.1
app_1  | 2023/08/30 20:47:43 [notice] 14#14: built by gcc 12.2.1 20220924 (Alpine 12.2.1_git20220924-r4)
app_1  | 2023/08/30 20:47:43 [notice] 14#14: OS: Linux 5.19.0-50-generic
app_1  | 2023/08/30 20:47:43 [notice] 14#14: getrlimit(RLIMIT_NOFILE): 1048576:1048576
app_1  | 2023/08/30 20:47:43 [notice] 14#14: start worker processes
app_1  | 2023/08/30 20:47:43 [notice] 14#14: start worker process 15
app_1  | 2023/08/30 20:47:43 [notice] 14#14: start worker process 16
app_1  | 2023/08/30 20:47:43 [notice] 14#14: start worker process 17
app_1  | 2023/08/30 20:47:43 [notice] 14#14: start worker process 18
db_1   |
db_1   | PostgreSQL Database directory appears to contain a database; Skipping initialization
db_1   |
db_1   | 2023-08-30 20:47:43.292 UTC [1] LOG:  starting PostgreSQL 15.3 on x86_64-pc-linux-musl, compiled by gcc (Alpine 12.2.1_git20220924-r10) 12.2.1 20220924, 64-bit
db_1   | 2023-08-30 20:47:43.292 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
db_1   | 2023-08-30 20:47:43.292 UTC [1] LOG:  listening on IPv6 address "::", port 5432
db_1   | 2023-08-30 20:47:43.313 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1   | 2023-08-30 20:47:43.335 UTC [23] LOG:  database system was shut down at 2023-08-30 20:47:26 UTC
db_1   | 2023-08-30 20:47:43.350 UTC [1] LOG:  database system is ready to accept connections
api_1  | 20:47:44.184 [info] database initialized already
api_1  | 20:47:44.218 [info] Migrations already up
api_1  | 20:47:46.813 [info] Running ApiWeb.Endpoint with cowboy 2.10.0 at :::4000 (http)
api_1  | 20:47:46.828 [info] Access ApiWeb.Endpoint at https://custos.internal.example.net

API Server

To upgrade a native API server install, download the latest version from the Download page (or build it yourself).

The API server binaries must be built on a machine (or virtual machine or container) using the exact same CPU architecture and OS (operating system) version as it will be run on. If you do not find an exact match to the CPU architecture and OS version on the Download page, you must build it yourself.

On your API server, extract the API tarball, stop the API if running, and replace the old API directory with the newly extracted api/ directory:

$ tar xf procustodibus-app-ce-1.2.3-Linux-aarch64-fedora-38.tar.bz2
$ sudo systemctl stop procustodibus-api
$ sudo mv /srv/procustodibus/api /srv/procustodibus/api-old
$ sudo mv api /srv/procustodibus/api

Update the new API directory permissions as described in the API Directory Permissions section of the install docs.

Then you can start the API back up again:

$ sudo systemctl start procustodibus-api

If you tail its logs, you should see the following output:

$ journalctl -u procustodibus-api -f
Aug 30 00:47:49 colossus systemd[1]: Started Pro Custodibus API.
Aug 30 00:47:50 colussus api[7490]: [info] database initialized already
Aug 30 00:47:50 colussus api[7490]: [info] Migrations already up
Aug 30 00:47:54 colussus api[7561]: [info] Running ApiWeb.Endpoint with cowboy 2.10.0 at :::443 (https)
Aug 30 00:47:54 colussus api[7561]: [info] Access ApiWeb.Endpoint at https://custos.internal.example.net

App Web UI

To upgrade a native app UI install, download the latest version from the Download page (or build it yourself). Make sure you download (or build) the app UI edition that matches the edition of the API you installed above.

On your webserver, extract the tarball, and replace the old app UI directory with the newly extracted dist/ directory:

$ tar xf procustodibus-app-ce-1.2.3.tar.bz2
$ sudo mv /srv/procustodibus/app /srv/procustodibus/app-old
$ sudo mv dist /srv/procustodibus/app

Update the new app UI directory permissions as described in the App Directory Permissions section of the install docs. Also update the environment variables in the new app UI index.html file to match the old index.html file (as described in the App Environment Variables section of the install docs).

Diff the new index.html file with the old file to see which environment variables you customized (or have otherwise changed):

$ diff -u /srv/procustodibus/app /srv/procustodibus/app-old
--- /srv/procustodibus/app/index.html	2023-08-30 19:39:51.401698756 -0700
+++ /srv/procustodibus/app-old/index.html	2023-08-08 14:48:49.129732785 -0700
@@ -12,7 +12,7 @@
     <script>window.ENV = {
       AGENT_SIGNING_KEYS: "98EE78FAB506BEABC0DADE15EFC1AE969DD8159F",
       AGENT_VERSION: "1.3.3",
-      API_URL: "https://procustodibus.example.com/api",
+      API_URL: "https://custos.internal.example.net/api",
       DOC_URL: "https://docs.procustodibus.com",
       DOWNLOAD_URL: "https://ad.custodib.us",
       SITE: "prod",
@@ -21,7 +21,7 @@
       TITLE: "Pro Custodibus",
       WWW_URL: "https://www.procustodibus.com",
     }</script>
-    <script type="module" crossorigin src="/assets/index-3de93f9e.js"></script>
+    <script type="module" crossorigin src="/assets/index-1e9d0c95.js"></script>
     <link rel="stylesheet" href="/assets/index-babb24fc.css">
   <link rel="manifest" href="/manifest.webmanifest"></head>
   <body>

Navigate to the app UI in a web browser, and press the Ctrl+Shift+R keys to force the browser to reload the page (and check for changes to other resources included on the page).