MODEL MANAGER MIGRATION GUIDE

Context: Services hosted on lab.mybraincube.com and labregistry.mybraincube.com are being deprecated. This guide explains how to migrate your Python code and Docker images to a new repository.


1. Migrating Python Code to a New Git Repository

Step 1: Retrieve the Code from the BrainCube Repository

Choose the option that applies to you:

Option A: You don't have the code locally

git clone lab.mybraincube.com/<repo>

Option B: You already have the code but want the latest version

git pull --rebase lab.mybraincube.com/<repo>

Step 2: Remove the Old Git Remote

git remote rm origin

Step 3: Set the New Git Remote

git remote add origin git@<domain>:<repo>

Example:

git remote add origin git@github.com:mycompany/my-model.git

Step 4: Push the Code to the New Remote

git push origin master

or if the main branch is named main:

git push origin main

2. Publishing the Docker Image to a New Registry

Step 1: Build the Docker Image

If you have a Dockerfile

Navigate to the folder containing your Dockerfile and run:

docker build -t <new-registry>/my-model:latest .

Example:

docker build -t registry.mycompany.com/braincube/my-model:latest .

If you don't have a Dockerfile

Create a file named Dockerfile at the root of your project with the following content:

FROM python:3.11-bullseye

# Environment variables
ENV PORT=3000
ENV MODEL_MANAGER_PORT=3000

# Set working directory
WORKDIR /app

# Copy project files
COPY . /app

# Verify Python version
RUN python3 --version

# Install dependencies
RUN python3 setup.py install

# Expose port
EXPOSE $MODEL_MANAGER_PORT

# Application entrypoint
ENTRYPOINT ["python3", "main.py"]

Then build the image:

docker build -t <new-registry>/my-model:latest .

Step 2: Publish the Image to the New Registry

docker push registry.mycompany.com/braincube/my-model --all-tags

Note for Docker Hub: If you are using Docker Hub, the registry URL is docker.io/

3. Updating the Model-Runner Node Configuration

Step 1: Update the IoT Model-Runner Node Credentials

  1. Go to the IoT model-runner node configuration
  2. Update the registry url parameter in the credentials to point to the new registry

Examples:

  • Private registry: registry.mycompany.com
  • Docker Hub: docker.io/
  • AWS ECR: <account-id>.dkr.ecr.<region>.amazonaws.com

Step 2: Update or Remove Credentials

  • If the new registry uses the same credentials: update them
  • If the new registry requires no authentication: clear the existing credentials

Step 3: Redeploy the Flow

  1. Redeploy your flow
  2. The new Docker image will be downloaded automatically
  3. Monitor the progress in the model-runner node status

Quick Summary

Step Command
Clone the code git clone lab.mybraincube.com/<repo>
Remove old remote git remote rm origin
Add new remote git remote add origin git@<domain>:<repo>
Push the code git push origin master
Build Docker image docker build -t <registry>/my-model:latest .
Publish the image docker push <registry>/my-model --all-tags
Update the node Edit registry url in the credentials
Redeploy Redeploy the flow and check the status

⚠️ Important Notes

  • Verify that you have access to the new registry before starting

  • Test the Docker image locally before publishing it:

    docker run -p 3000:3000 <registry>/my-model:latest
    
  • Make sure the Dockerfile is up to date with the correct dependencies

  • Document the new location of your images and repositories for your team

Was this article helpful?

Powered by Zendesk