How to Build from Source#

Build the Model Registry from source to customize, debug, or extend its functionality. In this guide, you will:

  • Set up your development environment.

  • Compile the source code and resolve dependencies.

  • Generate a runnable build for local testing or deployment.

This guide is ideal for developers who want to work directly with the source code.

Prerequisites#

Before you begin, ensure the following:

This guide assumes basic familiarity with Git commands, Python virtual environments, and terminal usage. If you are new to these concepts, see:

Steps to Build#

  1. Clone the Repository:

    # Clone the latest on mainline
    git clone https://github.com/open-edge-platform/edge-ai-libraries.git edge-ai-libraries
    # Alternatively, Clone a specific release branch
    git clone https://github.com/open-edge-platform/edge-ai-libraries.git edge-ai-libraries -b <release-tag>
    
    cd edge-ai-libraries/microservices/model-registry
    
  2. Install Python 3.10

    sudo apt-get install python3.10
    
  3. Rename the .env.template file to .env

    cd docker
    
    mv .env.template .env
    
  4. Create the directories to be used as persistent storage for the PostgreSQL and MinIO containers

    cd ../scripts
    
    sudo ./init_mr_data_dirs.sh
    
  5. Define the desired values for the REQUIRED environment variables in the .env file in the docker directory:

    1. MR_MINIO_ACCESS_KEY

    2. MR_MINIO_SECRET_KEY

    3. MR_PSQL_PASSWORD

    cd ../docker
    
    vi .env
    
    • For more information about the supported the environment variables, refer to the Environment Variables documentation.

  6. Optional: Enter values for the http_proxy and https_proxy variables in the .env file if you are behind a proxy.

    http_proxy= # example: http_proxy=http://proxy.example.com:891
    https_proxy= # example: https_proxy=http://proxy.example.com:891
    
  7. Load the environment variables defined in the .env file into the current Terminal session

    source .env
    
  8. Build the model registry and start the containers

    docker compose build
    
    docker compose up -d
    

Validation#

  1. Verify Build Success:

    • Check the logs. Look for confirmation messages indicating the microservice started successfully.

  2. Access the Microservice:

    • Open a browser and go to:

      http://localhost:{{port}}/docs
      
    • Expected result: The microservice’s API documentation page loads successfully.

    For more example requests and their responses, refer to the Get Started Guide.

Troubleshooting#

  1. Dependency Installation Errors:

    • Reinstall dependencies:

      pip install -r requirements.txt
      
  2. Environment Configuration Issues:

    • Verify environment variables:

      echo $VARIABLE_NAME
      

Supporting Resources#