Add user artefacts to Camunda BPM RUN docker image in a custom container image and deploy it to a container registry.
The directory structure in folder configuration maps to folder in container according to Camunda BPM Run product documentation.
- From Azure Cloud Shell run:
git clone https://github.com/rob2universe/bpmrun-add-to-dockerimg
andcd ./bpmrun-add-to-dockerimg/
- Next create your own container registry and image by running:
./CreateImage.ps1
- To create a container instance subsequently run:
./CreateContainerInstace.ps1
mvn clean install
mvn clean deploy -Ddocker.users=<username> -Ddocker.password=<passwd> -Ddocker.url=<docker-registry-url>
-
Access console via https://shell.azure.com/
(If required confirm to create storage if not used before. This may take a few minutes.)
Select PowerShell -
Clone this repository using:
git clone https://github.com/rob2universe/bpmrun-add-to-dockerimg
-
Change into directory:
cd ./bpmrun-add-to-dockerimg/
-
Simply run the script:
./CreateImage.ps1
and enter the requested parameters when prompted
- set values for location, resource group name and container regsitry name, for example:
$Env:rgName = "rg1"
$Env:location = "southeastasia"
$Env:acrName = "RobsACR"
- If required Create an Azure resource group via the Azure portal or via the shell using:
$resourceGroup = New-AzResourceGroup -Name $Env:rgName -Location $Env:location
(e.g. westus, eastus, brazilsouth, westeurope, northeurope, centralindia, westindia, southeastasia, japanwest, australiasoutheast)) - If required Create an Azure container registry using the Azure portal or via the shell using:
$registry = New-AzContainerRegistry -ResourceGroupName $resourceGroup.ResourceGroupName -EnableAdminUser -Sku Basic -Name $Env:acrId
enabling admin user in production use an individual identity or service principal instead. - Get login credentials for your container registry
$creds = Get-AzContainerRegistryCredential -Registry $registry
- Clone git repository by running:
git clone https://github.com/rob2universe/bpmrun-add-to-dockerimg
- Change into cloned directory:
cd ./bpmrun-add-to-dockerimg/
(modify and add files if needed) - Download dependencies listed in POM (i.e. groovy jars) and create docker image by running:
mvn clean install
(append -DacrName=<registry name> if you did not previously set the enviornment variable $Env:acrName)
This will build your docker image and push it to your Azure container registy. Subsequently the image will be available under: <registry name>.azurecr.io/bpmrun-add-to-dockerimg:1.0
Once the image has been published to your Azure cointainer registry you can use it to create Azure container instances, e.g. by running the included script:
./CreateContainerInstace.ps1
or as described here for Azure cloud shell or here for Azure portal.
Example:
$creds = Get-AzContainerRegistryCredential -ResourceGroup <resource group name> -Name <registry name>
$acrcred = New-Object System.Management.Automation.PSCredential ($creds.Username, (ConvertTo-SecureString $creds.Password -AsPlainText -Force))
New-AzContainerGroup -ResourceGroupName <resource group name> -Name <container name> -Image <registry name>.azurecr.io/bpmrun-add-to-dockerimg:1.0 -DnsNameLabel <pick a unique name> -RegistryCredential $acrcred -OsType Linux -IpAddressType Public -Port @(8080) -Cpu 1 -MemoryInGB 0.5 -EnvironmentVariable @{"SPRING_APPLICATION_JSON"='{"camunda.bpm.run.auth.enabled":"true"}'}
This project contains an example process model which, if successfully included in your custom container image, will be automatically deployed during startup. This process makes use of the newly included Groovy jars. Start a process via Camunda modeler or tasklist. If the process instances starts / completes without error then the Groovy script output will be visible in the container instances console log.
To follow the container's console output in Azure cloud shell you can use
az container attach --resource-group <resource group name> --name <container instance name>
Remove-AzResourceGroup -Name <resource group name>
Camunda BPM Run product documentation
Quickstart: Create a private container registry using Azure PowerShell
Quickstart: Create an Azure container registry using the Azure portal
Quickstart: Build and run a container image using Azure Container Registry Tasks
Quickstart: Deploy a container instance in Azure using Azure PowerShell