Hosting Your Own Registry
Introduction
When you have an OpenShift or Kubernetes cluster which is firewalled, you will need to host Mendix components in your own image registry.
Storing images in your own registry can also help as it caches images locally and saves network bandwidth.
This document explains how to export the components from the Mendix registry and import them into your own registry. It also explains how to tell the Mendix Configuration Tool to use your own registry when configuring the namespace.
Prerequisites for Migrating to Your Registry
To export components from the Mendix registry, you will need the following:
- Access to the internet
- A local or managed image registry
- All the other prerequisites for creating a Mendix for Private Cloud cluster, as documented in the Prerequisites for Creating a Cluster section of Creating a Private Cloud Cluster.
Download the Mendix Configuration Tool
Follow the instructions in Creating a Private Cloud Cluster using the configuration tool until you reach Running the Configuration Tool.
Export Mendix Components
To export the Mendix components you want to migrate to your own registry, you need to run the Mendix Configuration Tool in registry migration mode.
Follow these steps to export the Mendix components and store them on your local machine:
-
Start the Configuration Tool using the command
mxpc-cli registry-migration
to initiate registry migration mode. -
Select Migration Type to be Export.
-
Select the Main Components and Storage Provisioners you want to export.
-
Enter the version numbers of any Mendix Runtimes which you want to export. You can use wildcards and create a list of versions separated by commas. For example
10.12.*, 9.24.26.*
will export all patch versions of the Mendix 10.12 runtime and the published build of the Mendix 9.24.26 runtime. -
Click the Clear cache button, which will trigger the deletion of local image cache, otherwise the cache is reused when redownloading the same images.
-
Click the Check for updates button, which is used to verify that the hash of your downloaded images matches with the latest remote images.
-
Click Export components.
The components you selected will be extracted from the Mendix repository and saved on your local machine. This will be in the folder
C:\Users\<User id>\.mxpc-cli\registry-migration
on Windows orhome/<User id>/.mxpc-cli/registry-migration
for Mac and Uix. This can take some time. Wait for the messageThe images for the selected components were exported successfully in tarballs*.
./mxpc-cli registry-migration --help
Since version 2.10.2 of mxpc-cli
, you can change this limit by using a --max-images
command-line argument, for example, mxpc-cli registry-migration --max-images=50
.
Import Mendix Components Into Your Own Registry
Once you have the Mendix components saved on your local machine, you can import them into your own registry. This means that, once configured, Mendix will be able to find them, even if you have an air-gapped installation which is not connected to the internet.
Perform the following steps.
-
If you are not continuing from the previous section, ensure that the Configuration Tool is started in registry migration mode. Use the command
mxpc-cli registry-migration
if it is not already running. -
Select Migration Type to be Import.
-
Enter the following Repository Details:
- Registry User – the username used for authorized access to the registry
- Registry Password – the password used for authorizing the registry user
- Registry URL
- Repository – the name you have given to your repository
-
Click Update Credentials.
-
Select the Main Components and Storage Provisioners you want to import into your own registry.
You can only choose components which you exported in the previous section, Export Mendix Components.
ALL runtime versions you exported will be imported – you cannot choose which versions are imported -
Click Import components.
The components you selected will be uploaded from the folder on your local machine where they were saved, and imported into the selected registry. This will be from the folder
C:\Users\<User id>\.mxpc-cli\registry-migration
on Windows orhome/<User id>/.mxpc-cli/registry-migration
for Mac and Linux.
Create and Configure Mendix for Private Cloud Cluster and Namespace
You can now create a new Mendix for Private Cloud cluster and namespace. To tell the Configuration Tool that you want to use your own registry, you will use the configuration tool with the argument --registry {registry_url}/{repository}
(use the Registry URL value specified in the previous step as the {registry_url}
value, and Repository as the value for {repository}
).
Continue following the instructions in Creating a Private Cloud Cluster from Running the Configuration Tool.
In the section Running the Configuration Tool, add the flag --registry
to the command line that you paste into the terminal, before your press Enter.
Base Installation
With the --registry
flag set, follow the instructions in the Base Installation section of Creating a Private Cloud Cluster.
Configure Namespace
With the --registry
flag set, follow the instructions in the Configure Namespace section of Creating a Private Cloud Cluster.
When you get to the stage Review and Apply, the YAML file which you create will contain the location of your own registry instead of the default Mendix registry. The patched YAML file is stored in the subfolder .mxpc-cli/<project name/<folder name>/kube
of your user home directory (for example C:\Users\<User id>\.mxpc-cli\<project name\<folder name>\kube
in Windows or /home/<User id>/.mxpc-cli/<project name/<folder name>/kube
for Mac and Linux). The Installer output panel will confirm the location of the saved file when you click Write YAML.
Click Apply Configuration to apply the configuration to your namespace, as normal.
Upgrade Cluster
If you have already installed and configured a namespace, but would like to upgrade it to the current Mendix for Private Cloud version, follow the instructions in the Upgrade cluster section of Upgrading Private Cloud.
To use images from your private registry, set the --registry
flag when running the Mendix Configuration Tool.