GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [ACI] 1. ACI template and deploy script · Issue #138 · fixpoint/ke2-docker

[ACI] 1. ACI template and deploy script #138

New issue
Copy link
New issue
Copy link
Open
Open
[ACI] 1. ACI template and deploy script#138
Copy link
Labels
ACIAzure Container Instances (azureci) production release work
Milestone
ACI production release

Description

@fixpoint-hasan
fixpoint-hasan
opened on Sep 25, 2026
Issue body actions

Goal

The script deploy.sh and one Bicep template deploy KE on ACI in both network modes in three steps (infra, certs, and app), with secure secrets, a check of the network before the deployment, and an in-place update of the group.

Description

Today the customer creates the resources by hand with the az commands of a README of about 500 lines: the resource group, the storage account, five file shares, the Log Analytics workspace, the config file uploads, and the certificate uploads. A wrong share name in the README already led to a mistake. Then the customer deploys an ARM template with a container group API of 2019-12-01 and a network profile for the virtual network, which Microsoft retired from the API 2021-07-01. Its secrets are plain parameters and plain environment values, its config files come from two shares that the customer fills by hand, its RabbitMQ and nginx images are older than those of ke2-docker, and it has no probe.

This issue replaces these steps with the script and a new Bicep template. The infra step creates the resources, certs uploads the certificates, and app deploys the container group. The template is also the place where the availability target of section 3 is built: ACI restarts a failed container in place. The database is outside the script, and the guide explains it (C3).

Not in this issue: the tuning of the sizes (C2), the guide and the procedures of backup and upgrade (C3), and the tests (C4).

Implementation design

The first diagram shows the three steps and what each one does. The second diagram shows the container group with its volumes and the address.

flowchart LR
    A["deploy.sh infra"] --> B["Resource group, storage account with 3 shares, Log Analytics (optional), subnet check (private mode)"]
    B --> C["deploy.sh certs: certificates to the ssl-cert share"]
    C --> D["deploy.sh app: checks, then the container group (Bicep)"]
    D --> E["Six containers, secure values, secret volumes, Azure Files, the address"]
Loading
flowchart LR
    U["Users"] --> IP["Public IP with DNS label, or private IP"]
    IP --> NG["nginx: 80 and 443"]
    NG --> KO["kompira: 8000"]
    X["External job manager"] --> RQ["rabbitmq: 5671"]
    KO --> RQ
    KE["kengine"] --> RQ
    JM["jobmngrd"] --> RQ
    KO --> RD["redis"]
    KO --> DB["Database: outside the template"]
    KE --> DB
    subgraph Volumes["Volumes"]
        V1["Azure Files: kompira-var, kompira-log, ssl-cert"]
        V2["Secret volumes: nginx and RabbitMQ config files from configs/"]
    end
    KO -.-> V1
    NG -.-> V1
    NG -.-> V2
    RQ -.-> V2
Loading

Script and parameters:

  • Add ke2/cloud/azureci/deploy.sh with the steps infra, certs, and app. All steps check that az is installed and that the customer is logged in.
  • Add a Bicep template for the infra step. Its parameters are: NetworkMode (private or public), the resource group and the location, the storage account name, the storage tier and redundancy (no default, the customer chooses), EnableLogAnalytics (default true) with the retention in days (default 30), and for private the names of the virtual network and the subnet.
    • Note: The infra step and the app step have different lifetimes, so they are two deployments.
  • Add two sample parameter files, one for each network mode.

Resources:

  • Create the resource group if it does not exist.
  • Create the storage account with the minimum TLS version 1.2 and public access to blobs off. Shared key access stays on.
    • Note: Azure Files in ACI accepts only the storage account key (managed identity is not supported for the mount).
  • Create three shares: kompira-var, kompira-log, and ssl-cert, with the soft delete of the shares set to 7 days.
    • Note: The README creates five shares. The two shares for the config files of nginx and RabbitMQ are not needed, because the config files become secret volumes (see the template part below).
  • When EnableLogAnalytics is true, create the Log Analytics workspace with the given retention, and write its ID to the outputs of the step.

Network check (private mode):

  • Before the deployment, run az network vnet subnet show and check that the subnet is delegated to Microsoft.ContainerInstance/containerGroups, that it has a NAT gateway, that it is at least a /24 subnet, and that it has no other resources. Stop with a message that names the failed check and the fix.
    • Note: ACI needs a delegated subnet that has no other resources. A group in a virtual network needs a NAT gateway for outbound traffic, because this is the only supported way, and the images need it. A subnet smaller than /24 is known to give "subnet full" errors. The template never creates or changes a subnet or a NAT gateway (section 3).

Certificates:

  • ./deploy.sh certs [folder] uploads server.crt, server.key, and local-ca.crt from the folder to the ssl-cert share, with a key that the script reads itself. Without a folder, it creates a self-signed certificate with scripts/create-cert.sh (this needs Docker) and uploads it.
    • Note: nginx and RabbitMQ need these files at start. The customer runs certs again to replace a certificate, and then the reload steps of the guide.
  • The app step checks that the three files exist in the share, and stops if not.

Template:

  • Add main.bicep for the container group with a current API version, and a template version as a metadata value (section 3). Add two sample parameter files.
  • Six containers: kompira (uwsgi), kengine (kompirad), jobmngrd, redis, rabbitmq, and nginx. The CPU and the memory are parameters. The defaults are the present values until C2 changes them: 1 vCPU and 2 GB for kompira, 1 and 6 for kengine, and 0.5 and 2 for each of the other four.
  • Images: the names and tags are parameters. The defaults are the values of ke2-docker at the release: kompira.azurecr.io/kompira-enterprise with imageTag, rabbitmq:3.13-alpine, nginx:1.27-alpine, and redis:7.2-alpine.
  • Volumes: the shares kompira-var (kompira, kengine, jobmngrd, and nginx), kompira-log (the three Kompira containers), and ssl-cert (read-only in nginx, and in RabbitMQ).
    • Note: ke2-docker mounts the certificate folder with :ro in nginx.
  • Config files as secret volumes, read from the root configs/ folder with loadFileAsBase64: nginx.conf as default.conf.template in /etc/nginx/templates, and rabbitmq-auth.conf and rabbitmq-ssl.conf as 20-auth.conf and 30-ssl.conf in /etc/rabbitmq/conf.d.
    • Note: A secret volume is read-only and in memory. A config change is a new deployment of the group. The old template read these files from two shares.
  • Set NGINX_ENVSUBST_FILTER=^KOMPIRA on nginx, and pass KOMPIRA_HOST, KOMPIRA_PORT, and the two uwsgi timeouts (300 seconds by default).
    • Note: The compose file of ke2-docker sets the filter. The old ACI template does not, and this is to check.

Secrets and credentials:

  • The database password, the AMQP password, the storage account key, and the Log Analytics key are securestring parameters, and their environment variables use secureValue. DATABASE_URL is built from the database host, user, name, and the password, and it is a secure value. There is no databaseUrl parameter.
  • Make the RabbitMQ user and password configurable with AMQP_USER and AMQP_PASSWORD, the same names as in ke2-docker. Use them for RABBITMQ_DEFAULT_USER and RABBITMQ_DEFAULT_PASS and for the AMQP_URL of kompira, kengine, and jobmngrd.
    • Note: The two variables of the RabbitMQ image apply only at the first start on an empty data folder. The guide explains how to change the credentials later (C3). The values use only letters, digits, and -_.~, because the URLs are built without encoding, like the compose files of ke2-docker.

Network:

  • NetworkMode public: a public IP address with a required DNS name label, and the ports 80, 443, and 5671. NetworkMode private: the subnet in subnetIds, a private IP address, and the same ports. No network profile.
  • Print the address (the name in public mode, and the private IP address in private mode) at the end of the step.

Availability and update:

  • restartPolicy: Always, and a liveness probe for kompira (an exec probe that checks port 8000) and for nginx (an exec probe that checks port 443).
    • Note: ke2-docker has no health checks and relies on restart: always, so the other containers get no probe. ACI restarts a container that fails its probe in place, and the IP address stays. The kind of probe and the presence of the nc tool in both images are to confirm.
  • Keep HOSTNAME_SHORT fixed for each container, as now, so the audit files keep their names (audit-kompira.log and audit-kengine.log).
  • EnableLogAnalytics: when it is on, set the diagnostics of the group with the workspace ID and the key that deploy.sh reads.
  • ./deploy.sh app reads the values from the environment variables DATABASE_HOST, DATABASE_USER, DATABASE_NAME, DATABASE_PASSWORD, AMQP_USER, AMQP_PASSWORD, and the optional KOMPIRA_IMAGE_TAG. It asks for DATABASE_PASSWORD if it is not set. AMQP_USER and AMQP_PASSWORD default to guest and guest, the same as ke2-docker (Environment.md), and are not prompted; AMQP_PASSWORD still goes in as the securestring parameter, so the default is hidden the same way a customer-supplied value would be. It reads the storage account key and the workspace key itself, checks the certificates and (in private mode) the subnet, deploys the template, and prints the address and the state of the containers.
    • Note: A second deployment with the same group name updates the group in place, and all containers restart together. A change of the CPU or memory, the restart policy, or the zone is refused by ACI. The script prints the instruction to run az container delete and then app again.

Test plan

  • Run ./deploy.sh infra with the sample file for public mode in an empty resource group. Expected: the storage account and the three shares exist, the minimum TLS version is 1.2, public access to blobs is off, and the soft delete of the shares is 7 days.
  • Run it with EnableLogAnalytics on and off. Expected: the workspace exists only when it is on, with the given retention.
  • Run it for private mode with a correct subnet. Expected: it passes the checks.
  • Run it for private mode with a subnet that is not delegated, one without a NAT gateway, one smaller than /24, and one with another resource in it. Expected: each case stops with a clear message before anything is created.
  • Run ./deploy.sh certs with a folder, then without a folder. Expected: the three files are in the share in both cases, and the second case works only when Docker is installed.
  • Run ./deploy.sh app before certs. Expected: it stops with a message about the missing files.
  • Run infra a second time. Expected: no error, and no change.
  • Delete the resource group. Expected: every resource is removed.
  • Run ./deploy.sh app for public mode after infra and certs. Expected: all six containers are Running, the DNS name opens the login page of KE, and the login as root works.
  • Run it for private mode. Expected: the same result, reached from a machine in the virtual network, and no public IP address exists.
  • Run az container show and read the deployment history. Expected: no password and no key is visible. Then run az container exec in kompira and read the environment. Expected: the values are set.
  • Read the config files in the nginx and RabbitMQ containers. Expected: they are equal to the files in configs/.
  • Try to write a file in /etc/nginx/ssl in the nginx container. Expected: the write fails.
  • Use a custom AMQP_USER and AMQP_PASSWORD. Expected: kompira, kengine, and jobmngrd connect, and an AMQPS client with the user connects on port 5671. The built-in guest user cannot connect from outside.
  • Stop the uwsgi process in kompira. Expected: ACI restarts the container, the restart count grows, and the IP address does not change.
  • Change the image tag and run ./deploy.sh app. Expected: all containers restart together, the address is the same, and /.status is OK. Run app again with no change. Expected: the containers restart, and the state is healthy.
  • Change the CPU of kengine and run app. Expected: the script stops with the instruction to delete the group first.
  • Run az deployment group what-if with each sample file. Expected: it works and shows the plan.

ref

  • ke2-docker: ke2/cloud/azureci/README.md, ke2/cloud/azureci/aci-deployment.json, scripts/create-cert.sh, ke2/services/kompira.yml, ke2/services/nginx.yml, ke2/services/rabbitmq.yml, configs/, Environment.md
  • ACI documentation: virtual network scenarios, Azure Files volumes, update a container group, secure values, secret volumes, liveness probes
  • Depends on: none. Blocks: C2 to C5.

Activity

  1. fixpoint-hasan
    added this to the ACI production release milestone on Sep 25, 2026
  2. fixpoint-hasan
    added
    ACIAzure Container Instances (azureci) production release work
    on Sep 25, 2026
  3. fixpoint-hasan
    added a parent issue on Sep 25, 2026
    • [ACI] ACI production release #137
  4. fixpoint-hasan
    changed the title [-][ACI] 1. ACI infrastructure and deploy script[/-] [+][ACI] 1. ACI template and deploy script[/+] on Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ACIAzure Container Instances (azureci) production release work

    Type

    No type

    Projects

    No projects

      Milestone

      • ACI production releaseNo due date

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402792 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.