Link Search Menu Expand Document
Start for Free

Azure Container Registry with Launchpad

This chapter discusses preparing Azure Container Registry (ACR) for use with Kubernetes.

Page Contents
  1. Overview
  2. Prerequisites
  3. Setup
    1. Setting up the environment
    2. Creating an ACR
  4. Pushing images to the ACR
    1. Pushing the Stardog image to the ACR
    2. Pushing the Launchpad image to the ACR
  5. Cleaning up

Overview

You can use Azure Container Registry (ACR) to store the images necessary for running when using Stardog Launchpad with Kubernetes.

Our goal in this tutorial is to do the following:

  1. Show the commands needed to prepare Azure Container Registry for use with Stardog Launchpad.

  2. Show the commands help to show when automating in a CI/CD pipeline.

This page only covers how to set up Azure Container Registry via the CLI.

Prerequisites

Commands:

Setup

Setting up the environment

Log in to Azure using the instructions found here.

Set the following environment variables:

# These values are just examples
export ACR_RESOURCE_GROUP=dev-stardog-acr-rg
export ACR_NAME=devsdacr
export LOCATION=eastus
export REGISTRY_NAME=$ACR_NAME # this is for later when you deploy Stardog 

# required to import Launchpad image from Stardog JFrog repo. 
export JFROG_USER=<user id>
export JFROG_PWD=<your password> 

Creating an ACR

To create an ACR, run the following command:

az acr create \
	--resource-group $ACR_RESOURCE_GROUP \
	--name $ACR_NAME \
	--location $LOCATION \
	--sku Basic --admin-enabled true

Your ACR name must be globally unique. You can check if your ACR already exists with the following command:

az acr list | jq -r --arg name $ACR_NAME '.[] | select(.name == $name)'

This command does the following:

  • az acr list: Gets a list of all the container registries for the logged-in account.
  • jq -r: Processes the output as raw strings. --arg name $ACR_NAME sets a variable inside jq’s environment. '.[] iterates over the entire list of registries returned by az acr list.
  • select (...): Uses a filter to match the registry whose name we stored in .name (which is set to the value of $ACR_NAME).

Pushing images to the ACR

Pushing the Stardog image to the ACR

The following command will push the current version of Stardog to your ACR:

az acr import --name $ACR_NAME --source stardog-stardog-apps.jfrog.io/stardog-binaries/complexible/stardog/stardog:latest  --image stardog/dev-server:1.0 --username $JFROG_USER  --password $JFROG_PWD

If you need to edit your Dockerfile, contact your CSM to get the base Stardog Dockerfile and adjust as needed. From there, you can build the image and push it to your ACR like so:

az acr build --image stardog/dev-server:1.0 --registry $ACR_NAME --file StardogDockerfile .

You can check if an image already exists with the following command:

az acr repository list --name $ACR_NAME --output json | jq -r --arg image stardog/dev-server 'any(.[]; . == $image)'

This command does the following:

  • az acr repository list --name $ACR_NAME --output json: Lists, as JSON, all the repositories in our registry.
  • jq -r --arg image stardog/dev-server 'any(.[]; . == $image)': Checks to see if any of the repositories are named “stardog/dev-server”, which is what we named our Stardog image in the previous step.

Pushing the Launchpad image to the ACR

The following command will push the current version of Launchpad to your ACR:

az acr import --name $ACR_NAME --source stardog-stardog-apps.jfrog.io/stardog-apps/launchpad:current  --image stardog/dev-launchpad:1.0 --username $JFROG_USER  --password $JFROG_PWD

Cleaning up

You can now delete your Azure resource group via the following command:

az group delete --resource-group $ACR_RESOURCE_GROUP -y