Skip to content

Commit

Permalink
Update binary name to pyroscope (#2023)
Browse files Browse the repository at this point in the history
* Update binary name to pyroscope

Also updates makefile targets and some folder names

* Fix make deploy
  • Loading branch information
simonswine authored Jul 20, 2023
1 parent 46cfeac commit cf1e77f
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 61 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
node-version: 18.15.0
cache: yarn
- name: Build image Phlare
run: make docker-image/phlare/build "BUILDX_ARGS=--cache-from=type=gha --cache-to=type=gha"
run: make docker-image/pyroscope/build "BUILDX_ARGS=--cache-from=type=gha --cache-to=type=gha"

build-push:
if: github.event_name == 'push' && github.repository == 'grafana/pyroscope'
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
- name: Phlare Build & push multi-arch image
id: build-push
run: |
make docker-image/phlare/push "BUILDX_ARGS=--cache-from=type=gha --cache-to=type=gha"
make docker-image/pyroscope/push "BUILDX_ARGS=--cache-from=type=gha --cache-to=type=gha"
deploy-phlare-dev-001:
if: github.event_name == 'push' && github.repository == 'grafana/pyroscope'
Expand All @@ -123,9 +123,9 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Deploy to phlare-dev-001
- name: Deploy to fire-dev-001
run: |
git config --global url."https://grafanabot:${{ secrets.GH_BOT_ACCESS_TOKEN }}@github.com/grafana/deployment_tools".insteadOf "https://github.com/grafana/deployment_tools"
make docker-image/phlare/deploy-dev-001
make docker-image/pyroscope/deploy-dev-001
env:
GITHUB_TOKEN: ${{ secrets.GH_BOT_ACCESS_TOKEN }}
58 changes: 29 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ GIT_LAST_COMMIT_DATE := $(shell git log -1 --date=iso-strict --format=%cd)
EMBEDASSETS ?= embedassets

# Build flags
VPREFIX := github.com/grafana/phlare/pkg/util/build
VPREFIX := github.com/grafana/pyroscope/pkg/util/build
GO_LDFLAGS := -X $(VPREFIX).Branch=$(GIT_BRANCH) -X $(VPREFIX).Version=$(IMAGE_TAG) -X $(VPREFIX).Revision=$(GIT_REVISION) -X $(VPREFIX).BuildDate=$(GIT_LAST_COMMIT_DATE)

.PHONY: help
Expand Down Expand Up @@ -106,7 +106,7 @@ go/deps:
$(GO) mod tidy

define go_build
GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 $(GO) build -tags "netgo $(EMBEDASSETS)" -ldflags "-extldflags \"-static\" $(1)" ./cmd/phlare
GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 $(GO) build -tags "netgo $(EMBEDASSETS)" -ldflags "-extldflags \"-static\" $(1)" ./cmd/pyroscope
GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 $(GO) build -ldflags "-extldflags \"-static\" $(1)" ./cmd/profilecli
endef

Expand Down Expand Up @@ -159,12 +159,12 @@ endef
define deploy
$(BIN)/kind export kubeconfig --name $(KIND_CLUSTER) || $(BIN)/kind create cluster --name $(KIND_CLUSTER)
# Load image into nodes
$(BIN)/kind load docker-image --name $(KIND_CLUSTER) $(IMAGE_PREFIX)phlare:$(IMAGE_TAG)
$(BIN)/kind load docker-image --name $(KIND_CLUSTER) $(IMAGE_PREFIX)pyroscope:$(IMAGE_TAG)
kubectl get pods
$(BIN)/helm upgrade --install $(1) ./operations/phlare/helm/phlare $(2) \
--set phlare.image.tag=$(IMAGE_TAG) \
--set phlare.image.repository=$(IMAGE_PREFIX)phlare \
--set phlare.podAnnotations.image-id=$(shell cat .docker-image-id-phlare) \
--set phlare.image.repository=$(IMAGE_PREFIX)pyroscope \
--set phlare.podAnnotations.image-id=$(shell cat .docker-image-id-pyroscope) \
--set phlare.service.port_name=http-metrics \
--set phlare.podAnnotations."profiles\.grafana\.com\/memory\.port_name"=http-metrics \
--set phlare.podAnnotations."profiles\.grafana\.com\/cpu\.port_name"=http-metrics \
Expand All @@ -173,30 +173,30 @@ define deploy
--set phlare.extraArgs."phlaredb\.max-block-duration"=5m
endef

.PHONY: docker-image/phlare/build-debug
docker-image/phlare/build-debug: GOOS=linux
docker-image/phlare/build-debug: GOARCH=amd64
docker-image/phlare/build-debug: frontend/build go/bin-debug $(BIN)/linux_amd64/dlv
.PHONY: docker-image/pyroscope/build-debug
docker-image/pyroscope/build-debug: GOOS=linux
docker-image/pyroscope/build-debug: GOARCH=amd64
docker-image/pyroscope/build-debug: frontend/build go/bin-debug $(BIN)/linux_amd64/dlv
$(call docker_buildx,--load,debug.)

.PHONY: docker-image/phlare/build
docker-image/phlare/build: GOOS=linux
docker-image/phlare/build: GOARCH=amd64
docker-image/phlare/build: frontend/build go/bin
$(call docker_buildx,--load --iidfile .docker-image-id-phlare,)
.PHONY: docker-image/pyroscope/build
docker-image/pyroscope/build: GOOS=linux
docker-image/pyroscope/build: GOARCH=amd64
docker-image/pyroscope/build: frontend/build go/bin
$(call docker_buildx,--load --iidfile .docker-image-id-pyroscope,)

.PHONY: docker-image/phlare/push
docker-image/phlare/push: GOOS=linux
docker-image/phlare/push: GOARCH=amd64
docker-image/phlare/push: frontend/build go/bin
.PHONY: docker-image/pyroscope/push
docker-image/pyroscope/push: GOOS=linux
docker-image/pyroscope/push: GOARCH=amd64
docker-image/pyroscope/push: frontend/build go/bin
$(call docker_buildx,--push)

define UPDATER_CONFIG_JSON
{
"repo_name": "deployment_tools",
"destination_branch": "master",
"wait_for_ci": true,
"wait_for_ci_branch_prefix": "automation/phlare-dev-deploy",
"wait_for_ci_branch_prefix": "automation/pyroscope-dev-deploy",
"wait_for_ci_timeout": "10m",
"wait_for_ci_required_status": [
"continuous-integration/drone/push"
Expand All @@ -205,15 +205,15 @@ define UPDATER_CONFIG_JSON
{
"file_path": "ksonnet/environments/phlare/waves/dev.libsonnet",
"jsonnet_key": "phlare",
"jsonnet_value": "$(IMAGE_PREFIX)phlare:$(IMAGE_TAG)"
"jsonnet_value": "$(IMAGE_PREFIX)pyroscope:$(IMAGE_TAG)"
}
]
}
endef

.PHONY: docker-image/phlare/deploy-dev-001
docker-image/phlare/deploy-dev-001: export CONFIG_JSON:=$(call UPDATER_CONFIG_JSON)
docker-image/phlare/deploy-dev-001: $(BIN)/updater
.PHONY: docker-image/pyroscope/deploy-dev-001
docker-image/pyroscope/deploy-dev-001: export CONFIG_JSON:=$(call UPDATER_CONFIG_JSON)
docker-image/pyroscope/deploy-dev-001: $(BIN)/updater
$(BIN)/updater

.PHONY: clean
Expand All @@ -224,8 +224,8 @@ clean: ## Delete intermediate build artifacts
.PHONY: reference-help
reference-help: ## Generates the reference help documentation.
reference-help: build
@(./phlare -h || true) > cmd/phlare/help.txt.tmpl
@(./phlare -help-all || true) > cmd/phlare/help-all.txt.tmpl
@(./pyroscope -h || true) > cmd/pyroscope/help.txt.tmpl
@(./pyroscope -help-all || true) > cmd/pyroscope/help-all.txt.tmpl

$(BIN)/buf: Makefile
@mkdir -p $(@D)
Expand Down Expand Up @@ -318,7 +318,7 @@ $(BIN)/trunk: Makefile
curl -L https://trunk.io/releases/trunk -o $(@D)/trunk
chmod +x $(@D)/trunk

KIND_CLUSTER = phlare-dev
KIND_CLUSTER = pyroscope-dev

.PHONY: helm/lint
helm/lint: $(BIN)/helm
Expand Down Expand Up @@ -358,13 +358,13 @@ helm/check: $(BIN)/kubeconform $(BIN)/helm
> ./operations/phlare/jsonnet/values.json

.PHONY: deploy
deploy: $(BIN)/kind $(BIN)/helm docker-image/phlare/build
deploy: $(BIN)/kind $(BIN)/helm docker-image/pyroscope/build
$(call deploy,phlare-dev,)
# Create a service to provide the same endpoint as micro-services
echo '{"kind":"Service","apiVersion":"v1","metadata":{"name":"phlare-micro-services-query-frontend"},"spec":{"ports":[{"name":"phlare","port":4100,"targetPort":4100}],"selector":{"app.kubernetes.io/component":"all","app.kubernetes.io/instance":"phlare-dev"},"type":"ClusterIP"}}' | kubectl apply -f -

.PHONY: deploy-micro-services
deploy-micro-services: $(BIN)/kind $(BIN)/helm docker-image/phlare/build
deploy-micro-services: $(BIN)/kind $(BIN)/helm docker-image/pyroscope/build
$(call deploy,phlare-micro-services,--values=operations/phlare/helm/phlare/values-micro-services.yaml --set phlare.components.querier.resources=null --set phlare.components.distributor.resources=null --set phlare.components.ingester.resources=null --set phlare.components.store-gateway.resources=null)

.PHONY: deploy-monitoring
Expand All @@ -391,4 +391,4 @@ docs/%:

.PHONY: run
run: ## Run the phlare binary (pass parameters with 'make run PARAMS=-myparam')
./phlare $(PARAMS)
./pyroscope $(PARAMS)
18 changes: 0 additions & 18 deletions cmd/phlare/Dockerfile

This file was deleted.

File renamed without changes.
18 changes: 18 additions & 0 deletions cmd/pyroscope/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM alpine:3.17.4

RUN apk add --no-cache ca-certificates

COPY cmd/pyroscope/pyroscope.yaml /etc/pyroscope/config.yaml
COPY profilecli /usr/bin/profilecli
COPY pyroscope /usr/bin/pyroscope

RUN addgroup -g 10001 -S pyroscope && \
adduser -u 10001 -S pyroscope -G pyroscope
RUN mkdir -p /data && \
chown -R pyroscope:pyroscope /data
VOLUME /data

USER pyroscope
EXPOSE 4100
ENTRYPOINT [ "/usr/bin/pyroscope" ]
CMD ["-config.file=/etc/pyroscope/config.yaml"]
16 changes: 8 additions & 8 deletions cmd/phlare/debug.Dockerfile → cmd/pyroscope/debug.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ RUN apk add --no-cache ca-certificates

COPY .tmp/bin/linux_amd64/dlv /usr/bin/dlv

COPY cmd/phlare/phlare.yaml /etc/phlare/config.yaml
COPY cmd/pyroscope/pyroscope.yaml /etc/pyroscope/config.yaml
COPY profilecli /usr/bin/profilecli
COPY phlare /usr/bin/phlare
COPY pyroscope /usr/bin/pyroscope

RUN addgroup -g 10001 -S phlare && \
adduser -u 10001 -S phlare -G phlare
RUN addgroup -g 10001 -S pyroscope && \
adduser -u 10001 -S pyroscope -G pyroscope
RUN mkdir -p /data && \
chown -R phlare:phlare /data
chown -R pyroscope:pyroscope /data
VOLUME /data

USER phlare
USER pyroscope
EXPOSE 4100
ENTRYPOINT ["/usr/bin/dlv", "--listen=:40000", "--headless=true", "--log", "--continue", "--accept-multiclient" , "--api-version=2", "exec", "/usr/bin/phlare", "--"]
CMD ["-config.file=/etc/phlare/config.yaml"]
ENTRYPOINT ["/usr/bin/dlv", "--listen=:40000", "--headless=true", "--log", "--continue", "--accept-multiclient" , "--api-version=2", "exec", "/usr/bin/pyroscope", "--"]
CMD ["-config.file=/etc/pyroscope/config.yaml"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions docs/internal/contributing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ make go/test
To build the docker image use:

```
make docker-image/phlare/build
make docker-image/pyroscope/build
```

This target uses the `go/bin` target to first build binaries to include in the image.
Expand All @@ -59,7 +59,7 @@ Make sure to pass the correct `GOOS` and `GOARCH` env variables.
For example for `linux/amd64`:

```
GOOS=linux GOARCH=amd64 make docker-image/phlare/build
GOOS=linux GOARCH=amd64 make docker-image/pyroscope/build
```

### Dependency management
Expand Down

0 comments on commit cf1e77f

Please sign in to comment.