-
The Registry is a web application with a basic UI to support a virtual file system.
-
It supports HTTP GET, PUT, and DELETE methods, used by Maven, to browse and manipulate data.
-
It implements NuGet and NPM REST APIs.
-
Access to the application is authorized.
-
The Registry stores data in an IBM Cloud Object Storage instance accessed by a dedicated Service ID, which is not exposed to the end user.
-
Users are granted access rights by the owner, who manages them in the IAM API Keys dashboard of another dedicated Service ID.
-
Access rights are granted for read or write and are subject to directory filtering.
Users can configure Maven, NuGet, NPM, or other tools to use the application as a private registry.
Define repositories and credentials in the settings.xml
file, which is typically located in the ${MAVEN_HOME}/conf
directory or the ${USER_HOME}/.m2
directory.
Add repositories in the profiles
section of the settings.xml
file. Here’s an example:
<settings>
<servers>
<server>
<id>my-private-repo</id>
<username>your-username</username>
<password>your-password</password>
</server>
</servers>
<profiles>
<profile>
<id>private-repo-profile</id>
<repositories>
<repository>
<id>my-private-repo</id>
<url>https://your-private-repo-url/repository/</url>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>private-repo-profile</activeProfile>
</activeProfiles>
</settings>
Replace my-private-repo
, your-username
, your-password
, and https://your-private-repo-url/repository/
with your repository ID, credentials, and URL.
To deploy artifacts, use the deploy:deploy-file
goal to specify the repository URL and credentials directly in the command line or in a profile.
Here’s an example of how to deploy an artifact using the deploy:deploy-file
goal:
mvn deploy:deploy-file -DgroupId=com.example -DartifactId=my-artifact -Dversion=1.0.0
-Dpackaging=jar -Dfile=path-to-your-artifact.jar
-DrepositoryId=my-private-repo
-Durl=https://your-private-repo-url/repository/maven-releases/
To use the private repository in other projects, ensure that the settings.xml
file on the machines where these projects are built includes the profile with the repository configuration.
Use the dotnet nuget add source
command to add your private NuGet source. Replace source-name
, https://your-private-repo-url/nuget/v3/index.json
, your-username
, and your-password
with your repository name, URL, and credentials.
dotnet nuget add source --name source-name
--username your-username
--password your-password
--store-password-in-clear-text https://your-private-repo-url/nuget/v3/index.json
The following are lengthy steps on the IBM Cloud site to configure and manage a new registry application. If you prefer not to follow detailed instructions, you can use the cloud-setup.sh and manage-users.sh that will do all the work for you.
- Create or select an existing IBM Cloud Object Storage instance (referred to later as
CLOUD_OBJECT_STORAGE
).
- Create a new bucket in "Cloud Object Storage"/"Instances"/
CLOUD_OBJECT_STORAGE
(referred to later asAPP_BUCKET
).
- Create a new Service ID (referred to later as
APP_USER
) that will be used to access Cloud Object Storage and IAM Identity service to validate users. Take note of theID
ofAPP_USER
by clicking "Details".
- Click API Keys of the
APP_USER
Service ID, and create an Access Key. Note its name and access key.
- Assign write access for
APP_USER
toCLOUD_OBJECT_STORAGE
.
-
Click "Assign Access" in the Access tab of the Service ID
APP_USER
-
Follow the "Assign Access" wizard and select the
CLOUD_OBJECT_STORAGE
service
- Assign IAM Identity keys inspection to the
API_USER
.
-
Click "Assign Access" in the Access tab of the Service ID
APP_USER
-
Follow the "Assign Access" wizard and select the
IAM Identity Service
service, All Resources, and "Operator" role or a custom role containing the actioniam-identity.apikey.get
. Verify, Add, and then assign the access.
- Create another Service ID (referred to later as
USERS_CONTAINER
) that will be used to create access keys with grants to access the application.
- Create a Code Engine project (referred to later as
MY_REGISTRY
). During project creation, make sure you select the correct project location and a resource group. In general, it should be the same as forCLOUD_OBJECT_STORAGE
.
- Go to the "Project Settings"/"Integrations"
- to configure service bindings and connect it to a resource group and then to configure "Container Registry" - this is the place where application images are stored
- Inside the
MY_REGISTRY
project, create a new "service binding" to Cloud Object Storage using the Access Key forAPP_USER
.
-
Make sure the service binding prefix is an empty value. During service binding, select
APP_USER
as the service credential, and verify that the role isWriter
.
- Create an application within the project
- Select "Applications" and click "Create"
- Configure the image to build from source, and click "Specify Build Details"
- where you put repository details
- select "Cloud Native Buildpack" build strategy
- Select a registry server (e.g., private.icr.io), select or create a registry secret (e.g., "Code Engine managed secret"), select namespace and define image name
- In the Resources & Scaling section, set "Scale-down delay" to a non-zero value (e.g., 120 seconds).
In the environment variable section, add the following variables:
APP_BUCKET
- with the bucket name.APP_USER_SERVICE_ID
- with theUSERS_CONTAINER
.
- Build and deploy the application image.
-
In "Image Builds" of the application, you can see existing build runs
-
then into configuration and click "Redeploy"
After this step, the application is up and running, so you can open the application URL.
- The final administrative step is to manage users.
-
into API Keys of the Service ID
USERS_CONTAINER
-
The API key secret should be given to the users.
- Use the Description to configure access rights. It should contain JSON in the format:
{
"role": "reader or writer or owner",
"include": ["glob"],
"exclude": ["glob"]
}
- If "role" is not specified, then "reader" is assumed.
- If "include" is not specified, then access is permitted to the whole tree; otherwise, only to a subtree matched to some include glob.
- If "exclude" is not specified, then access is not additionally restricted; otherwise, it's restricted to subtrees matched to any exclude glob.
- Other properties are permitted, e.g.,
"accesskey": "secret"
to memorize the API Key secret.
Repeat the last step for all users.
That's all!