Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/.build
/.tarballs
pgpool2_exporter
pgpool2_exporter*
*.tar.gz
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
FROM quay.io/prometheus/busybox:latest
FROM --platform=$BUILDPLATFORM quay.io/prometheus/busybox:latest
LABEL maintainer="Bo Peng <pengbo@sraoss.co.jp>"

ARG TARGETARCH

ENV POSTGRES_USERNAME postgres
ENV POSTGRES_PASSWORD postgres
ENV POSTGRES_DATABASE postgres
ENV PGPOOL_SERVICE localhost
ENV PGPOOL_SERVICE_PORT 9999
ENV SSLMODE disable

COPY pgpool2_exporter /bin/pgpool2_exporter
COPY pgpool2_exporter-$TARGETARCH /bin/pgpool2_exporter

CMD ["/bin/sh", "-c", "export DATA_SOURCE_USER=\"${POSTGRES_USERNAME}\" ; export DATA_SOURCE_PASS=\"${POSTGRES_PASSWORD}\" ; export DATA_SOURCE_URI=\"${PGPOOL_SERVICE}:${PGPOOL_SERVICE_PORT}/${POSTGRES_DATABASE}?sslmode=${SSLMODE}\" ; /bin/pgpool2_exporter"]

Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
GO := go
GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH)))
GOARCH ?= amd64

PROMU ?= $(GOPATH)/bin/promu
pkgs = $(shell $(GO) list ./... | grep -v /vendor/)
Expand All @@ -14,7 +15,8 @@ DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD))

build: promu
@echo ">> building binaries"
@$(PROMU) build --prefix $(PREFIX)
@$(PROMU) build -v --prefix $(PREFIX)
mv pgpool2_exporter pgpool2_exporter-$(GOARCH)

crossbuild: promu
@echo ">> building cross-platform binaries"
Expand All @@ -35,6 +37,6 @@ tarballs: crossbuild

docker:
@echo ">> building docker image"
@docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" .
@docker buildx build --push --platform linux/amd64,linux/arm64 -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" .

.PHONY: promu build crossbuild tarball tarballs docker
1 change: 0 additions & 1 deletion pgpool2_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"fmt"
"math"
"net/url"
"os"
"regexp"
"strconv"
"sync"
Expand Down