Skip to content

Commit

Permalink
Enable Production Endpoint for Product Telemetry (nginxinc#1699)
Browse files Browse the repository at this point in the history
Problem:
Start sending product telemetry to the product F5 telemetry service.

Solution:
- Use the production telemetry endpoint in production NGF image, built
  using:
  - goreleaser
  - make commands from building the images doc
- Introduce new targets in the Makefile for building prod images.

Developer instructions for building NGF image remain unchanged, and
such image will not send any telemetry, but will report it in the logs
at the debug level.

Testing:
- Confirmed production NGF image built using make command sends
  telemetry.
- Confirmed developer NGF image build using make command doesn't send
  any telemetry but reports it in the logs.

CLOSES - nginxinc#1563
  • Loading branch information
pleshakov authored and amimimor committed Apr 3, 2024
1 parent 68fa10c commit 5620626
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ jobs:
AZURE_STORAGE_KEY: ${{ secrets.AZURE_STORAGE_KEY }}
AZURE_BUCKET_NAME: ${{ secrets.AZURE_BUCKET_NAME }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_COMMUNITY }}
TELEMETRY_ENDPOINT: "" # disables sending telemetry
TELEMETRY_ENDPOINT: oss.edge.df.f5.com:443
TELEMETRY_ENDPOINT_INSECURE: "false"

- name: Cache Artifacts
Expand Down
27 changes: 21 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ NGINX_CONF_DIR = internal/mode/static/nginx/conf
NJS_DIR = internal/mode/static/nginx/modules/src
NGINX_DOCKER_BUILD_PLUS_ARGS = --secret id=nginx-repo.crt,src=nginx-repo.crt --secret id=nginx-repo.key,src=nginx-repo.key
BUILD_AGENT=local
TELEMETRY_REPORT_PERIOD = 24h # also configured in goreleaser.yml

# FIXME(pleshakov) - TELEMETRY_ENDPOINT will have the default value of F5 telemetry service once we're ready
# to report. https://github.com/nginxinc/nginx-gateway-fabric/issues/1563
# Also, we will need to set it in goreleaser.yml
TELEMETRY_ENDPOINT =# if empty, NGF will report telemetry in its logs at debug level.
PROD_TELEMETRY_ENDPOINT = oss.edge.df.f5.com:443
# the telemetry related variables below are also configured in goreleaser.yml
TELEMETRY_REPORT_PERIOD = 24h
TELEMETRY_ENDPOINT=# if empty, NGF will report telemetry in its logs at debug level.
TELEMETRY_ENDPOINT_INSECURE = false

TELEMETRY_ENDPOINT_INSECURE = false # also configured in goreleaser.yml
GW_API_VERSION = 1.0.0
INSTALL_WEBHOOK = false
NODE_VERSION = $(shell cat .nvmrc)
Expand Down Expand Up @@ -45,20 +44,36 @@ help: Makefile ## Display this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "; printf "Usage:\n\n make \033[36m<target>\033[0m [VARIABLE=value...]\n\nTargets:\n\n"}; {printf " \033[36m%-30s\033[0m %s\n", $$1, $$2}'
@grep -E '^(override )?[a-zA-Z_-]+ \??\+?= .*?## .*$$' $< | sort | awk 'BEGIN {FS = " \\??\\+?= .*?## "; printf "\nVariables:\n\n"}; {gsub(/override /, "", $$1); printf " \033[36m%-30s\033[0m %s\n", $$1, $$2}'

.PHONY: build-prod-images
build-prod-images: build-prod-ngf-image build-prod-nginx-image ## Build the NGF and nginx docker images for production

.PHONY: build-prod-images-with-plus
build-prod-images-with-plus: build-prod-ngf-image build-prod-nginx-plus-image ## Build the NGF and NGINX Plus docker images for production

.PHONY: build-images
build-images: build-ngf-image build-nginx-image ## Build the NGF and nginx docker images

.PHONY: build-images-with-plus
build-images-with-plus: build-ngf-image build-nginx-plus-image ## Build the NGF and NGINX Plus docker images

.PHONY: build-prod-ngf-image
build-prod-ngf-image: TELEMETRY_ENDPOINT=$(PROD_TELEMETRY_ENDPOINT)
build-prod-ngf-image: build-ngf-image ## Build the NGF docker image for production

.PHONY: build-ngf-image
build-ngf-image: check-for-docker build ## Build the NGF docker image
docker build --platform linux/$(GOARCH) --build-arg BUILD_AGENT=$(BUILD_AGENT) --target $(strip $(TARGET)) -f build/Dockerfile -t $(strip $(PREFIX)):$(strip $(TAG)) .

.PHONY: build-prod-nginx-image
build-prod-nginx-image: build-nginx-image ## Build the custom nginx image for production

.PHONY: build-nginx-image
build-nginx-image: check-for-docker ## Build the custom nginx image
docker build --platform linux/$(GOARCH) $(strip $(NGINX_DOCKER_BUILD_OPTIONS)) -f build/Dockerfile.nginx -t $(strip $(NGINX_PREFIX)):$(strip $(TAG)) .

.PHONY: build-prod-nginx-plus-image
build-prod-nginx-plus-image: build-nginx-plus-image ## Build the custom nginx plus image for production

.PHONY: build-nginx-plus-image
build-nginx-plus-image: check-for-docker ## Build the custom nginx plus image
docker build --platform linux/$(GOARCH) $(strip $(NGINX_DOCKER_BUILD_OPTIONS)) $(strip $(NGINX_DOCKER_BUILD_PLUS_ARGS)) -f build/Dockerfile.nginxplus -t $(strip $(NGINX_PLUS_PREFIX)):$(strip $(TAG)) .
Expand Down
10 changes: 5 additions & 5 deletions site/content/installation/ngf-images/building-the-images.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,31 @@ If building the NGINX Plus image, you will also need a valid NGINX Plus license
- To build both the NGINX Gateway Fabric and NGINX images:

```makefile
make PREFIX=myregistry.example.com/nginx-gateway-fabric build-images
make PREFIX=myregistry.example.com/nginx-gateway-fabric build-prod-images
```

- To build both the NGINX Gateway Fabric and NGINX Plus images:

```makefile
make PREFIX=myregistry.example.com/nginx-gateway-fabric build-images-with-plus
make PREFIX=myregistry.example.com/nginx-gateway-fabric build-prod-images-with-plus
```

- To build just the NGINX Gateway Fabric image:

```makefile
make PREFIX=myregistry.example.com/nginx-gateway-fabric build-ngf-image
make PREFIX=myregistry.example.com/nginx-gateway-fabric build-prod-ngf-image
```

- To build just the NGINX image:

```makefile
make PREFIX=myregistry.example.com/nginx-gateway-fabric build-nginx-image
make PREFIX=myregistry.example.com/nginx-gateway-fabric build-prod-nginx-image
```

- To build just the NGINX Plus image:

```makefile
make PREFIX=<my-docker-registry>/nginx-gateway-fabric/nginx-plus build-nginx-plus-image
make PREFIX=myregistry.example.com/nginx-gateway-fabric/nginx-plus build-prod-nginx-plus-image
```

Set the `PREFIX` variable to the name of the registry you'd like to push the image to. By default, the images will be
Expand Down

0 comments on commit 5620626

Please sign in to comment.