Skip to content

Commit 422c998

Browse files
authored
chore(docker): supply docker compose via Bazel (#830)
## Why? Host-installed Compose versions can reject flags such as `up --wait`, breaking local stacks and Docker tests. ## What? - Use `rules_docker_compose` 0.4.0 and its default Compose 5.5.1 directly from Bazel and test runfiles. Upgrade both through `MODULE.bazel`. - Upgrade rules_go to 0.59.0 and Gazelle to 0.53.0; keep Go 1.25.0. - Make service Dockerfiles work without Buildx. Docker CLI and a reachable daemon remain required. ## Test Plan Build, 134 unit targets, 13 Docker integration/e2e targets, documentation, lint, Gazelle, tidy, and mock checks passed. Verified startup, a demo request reaching landed, and shutdown without Buildx or a host Compose plugin. Unit checks used isolated Git configuration and pinned helpers. Live GitHub cases skipped without credentials. The shared verifier could not complete coverage/lint checks; repository checks passed. To try locally: ```bash ./tool/bazel run @rules_docker_compose//docker_compose -- version make local-submitqueue-start make demo-requests COUNT=1 WATCH=true BURST=true make local-submitqueue-stop ``` ## Revert Plan Revert this PR to restore host-selected Compose and previous build-rule versions.
1 parent d0d5f8b commit 422c998

14 files changed

Lines changed: 118 additions & 42 deletions

File tree

‎MODULE.bazel‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# which is pulled in transitively by rules_go/rules_proto.
33
bazel_dep(name = "toolchains_protoc", version = "0.6.1")
44
bazel_dep(name = "git", version = "2.55.0")
5-
bazel_dep(name = "rules_go", version = "0.57.0")
6-
bazel_dep(name = "gazelle", version = "0.45.0")
5+
bazel_dep(name = "rules_go", version = "0.59.0")
6+
bazel_dep(name = "gazelle", version = "0.53.0")
77
bazel_dep(name = "rules_proto", version = "7.1.0")
88
bazel_dep(name = "aspect_rules_js", version = "3.5.0")
99
bazel_dep(name = "aspect_rules_ts", version = "3.10.1")
@@ -15,6 +15,8 @@ bazel_dep(name = "rules_python", version = "2.2.0")
1515
bazel_dep(name = "bazel_lib", version = "3.7.2")
1616
bazel_dep(name = "platforms", version = "1.1.0")
1717

18+
bazel_dep(name = "rules_docker_compose", version = "0.4.0", dev_dependency = True)
19+
1820
single_version_override(
1921
module_name = "git",
2022
version = "2.55.0",

‎Makefile‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
# Bazel wrapper
22
BAZEL = ./tool/bazel
33

4-
# Docker Compose wrapper
5-
COMPOSE = docker-compose
4+
# Bazel supplies the pinned Docker Compose release for every local stack.
5+
COMPOSE = $(BAZEL) run @rules_docker_compose//docker_compose --
66

77
# SubmitQueue compose files
8-
COMPOSE_FILE = service/submitqueue/docker-compose.yml
9-
WEB_COMPOSE_FILE = service/submitqueue/docker-compose.web.yml
10-
GATEWAY_COMPOSE_FILE = service/submitqueue/gateway/server/docker-compose.yml
11-
ORCHESTRATOR_COMPOSE_FILE = service/submitqueue/orchestrator/server/docker-compose.yml
8+
COMPOSE_FILE = $(abspath service/submitqueue/docker-compose.yml)
9+
GATEWAY_COMPOSE_FILE = $(abspath service/submitqueue/gateway/server/docker-compose.yml)
10+
ORCHESTRATOR_COMPOSE_FILE = $(abspath service/submitqueue/orchestrator/server/docker-compose.yml)
11+
WEB_COMPOSE_FILE = $(abspath service/submitqueue/docker-compose.web.yml)
1212

1313
# Fixed project name for local manual testing (tests use unique random names)
1414
SUBMITQUEUE_LOCAL_PROJECT = submitqueue
1515

1616
# Stovepipe compose file (single Ping-only service)
17-
STOVEPIPE_COMPOSE_FILE = service/stovepipe/docker-compose.yml
18-
STOVEPIPE_DEBUG_COMPOSE_FILE = service/stovepipe/docker-compose.debug.yml
17+
STOVEPIPE_COMPOSE_FILE = $(abspath service/stovepipe/docker-compose.yml)
18+
STOVEPIPE_DEBUG_COMPOSE_FILE = $(abspath service/stovepipe/docker-compose.debug.yml)
1919

2020
# Fixed project name for local manual testing (tests use unique random names)
2121
STOVEPIPE_LOCAL_PROJECT = stovepipe
2222

2323
# Runway compose files
24-
RUNWAY_COMPOSE_FILE = service/runway/server/docker-compose.yml
24+
RUNWAY_COMPOSE_FILE = $(abspath service/runway/server/docker-compose.yml)
2525

2626
# Fixed project name for local manual testing (tests use unique random names)
2727
RUNWAY_LOCAL_PROJECT = runway
@@ -61,9 +61,9 @@ export SQ_PROVIDER_CONFIG_DIR ?= $(REPO_ROOT)/service/submitqueue/demo/provider/
6161
# Which compose overlay each mode needs. This cannot live in the provider
6262
# directory: the two config files say how the services are configured, not what
6363
# has to be mounted or which credential has to be present for them to start.
64-
PROVIDER_COMPOSE_FILE_fake = service/submitqueue/docker-compose.fake.yml
65-
PROVIDER_COMPOSE_FILE_git = service/submitqueue/docker-compose.git.yml
66-
PROVIDER_COMPOSE_FILE_github = service/submitqueue/docker-compose.provider.yml
64+
PROVIDER_COMPOSE_FILE_fake = $(abspath service/submitqueue/docker-compose.fake.yml)
65+
PROVIDER_COMPOSE_FILE_git = $(abspath service/submitqueue/docker-compose.git.yml)
66+
PROVIDER_COMPOSE_FILE_github = $(abspath service/submitqueue/docker-compose.provider.yml)
6767
PROVIDER_COMPOSE_FILE = $(PROVIDER_COMPOSE_FILE_$(PROVIDER))
6868

6969
# Where PROVIDER=git keeps the bare repository it lands into. Outside the

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Cross-domain Go code (errors, metrics, consumer framework, HTTP helpers, shared
1818

1919
## Quick Start
2020

21-
Put traffic through the queue and watch it land. Requires Docker and Docker Compose, and nothing else — no repository, no account, no token.
21+
Put traffic through the queue and watch it land. Requires Docker; Bazel supplies Docker Compose. No repository, no account, no token.
2222

2323
```bash
2424
# Start the full stack (Gateway + Orchestrator + Runway + MySQL)

‎doc/howto/DEVELOPMENT.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Prerequisites
44

55
- **Go 1.25+** — needed for `gopls`, `go mod`, and installing protoc plugins. Download from [go.dev/dl](https://go.dev/dl/). Note: Bazel manages its own Go toolchain for builds, but a local Go installation is required for editor tooling and dependency management.
6-
- **Docker** and **Docker Compose** — for integration and e2e tests, and for running services locally.
6+
- **Docker** — for integration and e2e tests, and for running services locally. Bazel supplies Docker Compose.
77
- **direnv** (recommended) — automatically loads `.envrc` so you can use `bazel` directly instead of `./tool/bazel`.
88

99
The project includes `./tool/bazel` (Bazelisk wrapper) and `.bazelversion`, so you don't need to install Bazel separately. Bazel manages its own Go toolchain for building and testing.

‎doc/howto/QUICKSTART.md‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,13 @@ SQ_TOKEN=$(cat ~/.sq-token) bazel run //service/submitqueue/gateway/client:gatew
183183

184184
### Service logs
185185

186+
Follow logs from every service, or just Runway:
187+
186188
```bash
187-
make local-submitqueue-logs # every service
188-
docker compose -p submitqueue logs -f runway-service # one of them
189+
make local-submitqueue-logs
190+
REPO_ROOT="$PWD" ./tool/bazel run @rules_docker_compose//docker_compose -- \
191+
-f "$PWD/service/submitqueue/docker-compose.yml" \
192+
-p submitqueue logs -f runway-service
189193
```
190194

191195
The message queue logs a line per message published, fetched, leased and acked, which at debug level buries everything else a service says. It is levelled separately from the rest of the service, at info by default. To follow the queue itself — chasing a message that never arrived, or a partition that never got leased — turn it back up:

‎go.mod‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ go 1.25.0
44

55
require (
66
github.com/DATA-DOG/go-sqlmock v1.5.0
7+
github.com/bazelbuild/rules_go v0.59.0
78
github.com/go-sql-driver/mysql v1.6.0
89
github.com/spf13/cobra v1.10.2
910
github.com/stretchr/testify v1.11.1

‎go.sum‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF
1111
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
1212
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
1313
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
14+
github.com/bazelbuild/rules_go v0.59.0 h1:RLhOwYIqeMgBpKelHEWTfIPjA37so3oa/rX+/qqq/P4=
15+
github.com/bazelbuild/rules_go v0.59.0/go.mod h1:Pn30cb4M513fe2rQ6GiJ3q8QyrRsgC7zhuDvi50Lw4Y=
1416
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
1517
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
1618
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=

‎service/runway/server/Dockerfile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ RUN apt-get update && apt-get install -y ca-certificates git && rm -rf /var/lib/
1616
WORKDIR /app
1717

1818
# Built via: make build-runway-linux
19-
COPY --chmod=0555 .docker-bin/runway ./runway
19+
COPY .docker-bin/runway ./runway
20+
RUN chmod 0555 ./runway
2021

2122
EXPOSE 8080
2223

‎service/submitqueue/gateway/server/Dockerfile‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ WORKDIR /app
66

77
# Copy pre-built Linux binary
88
# Built via: make build-submitqueue-gateway-linux
9-
COPY --chmod=0555 .docker-bin/gateway ./gateway
9+
COPY .docker-bin/gateway ./gateway
10+
RUN chmod 0555 ./gateway
1011

1112
# Sample queue configuration; the gateway reads it on startup via
1213
# QUEUE_CONFIG_PATH (set in docker-compose.yml).
13-
COPY --chmod=0444 service/submitqueue/gateway/server/queues.yaml ./queues.yaml
14+
COPY service/submitqueue/gateway/server/queues.yaml ./queues.yaml
15+
RUN chmod 0444 ./queues.yaml
1416

1517
EXPOSE 8080
1618

‎service/submitqueue/orchestrator/server/Dockerfile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ WORKDIR /app
1717

1818
# Copy pre-built Linux binary
1919
# Built via: make build-submitqueue-orchestrator-linux
20-
COPY --chmod=0555 .docker-bin/orchestrator ./orchestrator
20+
COPY .docker-bin/orchestrator ./orchestrator
21+
RUN chmod 0555 ./orchestrator
2122

2223
EXPOSE 8080
2324

0 commit comments

Comments
 (0)