Skip to content

Commit a372d05

Browse files
[chore][Makefile] Add make target to build Supervisor container image with a Collector (#39619)
#### Description This PR adds a new Makefile target: `docker-supervisor-otelcontribcol`. This target builds an image of the Supervisor with the Contrib Collector included. The intention is to make it easier for anyone to test out Supervisor features and to be an example for those who want to build their own Supervisor+Collector images. #### Testing Built and ran images locally.
1 parent 99934f4 commit a372d05

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,10 @@ endif
349349
docker-otelcontribcol:
350350
COMPONENT=otelcontribcol $(MAKE) docker-component
351351

352+
.PHONY: docker-supervisor-otelcontribcol
353+
docker-supervisor-otelcontribcol: docker-otelcontribcol
354+
COMPONENT=opampsupervisor $(MAKE) docker-component
355+
352356
.PHONY: docker-telemetrygen
353357
docker-telemetrygen:
354358
GOOS=linux GOARCH=$(GOARCH) $(MAKE) telemetrygen
@@ -434,6 +438,12 @@ telemetrygenlite:
434438
cd ./cmd/telemetrygen && GO111MODULE=on CGO_ENABLED=0 $(GOCMD) build -trimpath -o ../../bin/telemetrygen_$(GOOS)_$(GOARCH)$(EXTENSION) \
435439
-tags $(GO_BUILD_TAGS) -ldflags $(GO_BUILD_LDFLAGS) .
436440

441+
# Build the Supervisor executable.
442+
.PHONY: opampsupervisor
443+
opampsupervisor:
444+
cd ./cmd/opampsupervisor && GO111MODULE=on CGO_ENABLED=0 $(GOCMD) build -trimpath -o ../../bin/opampsupervisor_$(GOOS)_$(GOARCH)$(EXTENSION) \
445+
-tags $(GO_BUILD_TAGS) .
446+
437447
MODULES="internal/buildscripts/modules"
438448
.PHONY: update-core-modules
439449
update-core-module-list:

cmd/opampsupervisor/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM otelcontribcol AS col
2+
3+
FROM alpine:latest@sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c AS prep
4+
RUN apk --update add ca-certificates
5+
RUN mkdir -p /etc/otel/supervisor-data/
6+
7+
FROM scratch
8+
9+
ARG USER_UID=10001
10+
ARG USER_GID=10001
11+
USER ${USER_UID}:${USER_GID}
12+
13+
COPY --from=prep /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
14+
COPY --from=prep --chmod=777 --chown=${USER_UID}:${USER_GID} /etc/otel/supervisor-data /etc/otel/supervisor-data
15+
COPY --chmod=755 opampsupervisor /
16+
COPY ./examples/supervisor_docker.yaml /etc/otel/supervisor.yaml
17+
COPY --from=col --chmod=755 /otelcontribcol /otelcontribcol
18+
19+
EXPOSE 4317 55680 55679
20+
ENTRYPOINT ["/opampsupervisor"]
21+
CMD ["--config", "/etc/otel/supervisor.yaml"]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
server:
2+
endpoint: wss://127.0.0.1:4320/v1/opamp
3+
tls:
4+
# Disable verification to test locally.
5+
# Don't do this in production.
6+
insecure_skip_verify: true
7+
# For more TLS settings see config/configtls.ClientConfig
8+
9+
capabilities:
10+
reports_effective_config: true
11+
reports_own_metrics: true
12+
reports_own_logs: true
13+
reports_own_traces: true
14+
reports_health: true
15+
accepts_remote_config: true
16+
reports_remote_config: true
17+
18+
agent:
19+
executable: /otelcontribcol
20+
21+
storage:
22+
directory: /etc/otel/supervisor-data/

0 commit comments

Comments
 (0)