diff --git a/.env b/.env index b011c764dc..a95b84de56 100644 --- a/.env +++ b/.env @@ -69,9 +69,9 @@ CURRENCY_ADDR=currency:${CURRENCY_PORT} CURRENCY_DOCKERFILE=./src/currency/Dockerfile # Email Service -EMAIL_SERVICE_PORT=6060 -EMAIL_SERVICE_ADDR=http://emailservice:${EMAIL_SERVICE_PORT} -EMAIL_SERVICE_DOCKERFILE=./src/emailservice/Dockerfile +EMAIL_PORT=6060 +EMAIL_ADDR=http://email:${EMAIL_PORT} +EMAIL_DOCKERFILE=./src/email/Dockerfile # Fraud Service FRAUD_SERVICE_DOCKERFILE=./src/frauddetectionservice/Dockerfile diff --git a/.github/workflows/component-build-images.yml b/.github/workflows/component-build-images.yml index 1ebd177346..1e159b54fc 100644 --- a/.github/workflows/component-build-images.yml +++ b/.github/workflows/component-build-images.yml @@ -71,8 +71,8 @@ jobs: tag_suffix: currency context: ./ setup-qemu: true - - file: ./src/emailservice/Dockerfile - tag_suffix: emailservice + - file: ./src/email/Dockerfile + tag_suffix: email context: ./ setup-qemu: true - file: ./src/frauddetectionservice/Dockerfile diff --git a/CHANGELOG.md b/CHANGELOG.md index 886de03eea..9333ed153f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,8 @@ the release. ([#1857](https://github.com/open-telemetry/opentelemetry-demo/pull/1857)) * [currency] rename currencyservice to currency ([#1858](https://github.com/open-telemetry/opentelemetry-demo/pull/1858)) +* [email] rename emailservice to email + ([#1861](https://github.com/open-telemetry/opentelemetry-demo/pull/1861)) ## 1.12.0 diff --git a/docker-compose-tests.yml b/docker-compose-tests.yml index 31fd9a80ab..4e50b6aead 100644 --- a/docker-compose-tests.yml +++ b/docker-compose-tests.yml @@ -41,7 +41,7 @@ services: - CART_ADDR - CHECKOUT_SERVICE_ADDR - CURRENCY_ADDR - - EMAIL_SERVICE_ADDR + - EMAIL_ADDR - FRONTEND_ADDR - PAYMENT_SERVICE_ADDR - PRODUCT_CATALOG_SERVICE_ADDR @@ -67,7 +67,7 @@ services: condition: service_started currency: condition: service_started - emailservice: + email: condition: service_started frauddetectionservice: condition: service_started diff --git a/docker-compose.minimal.yml b/docker-compose.minimal.yml index 0c0b868462..8fe5d0b3c3 100644 --- a/docker-compose.minimal.yml +++ b/docker-compose.minimal.yml @@ -100,7 +100,7 @@ services: - CHECKOUT_SERVICE_PORT - CART_ADDR - CURRENCY_ADDR - - EMAIL_SERVICE_ADDR + - EMAIL_ADDR - FLAGD_HOST - PAYMENT_SERVICE_ADDR - PRODUCT_CATALOG_SERVICE_ADDR @@ -114,7 +114,7 @@ services: condition: service_started currency: condition: service_started - emailservice: + email: condition: service_started paymentservice: condition: service_started @@ -155,26 +155,26 @@ services: logging: *logging # Email service - emailservice: - image: ${IMAGE_NAME}:${DEMO_VERSION}-emailservice + email: + image: ${IMAGE_NAME}:${DEMO_VERSION}-email container_name: email-service build: - context: ./src/emailservice + context: ./src/email cache_from: - - ${IMAGE_NAME}:${IMAGE_VERSION}-emailservice + - ${IMAGE_NAME}:${IMAGE_VERSION}-email deploy: resources: limits: memory: 100M restart: unless-stopped ports: - - "${EMAIL_SERVICE_PORT}" + - "${EMAIL_PORT}" environment: - APP_ENV=production - - EMAIL_SERVICE_PORT + - EMAIL_PORT - OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_HTTP}/v1/traces - OTEL_RESOURCE_ATTRIBUTES - - OTEL_SERVICE_NAME=emailservice + - OTEL_SERVICE_NAME=email depends_on: otel-collector: condition: service_started diff --git a/docker-compose.yml b/docker-compose.yml index 722afe90dc..bac8491189 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -134,7 +134,7 @@ services: - CHECKOUT_SERVICE_PORT - CART_ADDR - CURRENCY_ADDR - - EMAIL_SERVICE_ADDR + - EMAIL_ADDR - PAYMENT_SERVICE_ADDR - PRODUCT_CATALOG_SERVICE_ADDR - SHIPPING_ADDR @@ -148,7 +148,7 @@ services: condition: service_started currency: condition: service_started - emailservice: + email: condition: service_started paymentservice: condition: service_started @@ -193,27 +193,27 @@ services: logging: *logging # Email service - emailservice: - image: ${IMAGE_NAME}:${DEMO_VERSION}-emailservice + email: + image: ${IMAGE_NAME}:${DEMO_VERSION}-email container_name: email-service build: context: ./ - dockerfile: ${EMAIL_SERVICE_DOCKERFILE} + dockerfile: ${EMAIL_DOCKERFILE} cache_from: - - ${IMAGE_NAME}:${IMAGE_VERSION}-emailservice + - ${IMAGE_NAME}:${IMAGE_VERSION}-email deploy: resources: limits: memory: 100M restart: unless-stopped ports: - - "${EMAIL_SERVICE_PORT}" + - "${EMAIL_PORT}" environment: - APP_ENV=production - - EMAIL_SERVICE_PORT + - EMAIL_PORT - OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_HTTP}/v1/traces - OTEL_RESOURCE_ATTRIBUTES - - OTEL_SERVICE_NAME=emailservice + - OTEL_SERVICE_NAME=email depends_on: otel-collector: condition: service_started diff --git a/docker-gen-proto.sh b/docker-gen-proto.sh index 80fa1f8634..dfd16526e5 100755 --- a/docker-gen-proto.sh +++ b/docker-gen-proto.sh @@ -26,7 +26,7 @@ gen_proto_python() { #gen_proto_dotnet cart gen_proto_go checkoutservice #gen_proto_cpp currency -#gen_proto_ruby emailservice +#gen_proto_ruby email #gen_proto_ts frontend #gen_proto_js paymentservice gen_proto_go productcatalogservice diff --git a/ide-gen-proto.sh b/ide-gen-proto.sh index 14649b8517..76ad0f1980 100755 --- a/ide-gen-proto.sh +++ b/ide-gen-proto.sh @@ -70,7 +70,7 @@ gen_proto_dotnet accounting gen_proto_dotnet cart gen_proto_go checkoutservice # gen_proto_cpp currency -# gen_proto_ruby emailservice +# gen_proto_ruby email gen_proto_ts frontend gen_proto_ts react-native-app gen_proto_js paymentservice diff --git a/renovate.json5 b/renovate.json5 index de6ac5c52a..9524045bde 100644 --- a/renovate.json5 +++ b/renovate.json5 @@ -35,8 +35,8 @@ "groupName": "currency", }, { - "matchFileNames": ["src/emailservice/**"], - "groupName": "emailservice", + "matchFileNames": ["src/email/**"], + "groupName": "email", }, { "matchFileNames": ["src/featureflagservice/**"], diff --git a/src/checkoutservice/main.go b/src/checkoutservice/main.go index d4c7bfadc9..5ad3afa8ba 100644 --- a/src/checkoutservice/main.go +++ b/src/checkoutservice/main.go @@ -187,7 +187,7 @@ func main() { svc.currencySvcClient = pb.NewCurrencyServiceClient(c) defer c.Close() - mustMapEnv(&svc.emailSvcAddr, "EMAIL_SERVICE_ADDR") + mustMapEnv(&svc.emailSvcAddr, "EMAIL_ADDR") c = mustCreateClient(svc.emailSvcAddr) svc.emailSvcClient = pb.NewEmailServiceClient(c) defer c.Close() @@ -458,7 +458,7 @@ func (cs *checkoutService) chargeCard(ctx context.Context, amount *pb.Money, pay } func (cs *checkoutService) sendOrderConfirmation(ctx context.Context, email string, order *pb.OrderResult) error { - emailServicePayload, err := json.Marshal(map[string]interface{}{ + emailPayload, err := json.Marshal(map[string]interface{}{ "email": email, "order": order, }) @@ -466,7 +466,7 @@ func (cs *checkoutService) sendOrderConfirmation(ctx context.Context, email stri return fmt.Errorf("failed to marshal order to JSON: %+v", err) } - resp, err := otelhttp.Post(ctx, cs.emailSvcAddr+"/send_order_confirmation", "application/json", bytes.NewBuffer(emailServicePayload)) + resp, err := otelhttp.Post(ctx, cs.emailSvcAddr+"/send_order_confirmation", "application/json", bytes.NewBuffer(emailPayload)) if err != nil { return fmt.Errorf("failed POST to email service: %+v", err) } diff --git a/src/emailservice/.dockerignore b/src/email/.dockerignore similarity index 100% rename from src/emailservice/.dockerignore rename to src/email/.dockerignore diff --git a/src/emailservice/.ruby-version b/src/email/.ruby-version similarity index 100% rename from src/emailservice/.ruby-version rename to src/email/.ruby-version diff --git a/src/emailservice/Dockerfile b/src/email/Dockerfile similarity index 79% rename from src/emailservice/Dockerfile rename to src/email/Dockerfile index d6090905e5..45da417d37 100644 --- a/src/emailservice/Dockerfile +++ b/src/email/Dockerfile @@ -8,7 +8,7 @@ FROM base AS builder WORKDIR /tmp -COPY ./src/emailservice/Gemfile ./src/emailservice/Gemfile.lock ./ +COPY ./src/email/Gemfile ./src/email/Gemfile.lock ./ #RUN apk update && apk add make gcc musl-dev gcompat && bundle install RUN apt-get update && apt-get install build-essential -y && bundle install @@ -16,12 +16,12 @@ FROM base AS release WORKDIR /email_server -COPY ./src/emailservice/ . +COPY ./src/email/ . RUN chmod 666 ./Gemfile.lock COPY --from=builder /usr/local/bundle/ /usr/local/bundle/ -EXPOSE ${EMAIL_SERVICE_PORT} +EXPOSE ${EMAIL_PORT} ENTRYPOINT ["bundle", "exec", "ruby", "email_server.rb"] diff --git a/src/emailservice/Gemfile b/src/email/Gemfile similarity index 100% rename from src/emailservice/Gemfile rename to src/email/Gemfile diff --git a/src/emailservice/Gemfile.lock b/src/email/Gemfile.lock similarity index 100% rename from src/emailservice/Gemfile.lock rename to src/email/Gemfile.lock diff --git a/src/emailservice/README.md b/src/email/README.md similarity index 91% rename from src/emailservice/README.md rename to src/email/README.md index e46b89404a..13533d83ee 100644 --- a/src/emailservice/README.md +++ b/src/email/README.md @@ -20,4 +20,4 @@ You may run this service locally with `bundle exec ruby email_server.rb`. ## Docker Build -From `src/emailservice`, run `docker build .` +From `src/email`, run `docker build .` diff --git a/src/emailservice/email_server.rb b/src/email/email_server.rb similarity index 93% rename from src/emailservice/email_server.rb rename to src/email/email_server.rb index ae0291d466..fcd494a07d 100644 --- a/src/emailservice/email_server.rb +++ b/src/email/email_server.rb @@ -9,7 +9,7 @@ require "opentelemetry/exporter/otlp" require "opentelemetry/instrumentation/sinatra" -set :port, ENV["EMAIL_SERVICE_PORT"] +set :port, ENV["EMAIL_PORT"] OpenTelemetry::SDK.configure do |c| c.use "OpenTelemetry::Instrumentation::Sinatra" @@ -34,7 +34,7 @@ def send_email(data) # create and start a manual span - tracer = OpenTelemetry.tracer_provider.tracer('emailservice') + tracer = OpenTelemetry.tracer_provider.tracer('email') tracer.in_span("send_email") do |span| Pony.mail( to: data.email, diff --git a/src/emailservice/views/confirmation.erb b/src/email/views/confirmation.erb similarity index 100% rename from src/emailservice/views/confirmation.erb rename to src/email/views/confirmation.erb diff --git a/test/tracetesting/emailservice/all.yaml b/test/tracetesting/email/all.yaml similarity index 54% rename from test/tracetesting/emailservice/all.yaml rename to test/tracetesting/email/all.yaml index 0a2f79aaad..517ca65e69 100644 --- a/test/tracetesting/emailservice/all.yaml +++ b/test/tracetesting/email/all.yaml @@ -3,8 +3,8 @@ type: TestSuite spec: - id: email-service-all - name: 'Email Service' - description: Run all Email Service tests enabled in sequence + id: email-all + name: 'Email' + description: Run all Email tests enabled in sequence steps: - ./confirmation.yaml diff --git a/test/tracetesting/emailservice/confirmation.yaml b/test/tracetesting/email/confirmation.yaml similarity index 96% rename from test/tracetesting/emailservice/confirmation.yaml rename to test/tracetesting/email/confirmation.yaml index 6aff590e31..96c561efbc 100644 --- a/test/tracetesting/emailservice/confirmation.yaml +++ b/test/tracetesting/email/confirmation.yaml @@ -9,7 +9,7 @@ spec: trigger: type: http httpRequest: - url: ${var:EMAIL_SERVICE_ADDR}/send_order_confirmation + url: ${var:EMAIL_ADDR}/send_order_confirmation method: POST headers: - key: Content-Type diff --git a/test/tracetesting/run.bash b/test/tracetesting/run.bash index 865de274e0..aba367b86f 100755 --- a/test/tracetesting/run.bash +++ b/test/tracetesting/run.bash @@ -8,7 +8,7 @@ set -e # Availalble services to test -ALL_SERVICES=("ad" "cart" "currency" "checkoutservice" "frontend" "emailservice" "paymentservice" "productcatalogservice" "recommendationservice" "shipping") +ALL_SERVICES=("ad" "cart" "currency" "checkoutservice" "frontend" "email" "paymentservice" "productcatalogservice" "recommendationservice" "shipping") ## Script variables # Will contain the list of services to test @@ -42,8 +42,8 @@ spec: value: $CHECKOUT_SERVICE_ADDR - key: CURRENCY_ADDR value: $CURRENCY_ADDR - - key: EMAIL_SERVICE_ADDR - value: $EMAIL_SERVICE_ADDR + - key: EMAIL_ADDR + value: $EMAIL_ADDR - key: FRONTEND_ADDR value: $FRONTEND_ADDR - key: PAYMENT_SERVICE_ADDR