Lab: Deploying Your AI Supply Chain
Theory is over. Now It’s is time to build.
In this lab, you will take on the role of a lead platform engineer. Your data science team has been downloading models randomly from Hugging Face. Your task is to establish order by deploying a Private Model Registry and forcing all future deployments to go through this governed gate.
|
Prerequisites
|
git clone https://github.com/RedHatQuickCourses/rhoai3-registry.git
cd rhoai3-registry/
Step 1: Dependent Infrastructure
The Model Registry is stateless. Before you can turn it on, you need two things: a Brain (database) and a Vault (object storage).
We have provided a script that deploys a MySQL 8.0 instance and a MinIO object store into a new namespace called rhoai-model-registry-lab.
-
Run the Setup Script:
chmod u+x ./deploy/setup.sh./deploy/setup.sh -
Manual DB Connection
The MySQL Database is running, but the Registry does not have the password yet. Please execute the following command manually to create the DB secret:
oc create secret generic registry-db-secret \
-n rhoai-model-registries \
--from-literal=database-host='mysql.rhoai-model-registry-lab.svc.cluster.local' \
--from-literal=database-port='3306' \
--from-literal=database-name='sampledb' \
--from-literal=database-user='admin' \
--from-literal=database-password='mysql-admin'
-
Verify the Pods: Ensure the database and storage are running before proceeding.
oc get pods -n rhoai-model-registry-labExpected Output:
NAME READY STATUS RESTARTS AGE mysql-5d8f7-xyz 1/1 Running 0 45s minio-7b9c2-abc 1/1 Running 0 45s s3-ui-6d87f-rst. 1/1 Running 0 20s
Step 2: Link the Model Registry to the Database
Edit the name field to change the name of the Model Registry
cat <<EOF | oc apply -f -
apiVersion: modelregistry.opendatahub.io/v1beta1
kind: ModelRegistry
metadata:
name: model-registry-lab
namespace: rhoai-model-registries
spec:
grpc:
port: 9090
rest:
port: 8080
mysql:
# NETWORK BRIDGE: We use the full DNS name to reach the lab namespace
host: "mysql.rhoai-model-registry-lab.svc.cluster.local"
port: 3306
database: "sampledb"
username: "admin"
passwordSecret:
name: "registry-db-secret"
key: "database-password"
sslMode: "disable"
# (Optional) If using Postgres instead of MySQL, use the 'postgres' block instead.
EOF
You can check the OpenShift AI UI or run the following command to verify that the model registry is working as designed.
oc get modelregistries.modelregistry.opendatahub.io -n rhoai-model-registries
Step 3: Register an LLM
Now that the Model Registry is running, it is empty.
Next, run an automation pipeline that mimics a secure supply chain:
-
Downloads the
Qwen3-0.6Bmodel from Hugging Face (or uses a cached local copy). -
Uploads the weights to your private MinIO "Vault" (ensuring sovereignty).
-
Registers the metadata (Version 1.0.0, Author: You) into the MySQL "Brain."
-
Execute the Pipeline:
chmod u+x ./deploy/run_pipeline.sh ./deploy/run_pipeline.sh -
Observe the Output: Watch the logs. You should see the "handshake" happen:
> Connecting to Hugging Face... Done. > Downloading 'Qwen3-0.6B'... Done. > Uploading to Private MinIO Bucket (s3://private-models)... Success. > Registering with Model Registry API... > SUCCESS: Model Registered with ID: 12345
-