Skip to content

Commit

Permalink
[shipping] rename shippingservice to shipping (#1842)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sozhan308 authored Dec 19, 2024
1 parent 623c0e4 commit fca8fd1
Show file tree
Hide file tree
Showing 33 changed files with 64 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ src/*/*/Dockerfile

###################################
# shippingservice
./src/shippingservice/target
./src/shipping/target
###################################

# Mix artifacts
Expand Down
6 changes: 3 additions & 3 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ RECOMMENDATION_SERVICE_ADDR=recommendationservice:${RECOMMENDATION_SERVICE_PORT}
RECOMMENDATION_SERVICE_DOCKERFILE=./src/recommendationservice/Dockerfile

# Shipping Service
SHIPPING_SERVICE_PORT=50050
SHIPPING_SERVICE_ADDR=shippingservice:${SHIPPING_SERVICE_PORT}
SHIPPING_SERVICE_DOCKERFILE=./src/shippingservice/Dockerfile
SHIPPING_PORT=50050
SHIPPING_ADDR=shipping:${SHIPPING_PORT}
SHIPPING_DOCKERFILE=./src/shipping/Dockerfile

# ******************
# Dependent Services
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 @@ -119,8 +119,8 @@ jobs:
tag_suffix: recommendationservice
context: ./
setup-qemu: true
- file: ./src/shippingservice/Dockerfile
tag_suffix: shippingservice
- file: ./src/shipping/Dockerfile
tag_suffix: shipping
context: ./
setup-qemu: true
- file: ./src/flagd-ui/Dockerfile
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ composer.lock

src/frontend/cypress/videos
src/frontend/cypress/screenshots
src/shippingservice/target/
src/shipping/target/
test/tracetesting/tracetesting-vars.yaml

# Ignore copied/generated protobuf files
Expand All @@ -53,5 +53,5 @@ test/tracetesting/tracetesting-vars.yaml
/src/frontend/pb/
/src/frontend/protos/
/src/paymentservice/demo.proto
/src/shippingservice/proto/
/src/shipping/proto/
/src/currencyservice/proto
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ the release.
([#1841](https://github.com/open-telemetry/opentelemetry-demo/pull/1841))
* [cart] rename cartservice to cart
([#1839](https://github.com/open-telemetry/opentelemetry-demo/pull/1839))
* [shipping] rename shippingservice to shipping
([#1842](https://github.com/open-telemetry/opentelemetry-demo/pull/1842))

## 1.12.0

Expand Down
4 changes: 2 additions & 2 deletions docker-compose-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ services:
- PAYMENT_SERVICE_ADDR
- PRODUCT_CATALOG_SERVICE_ADDR
- RECOMMENDATION_SERVICE_ADDR
- SHIPPING_SERVICE_ADDR
- SHIPPING_ADDR
- KAFKA_SERVICE_ADDR
extra_hosts:
- "host.docker.internal:host-gateway"
Expand Down Expand Up @@ -81,7 +81,7 @@ services:
condition: service_started
recommendationservice:
condition: service_started
shippingservice:
shipping:
condition: service_started
flagd:
condition: service_started
Expand Down
24 changes: 12 additions & 12 deletions docker-compose.minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ services:
- FLAGD_HOST
- PAYMENT_SERVICE_ADDR
- PRODUCT_CATALOG_SERVICE_ADDR
- SHIPPING_SERVICE_ADDR
- SHIPPING_ADDR
- OTEL_EXPORTER_OTLP_ENDPOINT
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
- OTEL_RESOURCE_ATTRIBUTES
Expand All @@ -120,7 +120,7 @@ services:
condition: service_started
productcatalogservice:
condition: service_started
shippingservice:
shipping:
condition: service_started
otel-collector:
condition: service_started
Expand Down Expand Up @@ -205,7 +205,7 @@ services:
- CURRENCY_SERVICE_ADDR
- PRODUCT_CATALOG_SERVICE_ADDR
- RECOMMENDATION_SERVICE_ADDR
- SHIPPING_SERVICE_ADDR
- SHIPPING_ADDR
- OTEL_EXPORTER_OTLP_ENDPOINT
- OTEL_RESOURCE_ATTRIBUTES=${OTEL_RESOURCE_ATTRIBUTES}
- ENV_PLATFORM
Expand All @@ -231,7 +231,7 @@ services:
condition: service_started
recommendationservice:
condition: service_started
shippingservice:
shipping:
condition: service_started
otel-collector:
condition: service_started
Expand Down Expand Up @@ -468,27 +468,27 @@ services:
logging: *logging

# Shipping service
shippingservice:
image: ${IMAGE_NAME}:${DEMO_VERSION}-shippingservice
container_name: shipping-service
shipping:
image: ${IMAGE_NAME}:${DEMO_VERSION}-shipping
container_name: shipping
build:
context: ./
dockerfile: ${SHIPPING_SERVICE_DOCKERFILE}
dockerfile: ${SHIPPING_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-shippingservice
- ${IMAGE_NAME}:${IMAGE_VERSION}-shipping
deploy:
resources:
limits:
memory: 20M
restart: unless-stopped
ports:
- "${SHIPPING_SERVICE_PORT}"
- "${SHIPPING_PORT}"
environment:
- SHIPPING_SERVICE_PORT
- SHIPPING_PORT
- QUOTE_ADDR
- OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_GRPC}
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=shippingservice
- OTEL_SERVICE_NAME=shipping
depends_on:
otel-collector:
condition: service_started
Expand Down
24 changes: 12 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ services:
- EMAIL_SERVICE_ADDR
- PAYMENT_SERVICE_ADDR
- PRODUCT_CATALOG_SERVICE_ADDR
- SHIPPING_SERVICE_ADDR
- SHIPPING_ADDR
- KAFKA_SERVICE_ADDR
- OTEL_EXPORTER_OTLP_ENDPOINT
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
Expand All @@ -154,7 +154,7 @@ services:
condition: service_started
productcatalogservice:
condition: service_started
shippingservice:
shipping:
condition: service_started
otel-collector:
condition: service_started
Expand Down Expand Up @@ -277,7 +277,7 @@ services:
- CURRENCY_SERVICE_ADDR
- PRODUCT_CATALOG_SERVICE_ADDR
- RECOMMENDATION_SERVICE_ADDR
- SHIPPING_SERVICE_ADDR
- SHIPPING_ADDR
- OTEL_EXPORTER_OTLP_ENDPOINT
- OTEL_RESOURCE_ATTRIBUTES=${OTEL_RESOURCE_ATTRIBUTES}
- ENV_PLATFORM
Expand All @@ -303,7 +303,7 @@ services:
condition: service_started
recommendationservice:
condition: service_started
shippingservice:
shipping:
condition: service_started
otel-collector:
condition: service_started
Expand Down Expand Up @@ -553,27 +553,27 @@ services:
logging: *logging

# Shipping service
shippingservice:
image: ${IMAGE_NAME}:${DEMO_VERSION}-shippingservice
container_name: shipping-service
shipping:
image: ${IMAGE_NAME}:${DEMO_VERSION}-shipping
container_name: shipping
build:
context: ./
dockerfile: ${SHIPPING_SERVICE_DOCKERFILE}
dockerfile: ${SHIPPING_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-shippingservice
- ${IMAGE_NAME}:${IMAGE_VERSION}-shipping
deploy:
resources:
limits:
memory: 20M
restart: unless-stopped
ports:
- "${SHIPPING_SERVICE_PORT}"
- "${SHIPPING_PORT}"
environment:
- SHIPPING_SERVICE_PORT
- SHIPPING_PORT
- QUOTE_ADDR
- OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_GRPC}
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=shippingservice
- OTEL_SERVICE_NAME=shipping
depends_on:
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 @@ -32,4 +32,4 @@ gen_proto_go checkoutservice
gen_proto_go productcatalogservice
#gen_proto_php quote
gen_proto_python recommendationservice
#gen_proto_rust shippingservice
#gen_proto_rust shipping
2 changes: 1 addition & 1 deletion ide-gen-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ gen_proto_js paymentservice
gen_proto_go productcatalogservice
# gen_proto_php quote
gen_proto_python recommendationservice
gen_proto_rust shippingservice
gen_proto_rust shipping
4 changes: 2 additions & 2 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@
"groupName": "recommendationservice",
},
{
"matchFileNames": ["src/shippingservice/**"],
"groupName": "shippingservice",
"matchFileNames": ["src/shipping/**"],
"groupName": "shipping",
},
{
// intentionally using Java 11 in some examples
Expand Down
2 changes: 1 addition & 1 deletion src/checkoutservice/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func main() {

svc := new(checkoutService)

mustMapEnv(&svc.shippingSvcAddr, "SHIPPING_SERVICE_ADDR")
mustMapEnv(&svc.shippingSvcAddr, "SHIPPING_ADDR")
c := mustCreateClient(svc.shippingSvcAddr)
svc.shippingSvcClient = pb.NewShippingServiceClient(c)
defer c.Close()
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/gateways/rpc/Shipping.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 { Address, CartItem, GetQuoteResponse, ShippingServiceClient } from '../../protos/demo';

const { SHIPPING_SERVICE_ADDR = '' } = process.env;
const { SHIPPING_ADDR = '' } = process.env;

const client = new ShippingServiceClient(SHIPPING_SERVICE_ADDR, ChannelCredentials.createInsecure());
const client = new ShippingServiceClient(SHIPPING_ADDR, ChannelCredentials.createInsecure());

const ShippingGateway = () => ({
getShippingCost(itemList: CartItem[], address: Address) {
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 @@ -19,7 +19,7 @@ const {
CURRENCY_SERVICE_ADDR = '',
PRODUCT_CATALOG_SERVICE_ADDR = '',
RECOMMENDATION_SERVICE_ADDR = '',
SHIPPING_SERVICE_ADDR = '',
SHIPPING_ADDR = '',
ENV_PLATFORM = '',
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT = '',
OTEL_SERVICE_NAME = 'frontend',
Expand Down Expand Up @@ -51,7 +51,7 @@ const nextConfig = {
CURRENCY_SERVICE_ADDR,
PRODUCT_CATALOG_SERVICE_ADDR,
RECOMMENDATION_SERVICE_ADDR,
SHIPPING_SERVICE_ADDR,
SHIPPING_ADDR,
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT,
NEXT_PUBLIC_PLATFORM: ENV_PLATFORM,
NEXT_PUBLIC_OTEL_SERVICE_NAME: OTEL_SERVICE_NAME,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/shippingservice/Cargo.lock → src/shipping/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/shippingservice/Cargo.toml → src/shipping/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@


[package]
name = "shippingservice"
name = "shipping"
version = "1.8.0"
edition = "2021"

[[bin]]
name = "shippingservice"
name = "shipping"
path = "src/main.rs"

[features]
Expand Down
12 changes: 6 additions & 6 deletions src/shippingservice/Dockerfile → src/shipping/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ RUN if [ "${TARGETPLATFORM}" = "${BUILDPLATFORM}" ] ; then \

WORKDIR /app/

COPY /src/shippingservice/ /app/
COPY /src/shipping/ /app/
COPY /pb/ /app/proto/

# Compile or crosscompile
Expand All @@ -38,13 +38,13 @@ RUN if [ "${TARGETPLATFORM}" = "${BUILDPLATFORM}" ] ; then \
CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc \
CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++ \
cargo build -r --features="dockerproto" --target aarch64-unknown-linux-gnu && \
cp /app/target/aarch64-unknown-linux-gnu/release/shippingservice /app/target/release/shippingservice; \
cp /app/target/aarch64-unknown-linux-gnu/release/shipping /app/target/release/shipping; \
elif [ "${TARGETPLATFORM}" = "linux/amd64" ] ; then \
env CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-linux-gnu-gcc \
CC_x86_64_unknown_linux_gnu=x86_64-linux-gnu-gcc \
CXX_x86_64_unknown_linux_gnu=x86_64-linux-gnu-g++ \
cargo build -r --features="dockerproto" --target x86_64-unknown-linux-gnu && \
cp /app/target/x86_64-unknown-linux-gnu/release/shippingservice /app/target/release/shippingservice; \
cp /app/target/x86_64-unknown-linux-gnu/release/shipping /app/target/release/shipping; \
else \
echo "${TARGETPLATFORM} is not supported"; \
exit 1; \
Expand All @@ -58,8 +58,8 @@ RUN wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health
FROM debian:bookworm-slim AS release

WORKDIR /app
COPY --from=builder /app/target/release/shippingservice /app/shippingservice
COPY --from=builder /app/target/release/shipping /app/shipping
COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe

EXPOSE ${SHIPPING_SERVICE_PORT}
ENTRYPOINT ["/app/shippingservice"]
EXPOSE ${SHIPPING_PORT}
ENTRYPOINT ["/app/shipping"]
2 changes: 1 addition & 1 deletion src/shippingservice/README.md → src/shipping/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ rust [here](https://www.rust-lang.org/tools/install).
From `../../`, run:

```sh
docker compose build shippingservice
docker compose build shipping
```

## Test
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
init_reqwest_tracing(init_tracer()?)?;

info!("OTel pipeline created");
let port = env::var("SHIPPING_SERVICE_PORT").expect("$SHIPPING_SERVICE_PORT is not set");
let port = env::var("SHIPPING_PORT").expect("$SHIPPING_PORT is not set");
let addr = format!("0.0.0.0:{}", port).parse()?;
info!("listening on {}", addr);
let shipper = ShippingServer::default();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl ShippingService for ShippingServer {
// We may want to ask another service for product pricing / info
// (although now everything is assumed to be the same price)
// check out the create_quote_from_count method to see how we use the span created here
let tracer = global::tracer("shippingservice");
let tracer = global::tracer("shipping");
let mut span = tracer
.span_builder("oteldemo.ShippingService/GetQuote")
.with_kind(SpanKind::Server)
Expand Down Expand Up @@ -125,7 +125,7 @@ impl ShippingService for ShippingServer {
global::get_text_map_propagator(|prop| prop.extract(&MetadataMap(request.metadata())));
// in this case, generating a tracking ID is trivial
// we'll create a span and associated events all in this function.
let tracer = global::tracer("shippingservice");
let tracer = global::tracer("shipping");
let mut span = tracer
.span_builder("oteldemo.ShippingService/ShipOrder")
.with_kind(SpanKind::Server)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions test/tracetesting/run.bash
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
set -e

# Availalble services to test
ALL_SERVICES=("ad" "cart" "currencyservice" "checkoutservice" "frontend" "emailservice" "paymentservice" "productcatalogservice" "recommendationservice" "shippingservice")
ALL_SERVICES=("ad" "cart" "currencyservice" "checkoutservice" "frontend" "emailservice" "paymentservice" "productcatalogservice" "recommendationservice" "shipping")

## Script variables
# Will contain the list of services to test
Expand Down Expand Up @@ -52,8 +52,8 @@ spec:
value: $PRODUCT_CATALOG_SERVICE_ADDR
- key: RECOMMENDATION_SERVICE_ADDR
value: $RECOMMENDATION_SERVICE_ADDR
- key: SHIPPING_SERVICE_ADDR
value: $SHIPPING_SERVICE_ADDR
- key: SHIPPING_ADDR
value: $SHIPPING_ADDR
- key: KAFKA_SERVICE_ADDR
value: $KAFKA_SERVICE_ADDR
EOF
Expand Down
File renamed without changes.
Loading

0 comments on commit fca8fd1

Please sign in to comment.