Skip to content

Commit 4d3f414

Browse files
committed
dev broker: official 4.x + baked GHCR image; retire jessmillar build infra
- rabbit/Dockerfile bakes enabled_plugins + dev_rabbitmq.conf + dev_definitions.json onto official multi-arch rabbitmq:4.1-management (one image for arm64 + amd64). - for_docker/{arm,x86}.yml pull ghcr.io/thegridelectric/dev-rabbit:latest (no mounts; definitions baked in). dev_rabbitmq.conf uses the 4.x definitions.import_backend/definitions.local.path keys and drops the default_* identity lines (identities come from the baked definitions). - .github/workflows/broker-image.yml + rabbit/build-and-push.sh build and push the image (CI gated by gen_definitions.py --check; both tag :latest and chaos__<short-sha>__<date>). - Delete the superseded dev build infra: DevRabbit{Arm,X86}Dockerfile, build-dev-broker-{arm,x86}.sh, stale rabbit_definitions_dev.json. Prod track (broker_arm.yml, prod rabbitmq.conf, hybrid/analytics defs) left untouched — prod upgrade is deferred.
1 parent 232b063 commit 4d3f414

11 files changed

Lines changed: 127 additions & 608 deletions

.github/workflows/broker-image.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Broker image
2+
3+
# Build + push the baked dev-broker image to GHCR so every repo's dev-broker
4+
# compose can pull one multi-arch image with definitions baked in. Triggered
5+
# only when the baked inputs change (definitions are rare-change), so the
6+
# round-trip is infrequent.
7+
8+
on:
9+
push:
10+
branches: [main, dev]
11+
paths:
12+
- "rabbit/rabbitconfig/dev_definitions.json"
13+
- "for_docker/dev_rabbitmq.conf"
14+
- "for_docker/enabled_plugins"
15+
- "rabbit/Dockerfile"
16+
- ".github/workflows/broker-image.yml"
17+
workflow_dispatch:
18+
19+
jobs:
20+
build-and-push:
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
packages: write
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
# Guard: the baked definitions must match gwbase.topology before we
29+
# ship them in an image.
30+
- uses: astral-sh/setup-uv@v6
31+
with:
32+
python-version: "3.12"
33+
enable-cache: true
34+
- run: uv sync --all-groups --locked
35+
- run: uv run python for_docker/gen_definitions.py --check --dir rabbit/rabbitconfig
36+
37+
# Keep the git-hash + date in the image tag (chaos__<short-sha>__<date>)
38+
# — traceable back to the exact commit that baked the definitions.
39+
- name: Compute image tag
40+
id: tag
41+
run: echo "tag=chaos__$(git rev-parse --short HEAD)__$(date +%Y%m%d)" >> "$GITHUB_OUTPUT"
42+
43+
- uses: docker/setup-qemu-action@v3
44+
- uses: docker/setup-buildx-action@v3
45+
- uses: docker/login-action@v3
46+
with:
47+
registry: ghcr.io
48+
username: ${{ github.actor }}
49+
password: ${{ secrets.GITHUB_TOKEN }}
50+
- uses: docker/build-push-action@v6
51+
with:
52+
context: .
53+
file: rabbit/Dockerfile
54+
platforms: linux/amd64,linux/arm64
55+
push: true
56+
tags: |
57+
ghcr.io/thegridelectric/dev-rabbit:latest
58+
ghcr.io/thegridelectric/dev-rabbit:${{ steps.tag.outputs.tag }}

for_docker/arm.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,15 @@ services:
77
- "dev"
88
hostname: rabbit
99
container_name: gw-dev-rabbit
10-
image: "jessmillar/dev-rabbit-arm:chaos__fee74a3__20250120"
10+
# The baked dev-broker image (definitions + conf + plugins inside it),
11+
# built from rabbit/Dockerfile and pushed to GHCR by CI. Multi-arch
12+
# (arm64 + amd64), so arm.sh and x86.sh pull the SAME image — and so does
13+
# every other repo's dev-broker compose. Refresh with `docker compose pull`.
14+
image: "ghcr.io/thegridelectric/dev-rabbit:latest"
1115
ports:
1216
- 1885:1885
1317
- 4369:4369
1418
- 5672:5672
1519
- 15672:15672
1620
- 15674:15674
1721
- 25672:25672
18-
env_file: ./for_docker/dev_vhost.env
19-
environment:
20-
- RABBITMQ_USERNAME=smqPublic
21-
- RABBITMQ_PASSWORD=smqPublic
22-
- RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS=-rabbitmq_management load_definitions "/tmp/rabbit_definitions.json"
23-
volumes:
24-
25-
- ./for_docker/dev_rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro
26-
- ./for_docker/enabled_plugins:/etc/rabbitmq/enabled_plugins

for_docker/dev_rabbitmq.conf

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
listeners.tcp.default = 5672
33

44
loopback_users = none
5-
## On first start RabbitMQ will create a vhost and a user. These
6-
## config items control what gets created
7-
default_vhost = d1__1
8-
default_user = smqPublic
9-
default_pass = smqPublic
10-
default_permissions.configure = .*
11-
default_permissions.read = .*
12-
default_permissions.write = .*
5+
6+
## Identity + topology come from the generated definitions file (vhost,
7+
## smqPublic user, permissions, exchanges, bindings) — NOT from default_*
8+
## lines, which would race the definitions import. The file is generated
9+
## from gwbase.topology (see wiki executor spec §3.6).
10+
definitions.import_backend = local_filesystem
11+
definitions.local.path = /etc/rabbitmq/definitions.json
1312

1413
## Clustering
1514
cluster_partition_handling = ignore

for_docker/x86.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: "3.5"
2-
31
networks:
42
dev:
53

@@ -9,19 +7,13 @@ services:
97
- "dev"
108
hostname: rabbit
119
container_name: gw-dev-rabbit
12-
image: "jessmillar/dev-rabbit-x86:chaos__e58daf6__20230115"
10+
# Same baked multi-arch image as arm.yml — no separate x86 image. Built
11+
# from rabbit/Dockerfile, pushed to GHCR by CI. Refresh: docker compose pull.
12+
image: "ghcr.io/thegridelectric/dev-rabbit:latest"
1313
ports:
1414
- 1885:1885
1515
- 4369:4369
1616
- 5672:5672
1717
- 15672:15672
1818
- 15674:15674
1919
- 25672:25672
20-
env_file: ./for_docker/dev_vhost.env
21-
environment:
22-
- RABBITMQ_USERNAME=smqPublic
23-
- RABBITMQ_PASSWORD=smqPublic
24-
- RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS=-rabbitmq_management load_definitions "/tmp/rabbit_definitions.json"
25-
volumes:
26-
- ./for_docker/dev_rabbitmq.conf:/opt/bitnami/rabbitmq/etc/rabbitmq/rabbitmq.conf:ro
27-
- ./for_docker/enabled_plugins:/etc/rabbitmq/enabled_plugins

rabbit/DevRabbitArmDockerfile

Lines changed: 0 additions & 8 deletions
This file was deleted.

rabbit/DevRabbitX86Dockerfile

Lines changed: 0 additions & 8 deletions
This file was deleted.

rabbit/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Self-contained dev broker image for distribution via GHCR, so other repos
2+
# (gridworks-marketmaker, gridworks-scada, ...) can run a dev broker with NO
3+
# gridworks-base checkout. Built + pushed by .github/workflows/broker-image.yml
4+
# from the guard-checked definitions, so the image can't lag the repo.
5+
#
6+
# Build context is the REPO ROOT:
7+
# docker build -f rabbit/Dockerfile -t ghcr.io/thegridelectric/dev-rabbit .
8+
#
9+
# Official multi-arch RabbitMQ (arm64 + amd64). Dev runs 4.x; the generated
10+
# definitions are version-agnostic.
11+
FROM rabbitmq:4.1-management
12+
13+
COPY for_docker/enabled_plugins /etc/rabbitmq/enabled_plugins
14+
COPY for_docker/dev_rabbitmq.conf /etc/rabbitmq/rabbitmq.conf
15+
COPY rabbit/rabbitconfig/dev_definitions.json /etc/rabbitmq/definitions.json

rabbit/build-and-push.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
#
4+
# Build + push the multi-arch dev-broker image to GHCR, tagged with the git
5+
# commit for traceability — same convention CI uses
6+
# (.github/workflows/broker-image.yml). Replaces the old per-arch
7+
# build-dev-broker-{arm,x86}.sh: official rabbitmq is multi-arch, so one
8+
# buildx run produces one image for arm64 + amd64.
9+
#
10+
# Prereq: docker login ghcr.io (PAT with write:packages). Run from anywhere
11+
# in the repo. For a quick local-only test (no push), use instead:
12+
# docker build -f rabbit/Dockerfile -t dev-rabbit-local .
13+
14+
REPO_ROOT=$(git rev-parse --show-toplevel)
15+
cd "$REPO_ROOT"
16+
17+
IMAGE="ghcr.io/thegridelectric/dev-rabbit"
18+
GIT_COMMIT=$(git rev-parse --short HEAD)
19+
DATE=$(date +'%Y%m%d')
20+
21+
if [[ -n "$(git status --untracked-files=no --porcelain)" ]]; then
22+
# uncommitted changes in tracked files — don't pin a misleading commit tag
23+
TAG="chaos__dev"
24+
DOCKER_ID="${IMAGE}__${GIT_COMMIT}-DIRTY__${DATE}"
25+
else
26+
TAG="chaos__${GIT_COMMIT}__${DATE}"
27+
DOCKER_ID="${IMAGE}__${GIT_COMMIT}__${DATE}"
28+
fi
29+
30+
echo "Building ${IMAGE}:${TAG} (+ :latest), gridworks_docker_id=${DOCKER_ID}"
31+
32+
docker buildx build \
33+
--platform linux/amd64,linux/arm64 \
34+
-f rabbit/Dockerfile \
35+
-t "${IMAGE}:${TAG}" \
36+
-t "${IMAGE}:latest" \
37+
--label "gridworks_docker_id=${DOCKER_ID}" \
38+
--push \
39+
.

rabbit/build-dev-broker-arm.sh

Lines changed: 0 additions & 29 deletions
This file was deleted.

rabbit/build-dev-broker-x86.sh

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)