Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This CL creates a Docker image for running an InfluxDB instance for the Go performance monitoring dashboard. The image is based on the Google-maintained GCP InfluxDB 2 image, with an additional small program to perform initial database setup and push access credentials to Google Secret Manager. See README.md for instructions on running the image locally or on GCP. For golang/go#48803 Change-Id: Ica34bd624f6daf89e483f898b110ccaceac83559 Reviewed-on: https://go-review.googlesource.com/c/perf/+/392635 Trust: Michael Pratt <mpratt@google.com> Run-TryBot: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
- Loading branch information
Showing
6 changed files
with
1,064 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright 2022 The Go Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style | ||
# license that can be found in the LICENSE file. | ||
|
||
FROM golang:1.18 AS gobuilder | ||
|
||
WORKDIR /app | ||
|
||
# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading | ||
# them in subsequent builds if they change | ||
COPY go.mod go.sum ./ | ||
RUN go mod download && go mod verify | ||
|
||
COPY . . | ||
|
||
RUN go build -o setup | ||
|
||
FROM marketplace.gcr.io/google/influxdb2:latest | ||
|
||
COPY --from=gobuilder /app/setup /setup | ||
|
||
# For now, generate a self-signed cert to use. Not for production use! | ||
RUN openssl req -x509 -nodes -newkey rsa:2048 \ | ||
-keyout /etc/ssl/influxdb-selfsigned.key \ | ||
-out /etc/ssl/influxdb-selfsigned.crt \ | ||
-days 30 \ | ||
-subj '/CN=localhost' | ||
|
||
# Run our setup application in the background and the parent Influx entrypoint | ||
# in the foreground. | ||
ENTRYPOINT ["/bin/sh"] | ||
CMD ["-c", "/setup & /docker-entrypoint.sh influxd --tls-cert=/etc/ssl/influxdb-selfsigned.crt --tls-key=/etc/ssl/influxdb-selfsigned.key --http-bind-address=:443"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# InfluxDB container image | ||
|
||
This directory contains the source for the InfluxDB container image used in the | ||
Go Performance Monitoring system. The image is based on the Google-maintained | ||
GCP InfluxDB 2 image, with an additional small program to perform initial | ||
database setup and push access credentials to Google Secret Manager. | ||
|
||
## Local | ||
|
||
To run an instance locally: | ||
|
||
$ sudo docker build -t golang_influx . && sudo docker run --rm -p 443:8086 golang_influx | ||
|
||
Browse / API connect to https://localhost:8086 (note that the instance uses a | ||
self-signed certificate), and authenticate with user 'admin' or 'reader' with | ||
the password or API token logged by the container. | ||
|
||
## Google Cloud | ||
|
||
Perform the one-time project setup described in `setup.sh`, and then run the | ||
script to start an instance: | ||
|
||
$ ./setup.sh <project> us-central1-docker.pkg.dev/<project>/golang-perf-docker-repo | ||
|
||
The instance can be accessed via the "EXTERNAL IP" in the output. View | ||
[VM instance logs](https://console.cloud.google.com/compute/instances) to verify | ||
successful setup. | ||
|
||
The authentication credentials are stored in the project's Secret Manager. e.g., | ||
to access the admin password: | ||
|
||
$ gcloud secrets versions access latest --secret=influx-admin-pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module golang.org/x/perf/influx | ||
|
||
go 1.17 | ||
|
||
require ( | ||
cloud.google.com/go/compute v1.5.0 | ||
cloud.google.com/go/secretmanager v1.3.0 | ||
github.com/influxdata/influxdb-client-go/v2 v2.8.0 | ||
google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf | ||
) | ||
|
||
require ( | ||
cloud.google.com/go v0.100.2 // indirect | ||
cloud.google.com/go/iam v0.1.0 // indirect | ||
github.com/deepmap/oapi-codegen v1.8.2 // indirect | ||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect | ||
github.com/golang/protobuf v1.5.2 // indirect | ||
github.com/google/go-cmp v0.5.7 // indirect | ||
github.com/googleapis/gax-go/v2 v2.1.1 // indirect | ||
github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 // indirect | ||
github.com/pkg/errors v0.9.1 // indirect | ||
go.opencensus.io v0.23.0 // indirect | ||
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect | ||
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect | ||
golang.org/x/sys v0.0.0-20220209214540-3681064d5158 // indirect | ||
golang.org/x/text v0.3.7 // indirect | ||
google.golang.org/api v0.70.0 // indirect | ||
google.golang.org/appengine v1.6.7 // indirect | ||
google.golang.org/grpc v1.44.0 // indirect | ||
google.golang.org/protobuf v1.27.1 // indirect | ||
gopkg.in/yaml.v2 v2.3.0 // indirect | ||
) |
Oops, something went wrong.