Skip to content

Commit

Permalink
[product-catalog] rename productcatalogservice to product-catalog (#1864
Browse files Browse the repository at this point in the history
)

* rename productcatalogservice to product-catalog

* rename productcatalogservice to product-catalog

* rename productcatalogservice to product-catalog

* rename productcatalogservice to product-catalog
  • Loading branch information
puckpuck authored Jan 10, 2025
1 parent 1efe410 commit 8cb101d
Show file tree
Hide file tree
Showing 31 changed files with 94 additions and 92 deletions.
6 changes: 3 additions & 3 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ PAYMENT_ADDR=payment:${PAYMENT_PORT}
PAYMENT_DOCKERFILE=./src/payment/Dockerfile

# Product Catalog Service
PRODUCT_CATALOG_SERVICE_PORT=3550
PRODUCT_CATALOG_SERVICE_ADDR=productcatalogservice:${PRODUCT_CATALOG_SERVICE_PORT}
PRODUCT_CATALOG_DOCKERFILE=./src/productcatalogservice/Dockerfile
PRODUCT_CATALOG_PORT=3550
PRODUCT_CATALOG_ADDR=product-catalog:${PRODUCT_CATALOG_PORT}
PRODUCT_CATALOG_DOCKERFILE=./src/product-catalog/Dockerfile

# Quote Service
QUOTE_PORT=8090
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/component-build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ jobs:
tag_suffix: payment
context: ./
setup-qemu: true
- file: ./src/productcatalogservice/Dockerfile
tag_suffix: productcatalogservice
- file: ./src/product-catalog/Dockerfile
tag_suffix: product-catalog
context: ./
setup-qemu: true
- file: ./src/quote/Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion .licenserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"src/checkoutservice/genproto/",
"src/featureflagservice/assets/vendor/",
"src/featureflagservice/priv/",
"src/productcatalogservice/genproto/",
"src/product-catalog/genproto/",
"src/react-native-app/ios/Pods/",
"src/react-native-app/ios/build/",
"src/react-native-app/android/app/build/",
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ the release.
([#1863](https://github.com/open-telemetry/opentelemetry-demo/pull/1863))
* [recommendation] rename recommendationservice to recommendation
([#1865](https://github.com/open-telemetry/opentelemetry-demo/pull/1865))
* [product-catalog] rename productcatalogservice to product-catalog
([#1864](https://github.com/open-telemetry/opentelemetry-demo/pull/1864))

## 1.12.0

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ docker-generate-protobuf:

.PHONY: clean
clean:
rm -rf ./src/{checkoutservice,productcatalogservice}/genproto/oteldemo/
rm -rf ./src/{checkoutservice,product-catalog}/genproto/oteldemo/
rm -rf ./src/recommendation/{demo_pb2,demo_pb2_grpc}.py

.PHONY: check-clean-work-tree
Expand Down
4 changes: 2 additions & 2 deletions docker-compose-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ services:
- EMAIL_ADDR
- FRONTEND_ADDR
- PAYMENT_ADDR
- PRODUCT_CATALOG_SERVICE_ADDR
- PRODUCT_CATALOG_ADDR
- RECOMMENDATION_ADDR
- SHIPPING_ADDR
- KAFKA_SERVICE_ADDR
Expand Down Expand Up @@ -75,7 +75,7 @@ services:
condition: service_started
payment:
condition: service_started
productcatalogservice:
product-catalog:
condition: service_started
quote:
condition: service_started
Expand Down
26 changes: 13 additions & 13 deletions docker-compose.minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ services:
- EMAIL_ADDR
- FLAGD_HOST
- PAYMENT_ADDR
- PRODUCT_CATALOG_SERVICE_ADDR
- PRODUCT_CATALOG_ADDR
- SHIPPING_ADDR
- OTEL_EXPORTER_OTLP_ENDPOINT
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
Expand All @@ -118,7 +118,7 @@ services:
condition: service_started
payment:
condition: service_started
productcatalogservice:
product-catalog:
condition: service_started
shipping:
condition: service_started
Expand Down Expand Up @@ -203,7 +203,7 @@ services:
- CART_ADDR
- CHECKOUT_SERVICE_ADDR
- CURRENCY_ADDR
- PRODUCT_CATALOG_SERVICE_ADDR
- PRODUCT_CATALOG_ADDR
- RECOMMENDATION_ADDR
- SHIPPING_ADDR
- OTEL_EXPORTER_OTLP_ENDPOINT
Expand All @@ -225,7 +225,7 @@ services:
condition: service_started
currency:
condition: service_started
productcatalogservice:
product-catalog:
condition: service_started
quote:
condition: service_started
Expand Down Expand Up @@ -379,28 +379,28 @@ services:
logging: *logging

# Product Catalog service
productcatalogservice:
image: ${IMAGE_NAME}:${DEMO_VERSION}-productcatalogservice
container_name: product-catalog-service
product-catalog:
image: ${IMAGE_NAME}:${DEMO_VERSION}-product-catalog
container_name: product-catalog
build:
context: ./
dockerfile: ${PRODUCT_CATALOG_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-productcatalogservice
- ${IMAGE_NAME}:${IMAGE_VERSION}-product-catalog
deploy:
resources:
limits:
memory: 20M
restart: unless-stopped
ports:
- "${PRODUCT_CATALOG_SERVICE_PORT}"
- "${PRODUCT_CATALOG_PORT}"
environment:
- FLAGD_HOST
- PRODUCT_CATALOG_SERVICE_PORT
- PRODUCT_CATALOG_PORT
- OTEL_EXPORTER_OTLP_ENDPOINT
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=productcatalogservice
- OTEL_SERVICE_NAME=product-catalog
depends_on:
otel-collector:
condition: service_started
Expand Down Expand Up @@ -453,15 +453,15 @@ services:
environment:
- FLAGD_HOST
- RECOMMENDATION_PORT
- PRODUCT_CATALOG_SERVICE_ADDR
- PRODUCT_CATALOG_ADDR
- OTEL_PYTHON_LOG_CORRELATION=true
- OTEL_EXPORTER_OTLP_ENDPOINT
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=recommendation
- PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
depends_on:
productcatalogservice:
product-catalog:
condition: service_started
otel-collector:
condition: service_started
Expand Down
26 changes: 13 additions & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ services:
- CURRENCY_ADDR
- EMAIL_ADDR
- PAYMENT_ADDR
- PRODUCT_CATALOG_SERVICE_ADDR
- PRODUCT_CATALOG_ADDR
- SHIPPING_ADDR
- KAFKA_SERVICE_ADDR
- OTEL_EXPORTER_OTLP_ENDPOINT
Expand All @@ -152,7 +152,7 @@ services:
condition: service_started
payment:
condition: service_started
productcatalogservice:
product-catalog:
condition: service_started
shipping:
condition: service_started
Expand Down Expand Up @@ -275,7 +275,7 @@ services:
- CART_ADDR
- CHECKOUT_SERVICE_ADDR
- CURRENCY_ADDR
- PRODUCT_CATALOG_SERVICE_ADDR
- PRODUCT_CATALOG_ADDR
- RECOMMENDATION_ADDR
- SHIPPING_ADDR
- OTEL_EXPORTER_OTLP_ENDPOINT
Expand All @@ -297,7 +297,7 @@ services:
condition: service_started
currency:
condition: service_started
productcatalogservice:
product-catalog:
condition: service_started
quote:
condition: service_started
Expand Down Expand Up @@ -458,29 +458,29 @@ services:
logging: *logging

# Product Catalog service
productcatalogservice:
image: ${IMAGE_NAME}:${DEMO_VERSION}-productcatalogservice
container_name: product-catalog-service
product-catalog:
image: ${IMAGE_NAME}:${DEMO_VERSION}-product-catalog
container_name: product-catalog
build:
context: ./
dockerfile: ${PRODUCT_CATALOG_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-productcatalogservice
- ${IMAGE_NAME}:${IMAGE_VERSION}-product-catalog
deploy:
resources:
limits:
memory: 20M
restart: unless-stopped
ports:
- "${PRODUCT_CATALOG_SERVICE_PORT}"
- "${PRODUCT_CATALOG_PORT}"
environment:
- PRODUCT_CATALOG_SERVICE_PORT
- PRODUCT_CATALOG_PORT
- FLAGD_HOST
- FLAGD_PORT
- OTEL_EXPORTER_OTLP_ENDPOINT
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=productcatalogservice
- OTEL_SERVICE_NAME=product-catalog
depends_on:
otel-collector:
condition: service_started
Expand Down Expand Up @@ -534,7 +534,7 @@ services:
- "${RECOMMENDATION_PORT}"
environment:
- RECOMMENDATION_PORT
- PRODUCT_CATALOG_SERVICE_ADDR
- PRODUCT_CATALOG_ADDR
- FLAGD_HOST
- FLAGD_PORT
- OTEL_PYTHON_LOG_CORRELATION=true
Expand All @@ -544,7 +544,7 @@ services:
- OTEL_SERVICE_NAME=recommendation
- PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
depends_on:
productcatalogservice:
product-catalog:
condition: service_started
otel-collector:
condition: service_started
Expand Down
2 changes: 1 addition & 1 deletion docker-gen-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if [ -z "$1" ]; then
#gen_proto_ruby email
#gen_proto_ts frontend
#gen_proto_js payment
gen_proto_go productcatalogservice
gen_proto_go product-catalog
#gen_proto_php quote
gen_proto_python recommendation
#gen_proto_rust shipping
Expand Down
2 changes: 1 addition & 1 deletion ide-gen-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ gen_proto_go checkoutservice
gen_proto_ts frontend
gen_proto_ts react-native-app
gen_proto_js payment
gen_proto_go productcatalogservice
gen_proto_go product-catalog
# gen_proto_php quote
gen_proto_python recommendation
gen_proto_rust shipping
4 changes: 2 additions & 2 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
"groupName": "payment",
},
{
"matchFileNames": ["src/productcatalogservice/**"],
"groupName": "productcatalogservice",
"matchFileNames": ["src/product-catalog/**"],
"groupName": "product-catalog",
},
{
"matchFileNames": ["src/prometheus/**"],
Expand Down
2 changes: 1 addition & 1 deletion src/checkoutservice/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func main() {
svc.shippingSvcClient = pb.NewShippingServiceClient(c)
defer c.Close()

mustMapEnv(&svc.productCatalogSvcAddr, "PRODUCT_CATALOG_SERVICE_ADDR")
mustMapEnv(&svc.productCatalogSvcAddr, "PRODUCT_CATALOG_ADDR")
c = mustCreateClient(svc.productCatalogSvcAddr)
svc.productCatalogSvcClient = pb.NewProductCatalogServiceClient(c)
defer c.Close()
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/gateways/rpc/ProductCatalog.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import { ChannelCredentials } from '@grpc/grpc-js';
import { ListProductsResponse, Product, ProductCatalogServiceClient } from '../../protos/demo';

const { PRODUCT_CATALOG_SERVICE_ADDR = '' } = process.env;
const { PRODUCT_CATALOG_ADDR = '' } = process.env;

const client = new ProductCatalogServiceClient(PRODUCT_CATALOG_SERVICE_ADDR, ChannelCredentials.createInsecure());
const client = new ProductCatalogServiceClient(PRODUCT_CATALOG_ADDR, ChannelCredentials.createInsecure());

const ProductCatalogGateway = () => ({
listProducts() {
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const {
CART_ADDR = '',
CHECKOUT_SERVICE_ADDR = '',
CURRENCY_ADDR = '',
PRODUCT_CATALOG_SERVICE_ADDR = '',
PRODUCT_CATALOG_ADDR = '',
RECOMMENDATION_ADDR = '',
SHIPPING_ADDR = '',
ENV_PLATFORM = '',
Expand Down Expand Up @@ -49,7 +49,7 @@ const nextConfig = {
CART_ADDR,
CHECKOUT_SERVICE_ADDR,
CURRENCY_ADDR,
PRODUCT_CATALOG_SERVICE_ADDR,
PRODUCT_CATALOG_ADDR,
RECOMMENDATION_ADDR,
SHIPPING_ADDR,
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT,
Expand Down
27 changes: 27 additions & 0 deletions src/product-catalog/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0


FROM golang:1.22-alpine AS builder

WORKDIR /usr/src/app/

RUN --mount=type=cache,target=/go/pkg/mod/ \
--mount=type=bind,source=./src/product-catalog/go.sum,target=go.sum \
--mount=type=bind,source=./src/product-catalog/go.mod,target=go.mod \
go mod download

RUN --mount=type=cache,target=/go/pkg/mod/ \
--mount=type=cache,target=/root/.cache/go-build \
--mount=type=bind,rw,source=./src/product-catalog,target=. \
go build -ldflags "-s -w" -o /go/bin/product-catalog/ ./

FROM alpine AS release

WORKDIR /usr/src/app/

COPY ./src/product-catalog/products/ ./products/
COPY --from=builder /go/bin/product-catalog/ ./

EXPOSE ${PRODUCT_CATALOG_PORT}
ENTRYPOINT [ "./product-catalog" ]
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ When this service is run the output should be similar to the following
To build the service binary, run:

```sh
go build -o /go/bin/productcatalogservice/
go build -o /go/bin/product-catalog/
```

## Docker Build

From the root directory, run:

```sh
docker compose build productcatalogservice
docker compose build product-catalog
```

## Regenerate protos
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ WORKDIR /build

RUN apk add --no-cache protobuf-dev

COPY ./src/productcatalogservice/go.mod ./
COPY ./src/productcatalogservice/go.sum ./
COPY ./src/productcatalogservice/tools.go ./
COPY ./src/product-catalog/go.mod ./
COPY ./src/product-catalog/go.sum ./
COPY ./src/product-catalog/tools.go ./

RUN go env -w GOMODCACHE=/root/.cache/go-build
RUN --mount=type=cache,target=/root/.cache/go-build \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/opentelemetry/opentelemetry-demo/src/productcatalogservice
module github.com/opentelemetry/opentelemetry-demo/src/product-catalog

go 1.22.7

Expand Down
File renamed without changes.
Loading

0 comments on commit 8cb101d

Please sign in to comment.