Skip to content

Commit

Permalink
[cart]: rename cartservice to cart (#1839)
Browse files Browse the repository at this point in the history
* rename cartservice to cart

* rename cartservice to cart

* Update CHANGELOG.md

* Rename cart test folder

* typo

---------

Co-authored-by: Juliano Costa <[email protected]>
Co-authored-by: Juliano Costa <[email protected]>
  • Loading branch information
3 people authored Dec 19, 2024
1 parent a0897a6 commit 4f8ddef
Show file tree
Hide file tree
Showing 34 changed files with 71 additions and 69 deletions.
6 changes: 3 additions & 3 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ AD_ADDR=ad:${AD_PORT}
AD_DOCKERFILE=./src/ad/Dockerfile

# Cart Service
CART_SERVICE_PORT=7070
CART_SERVICE_ADDR=cartservice:${CART_SERVICE_PORT}
CART_SERVICE_DOCKERFILE=./src/cartservice/src/Dockerfile
CART_PORT=7070
CART_ADDR=cart:${CART_PORT}
CART_DOCKERFILE=./src/cart/src/Dockerfile

# Checkout Service
CHECKOUT_SERVICE_PORT=5050
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 @@ -59,8 +59,8 @@ jobs:
tag_suffix: ad
context: ./
setup-qemu: true
- file: ./src/cartservice/src/Dockerfile
tag_suffix: cartservice
- file: ./src/cart/src/Dockerfile
tag_suffix: cart
context: ./
setup-qemu: false
- file: ./src/checkoutservice/Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ test/tracetesting/tracetesting-vars.yaml

# Ignore copied/generated protobuf files
/src/accounting/src/protos/
/src/cartservice/src/protos/
/src/cart/src/protos/
/src/featureflagservice/proto/
/src/featureflagservice/src/ffs_demo_pb.erl
/src/featureflagservice/src/ffs_service_*.erl
Expand Down
4 changes: 2 additions & 2 deletions .licenserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
"ignore": [
"node_modules/",
"/src/accounting/src/protos/",
"src/cartservice/src/obj/",
"src/cartservice/tests/obj/",
"src/cart/src/obj/",
"src/cart/tests/obj/",
"src/checkoutservice/genproto/",
"src/featureflagservice/assets/vendor/",
"src/featureflagservice/priv/",
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ the release.
([#1840](https://github.com/open-telemetry/opentelemetry-demo/pull/1840))
* [otel-collector] rename otelcol to otel-collector
([#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))

## 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 @@ -38,7 +38,7 @@ services:
TRACETEST_IMAGE_VERSION: ${TRACETEST_IMAGE_VERSION}
environment:
- AD_ADDR
- CART_SERVICE_ADDR
- CART_ADDR
- CHECKOUT_SERVICE_ADDR
- CURRENCY_SERVICE_ADDR
- EMAIL_SERVICE_ADDR
Expand All @@ -61,7 +61,7 @@ services:
condition: service_started
ad:
condition: service_started
cartservice:
cart:
condition: service_started
checkoutservice:
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 @@ -50,29 +50,29 @@ services:
logging: *logging

# Cart service
cartservice:
image: ${IMAGE_NAME}:${DEMO_VERSION}-cartservice
cart:
image: ${IMAGE_NAME}:${DEMO_VERSION}-cart
container_name: cart-service
build:
context: ./
dockerfile: ${CART_SERVICE_DOCKERFILE}
dockerfile: ${CART_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-cartservice
- ${IMAGE_NAME}:${IMAGE_VERSION}-cart
deploy:
resources:
limits:
memory: 160M
restart: unless-stopped
ports:
- "${CART_SERVICE_PORT}"
- "${CART_PORT}"
environment:
- CART_SERVICE_PORT
- CART_PORT
- FLAGD_HOST
- VALKEY_ADDR
- OTEL_EXPORTER_OTLP_ENDPOINT
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=cartservice
- ASPNETCORE_URLS=http://*:${CART_SERVICE_PORT}
- OTEL_SERVICE_NAME=cart
- ASPNETCORE_URLS=http://*:${CART_PORT}
depends_on:
valkey-cart:
condition: service_started
Expand All @@ -98,7 +98,7 @@ services:
- "${CHECKOUT_SERVICE_PORT}"
environment:
- CHECKOUT_SERVICE_PORT
- CART_SERVICE_ADDR
- CART_ADDR
- CURRENCY_SERVICE_ADDR
- EMAIL_SERVICE_ADDR
- FLAGD_HOST
Expand All @@ -110,7 +110,7 @@ services:
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=checkoutservice
depends_on:
cartservice:
cart:
condition: service_started
currencyservice:
condition: service_started
Expand Down Expand Up @@ -200,7 +200,7 @@ services:
- PORT=${FRONTEND_PORT}
- FRONTEND_ADDR
- AD_ADDR
- CART_SERVICE_ADDR
- CART_ADDR
- CHECKOUT_SERVICE_ADDR
- CURRENCY_SERVICE_ADDR
- PRODUCT_CATALOG_SERVICE_ADDR
Expand All @@ -219,7 +219,7 @@ services:
depends_on:
ad:
condition: service_started
cartservice:
cart:
condition: service_started
checkoutservice:
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 @@ -79,30 +79,30 @@ services:
logging: *logging

# Cart service
cartservice:
image: ${IMAGE_NAME}:${DEMO_VERSION}-cartservice
cart:
image: ${IMAGE_NAME}:${DEMO_VERSION}-cart
container_name: cart-service
build:
context: ./
dockerfile: ${CART_SERVICE_DOCKERFILE}
dockerfile: ${CART_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-cartservice
- ${IMAGE_NAME}:${IMAGE_VERSION}-cart
deploy:
resources:
limits:
memory: 160M
restart: unless-stopped
ports:
- "${CART_SERVICE_PORT}"
- "${CART_PORT}"
environment:
- CART_SERVICE_PORT
- CART_PORT
- FLAGD_HOST
- FLAGD_PORT
- VALKEY_ADDR
- OTEL_EXPORTER_OTLP_ENDPOINT
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=cartservice
- ASPNETCORE_URLS=http://*:${CART_SERVICE_PORT}
- OTEL_SERVICE_NAME=cart
- ASPNETCORE_URLS=http://*:${CART_PORT}
depends_on:
valkey-cart:
condition: service_started
Expand Down Expand Up @@ -132,7 +132,7 @@ services:
- FLAGD_HOST
- FLAGD_PORT
- CHECKOUT_SERVICE_PORT
- CART_SERVICE_ADDR
- CART_ADDR
- CURRENCY_SERVICE_ADDR
- EMAIL_SERVICE_ADDR
- PAYMENT_SERVICE_ADDR
Expand All @@ -144,7 +144,7 @@ services:
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=checkoutservice
depends_on:
cartservice:
cart:
condition: service_started
currencyservice:
condition: service_started
Expand Down Expand Up @@ -272,7 +272,7 @@ services:
- PORT=${FRONTEND_PORT}
- FRONTEND_ADDR
- AD_ADDR
- CART_SERVICE_ADDR
- CART_ADDR
- CHECKOUT_SERVICE_ADDR
- CURRENCY_SERVICE_ADDR
- PRODUCT_CATALOG_SERVICE_ADDR
Expand All @@ -291,7 +291,7 @@ services:
depends_on:
ad:
condition: service_started
cartservice:
cart:
condition: service_started
checkoutservice:
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 @@ -23,7 +23,7 @@ gen_proto_python() {

#gen_proto_dotnet accounting
#gen_proto_java ad
#gen_proto_dotnet cartservice
#gen_proto_dotnet cart
gen_proto_go checkoutservice
#gen_proto_cpp currencyservice
#gen_proto_ruby emailservice
Expand Down
2 changes: 1 addition & 1 deletion ide-gen-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ gen_proto_ts() {

gen_proto_dotnet accounting
# gen_proto_java ad
gen_proto_dotnet cartservice
gen_proto_dotnet cart
gen_proto_go checkoutservice
# gen_proto_cpp currencyservice
# gen_proto_ruby emailservice
Expand Down
4 changes: 2 additions & 2 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"groupName": "ad",
},
{
"matchFileNames": ["src/cartservice/**"],
"groupName": "cartservice",
"matchFileNames": ["src/cart/**"],
"groupName": "cart",
},
{
"matchFileNames": ["src/checkoutservice/**"],
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/cartservice/README.md → src/cart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ Run `dotnet restore` and `dotnet build`.
From the root directory of this repository, run:

```sh
docker compose build cartservice
docker compose build cart
```
4 changes: 2 additions & 2 deletions src/cartservice/cartservice.sln → src/cart/cart.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cartservice", "src\cartservice.csproj", "{2348C29F-E8D3-4955-916D-D609CBC97FCB}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cart", "src\cart.csproj", "{2348C29F-E8D3-4955-916D-D609CBC97FCB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cartservice.tests", "tests\cartservice.tests.csproj", "{59825342-CE64-4AFA-8744-781692C0811B}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cart.tests", "tests\cart.tests.csproj", "{59825342-CE64-4AFA-8744-781692C0811B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions src/cartservice/src/Dockerfile → src/cart/src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ ARG TARGETARCH

WORKDIR /usr/src/app/

COPY ./src/cartservice/ ./
COPY ./src/cart/ ./
COPY ./pb/ ./pb/

RUN dotnet restore ./src/cartservice.csproj -r linux-musl-$TARGETARCH
RUN dotnet restore ./src/cart.csproj -r linux-musl-$TARGETARCH

RUN dotnet publish ./src/cartservice.csproj -r linux-musl-$TARGETARCH --no-restore -o /cartservice
RUN dotnet publish ./src/cart.csproj -r linux-musl-$TARGETARCH --no-restore -o /cart

# -----------------------------------------------------------------------------

# https://mcr.microsoft.com/v2/dotnet/runtime-deps/tags/list
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0-alpine3.20

WORKDIR /usr/src/app/
COPY --from=builder /cartservice/ ./
COPY --from=builder /cart/ ./

ENV DOTNET_HOSTBUILDER__RELOADCONFIGONCHANGE=false

EXPOSE ${CART_SERVICE_PORT}
ENTRYPOINT [ "./cartservice" ]
EXPOSE ${CART_PORT}
ENTRYPOINT [ "./cart" ]
4 changes: 2 additions & 2 deletions src/cartservice/src/Program.cs → src/cart/src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// SPDX-License-Identifier: Apache-2.0
using System;

using cartservice.cartstore;
using cartservice.services;
using cart.cartstore;
using cart.services;

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
using System.Threading.Tasks;

namespace cartservice.cartstore;
namespace cart.cartstore;

public interface ICartStore
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using System.Diagnostics.Metrics;
using System.Diagnostics;

namespace cartservice.cartstore;
namespace cart.cartstore;

public class ValkeyCartStore : ICartStore
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
using System.Threading.Tasks;
using System;
using Grpc.Core;
using cartservice.cartstore;
using cart.cartstore;
using OpenFeature;
using Oteldemo;

namespace cartservice.services;
namespace cart.services;

public class CartService : Oteldemo.CartService.CartServiceBase
{
Expand Down Expand Up @@ -80,7 +80,7 @@ public override async Task<Empty> EmptyCart(EmptyCartRequest request, ServerCall

try
{
if (await _featureFlagHelper.GetBooleanValueAsync("cartServiceFailure", false))
if (await _featureFlagHelper.GetBooleanValueAsync("cartFailure", false))
{
await _badCartStore.EmptyCartAsync(request.UserId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using Xunit;
using static Oteldemo.CartService;

namespace cartservice.tests;
namespace cart.tests;

public class CartServiceTests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\src\cartservice.csproj" />
<ProjectReference Include="..\src\cart.csproj" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/checkoutservice/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func main() {
svc.productCatalogSvcClient = pb.NewProductCatalogServiceClient(c)
defer c.Close()

mustMapEnv(&svc.cartSvcAddr, "CART_SERVICE_ADDR")
mustMapEnv(&svc.cartSvcAddr, "CART_ADDR")
c = mustCreateClient(svc.cartSvcAddr)
svc.cartSvcClient = pb.NewCartServiceClient(c)
defer c.Close()
Expand Down
2 changes: 1 addition & 1 deletion src/flagd/demo.flagd.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
},
"defaultVariant": "off"
},
"cartServiceFailure": {
"cartFailure": {
"description": "Fail cart service",
"state": "ENABLED",
"variants": {
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/gateways/rpc/Cart.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 { Cart, CartItem, CartServiceClient, Empty } from '../../protos/demo';

const { CART_SERVICE_ADDR = '' } = process.env;
const { CART_ADDR = '' } = process.env;

const client = new CartServiceClient(CART_SERVICE_ADDR, ChannelCredentials.createInsecure());
const client = new CartServiceClient(CART_ADDR, ChannelCredentials.createInsecure());

const CartGateway = () => ({
getCart(userId: string) {
Expand Down
Loading

0 comments on commit 4f8ddef

Please sign in to comment.