// module included in the following assembly:
//
// * installing/disconnected_install/installing-mirroring-creating-registry.adoc

:_mod-docs-content-type: PROCEDURE
[id="mirror-registry-localhost-update_{context}"]
= Updating mirror registry for Red Hat OpenShift from a local host

[role="_abstract"]
You can update the _mirror registry for Red{nbsp}Hat OpenShift_ from a local host by using the `upgrade` command. Updating to the latest version ensures new features, bug fixes, and security vulnerability fixes.

[IMPORTANT]
====
When upgrading from version 1 to version 2, be aware of the following constraints:

** The worker count is set to `1` because multiple writes are not allowed in SQLite. 
** You must not use the _mirror registry for Red{nbsp}Hat OpenShift_ user interface (UP).
** Do not access the `sqlite-storage` Podman volume during the upgrade.
** There is intermittent downtime of your mirror registry because it is restarted during the upgrade process.
** PostgreSQL data is backed up under the `/$HOME/quay-install/quay-postgres-backup/` directory for recovery.
====

.Prerequisites

* You have installed the _mirror registry for Red{nbsp}Hat OpenShift_ on a local host.

.Procedure

* To upgrade the _mirror registry for Red{nbsp}Hat OpenShift_ using the existing certificates, enter the following command:
+
[source,terminal]
----
$ sudo ./mirror-registry upgrade -v
----
+
[NOTE]
====
* Starting with _mirror registry for Red{nbsp}Hat OpenShift_ 2.0.11, the `upgrade` command preserves the existing `SERVER_HOSTNAME`, including custom ports, and the `quayRoot`, `quayStorage`, and `sqliteStorage` settings from the current installation. You do not need to pass `--quayHostname`, `--quayRoot`, `--quayStorage`, or `--sqliteStorage` for a standard upgrade. Pass these flags only when you want to override the preserved values.

* When upgrading from 1.3 to 2.y with the default installation directory at `/etc/quay-install`, _mirror registry for Red{nbsp}Hat OpenShift_ migrates Podman volumes for {quay} storage, Postgres data, and `/etc/quay-install` data to the new `$HOME/quay-install` location.
====

* Optional: To override preserved install or storage paths during upgrade, pass the `--quayRoot`, `--quayStorage`, or `--sqliteStorage` flags. For example:
+
[source,terminal]
----
$ sudo ./mirror-registry upgrade --quayRoot <example_directory_name> \
  --quayStorage <example_directory_name>/quay-storage \
  --sqliteStorage <example_directory_name>/sqlite-storage -v
----

* Optional: To rotate SSL/TLS certificates during upgrade (_mirror registry for Red{nbsp}Hat OpenShift_ 2.0.11 and later), pass both the `--sslCert` and `--sslKey` flags. You must provide both flags together; if you pass only `--sslCert` or only `--sslKey`, the upgrade command fails with an error. For example:
+
[source,terminal]
----
$ sudo ./mirror-registry upgrade --sslCert /path/to/new.cert \
  --sslKey /path/to/new.key -v
----
+
To skip hostname validation when the certificate does not match `SERVER_HOSTNAME` in the Quay `config.yaml` file, for example when you use a wildcard or internal CA certificate, pass the `--sslCheckSkip` flag together with `--sslCert` and `--sslKey`. For example:
+
[source,terminal]
----
$ sudo ./mirror-registry upgrade --sslCert /path/to/cert \
  --sslKey /path/to/key --sslCheckSkip -v
----
+
[IMPORTANT]
====
* If you do not pass SSL flags, the upgrade uses the existing certificates. A warning is displayed if the existing certificates are not found on the target host.
* During a PostgreSQL to SQLite migration, missing certificates block the upgrade before any database changes are made.
* The `--sslCheckSkip` flag skips CLI hostname validation only. Quay still requires valid `ssl.cert` and `ssl.key` configuration to start.
====

.Verification

. Ensure that _mirror registry for Red{nbsp}Hat OpenShift_ has been updated by running the following command:
+
[source,terminal]
----
$ podman ps
----
+
.Example output
+
[source,terminal]
----
registry.redhat.io/quay/quay-rhel8:v3.12.10
----
