Skip to content

Commit

Permalink
renaming basket-api into cart-api
Browse files Browse the repository at this point in the history
  • Loading branch information
jurabek committed Jan 21, 2024
1 parent fa9ce19 commit 5c65004
Show file tree
Hide file tree
Showing 65 changed files with 102 additions and 128 deletions.
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@

name: basket-api
name: cart-api

on:
push:
branches:
- develop
paths:
- 'src/backend/services/basket-api/**'
- '.github/workflows/basket-api.yml'
- 'src/backend/services/cart-api/**'
- '.github/workflows/cart-api.yml'

pull_request:
branches:
- develop
paths:
- 'src/backend/services/basket-api/**'
- '.github/workflows/basket-api.yml'
- 'src/backend/services/cart-api/**'
- '.github/workflows/cart-api.yml'


jobs:
build-release:
uses: ./.github/workflows/build-release.yml
with:
service-name: basket-api
service-name: cart-api
secrets: inherit

deploy:
Expand All @@ -30,6 +30,6 @@ jobs:
- build-release
uses: ./.github/workflows/deploy.yml
with:
service-name: basket-api
service-name: cart-api
version: ${{ needs.build-release.outputs.new-version }}

2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
- if: matrix.language == 'go'
name: Build Go
run: |
bash ./src/backend/services/basket-api/build.sh
bash ./src/backend/services/cart-api/build.sh
- if: matrix.language == 'csharp'
name: Build C#
Expand Down
12 changes: 6 additions & 6 deletions k8s-kustomize/services/basket-api/base/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: basket-api
name: cart-api
spec:
replicas: 1
selector:
matchLabels:
app: basket-api
app: cart-api
template:
metadata:
labels:
app: basket-api
app: cart-api
spec:
containers:
- image: basket-api # must much from ./kustomization.yaml -> images[0].name
- image: cart-api # must much from ./kustomization.yaml -> images[0].name
imagePullPolicy: IfNotPresent
name: basket-api
name: cart-api
ports:
- containerPort: 5200
envFrom:
- configMapKeyRef:
name: basket-api
name: cart-api
resources:
requests:
memory: "32Mi"
Expand Down
4 changes: 2 additions & 2 deletions k8s-kustomize/services/basket-api/base/http-route.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: HTTPRoute
metadata:
name: basket-api
name: cart-api
spec:
parentRefs:
- kind: Gateway
Expand All @@ -13,5 +13,5 @@ spec:
type: PathPrefix
value: /basket
backendRefs:
- name: basket-api
- name: cart-api
port: 80
6 changes: 3 additions & 3 deletions k8s-kustomize/services/basket-api/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ resources:
configMapGenerator:
- envs:
- config.env
name: basket-api
name: cart-api

images:
- name: basket-api
newName: ghcr.io/chayxana/basket-api
- name: cart-api
newName: ghcr.io/chayxana/cart-api
newTag: 0.0.27
4 changes: 2 additions & 2 deletions k8s-kustomize/services/basket-api/base/service.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: basket-api
name: cart-api
spec:
type: ClusterIP
ports:
- port: 80
name: http
targetPort: 5200
selector:
app: basket-api
app: cart-api
2 changes: 1 addition & 1 deletion k8s-kustomize/services/basket-api/dev/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ configMapGenerator:
- behavior: merge
envs:
- config.env
name: basket-api
name: cart-api
resources:
- ../base
2 changes: 1 addition & 1 deletion k8s-kustomize/services/order-api/base/config.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
basket.url=http://basket-api
basket.url=http://cart-api
datasource.url=jdbc:postgresql://order-pgsql-database:5432/orderdb
env.var=prod
4 changes: 2 additions & 2 deletions src/backend/backend.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"path": "./services/payment-api"
},
{
"name": "basket-api",
"path": "./services/basket-api"
"name": "cart-api",
"path": "./services/cart-api"
},
{
"name": "identity-api",
Expand Down
4 changes: 2 additions & 2 deletions src/backend/docker/docker-compose.elk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ services:
fluentd-address: localhost:24224
tag: order-api

basket-api:
cart-api:
links:
- fluentd
logging:
driver: "fluentd"
options:
fluentd-address: localhost:24224
tag: basket-api
tag: cart-api

catlog-api:
links:
Expand Down
2 changes: 1 addition & 1 deletion src/backend/docker/docker-compose.kafka.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
version: "3.7"
services:
basket-api:
cart-api:
depends_on:
kafka:
condition: service_healthy
Expand Down
6 changes: 3 additions & 3 deletions src/backend/docker/docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
- QUARKUS_OPENTELEMETRY_TRACER_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
- QUARKUS_OPENTELEMETRY_PROPAGATORS=ottrace

basket-api:
cart-api:
environment:
- REDIS_HOST=redis:6379
- KAFKA_BROKER=kafka:29092
Expand All @@ -32,7 +32,7 @@ services:
environment:
- PORT=30001
- HOST=0.0.0.0
- CART_URL=basket-api:8081
- CART_URL=cart-api:8081
- PAYMENT_API_URL=payment-api:8080
- KAFKA_BROKER=kafka:29092
- CHECKOUT_TOPIC=checkout
Expand Down Expand Up @@ -69,7 +69,7 @@ services:
- IDENTITY_URL_PUB=http://localhost:8080/identity

# connect:
# pgcli 'postgresql://admin:Passw0rd!@localhost:5435/identity_database'
# pgcli 'postgresql://admin:Passw0rd!@localhost:5433/orderdb'
order-db:
environment:
- POSTGRES_PASSWORD=Passw0rd!
Expand Down
2 changes: 1 addition & 1 deletion src/backend/docker/docker-compose.traefik.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ services:
- "traefik.http.routers.catalog.rule=PathPrefix(`/catalog/`)"
- "traefik.port=8000"

basket-api:
cart-api:
labels:
- "traefik.enable=true"
- "traefik.http.routers.basket.rule=PathPrefix(`/basket/`)"
Expand Down
8 changes: 4 additions & 4 deletions src/backend/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
image: restaurant/checkout-api
build: ./services/checkout-api
depends_on:
- basket-api
- cart-api
- payment-api
ports:
- 30001:30001
Expand All @@ -29,10 +29,10 @@ services:
- 8000:8000
restart: always

basket-api:
image: restaurant/basket-api
cart-api:
image: restaurant/cart-api
container_name: basket
build: ./services/basket-api
build: ./services/cart-api
depends_on:
- redis

Expand Down
6 changes: 3 additions & 3 deletions src/backend/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ upstream identity-api {
server identity-api:80;
}

upstream basket-api {
server basket-api:5200;
upstream cart-api {
server cart-api:5200;
}

upstream order-api {
Expand Down Expand Up @@ -51,7 +51,7 @@ server {
}

location /basket/ {
proxy_pass http://basket-api/;

}

location /order {
Expand Down
2 changes: 1 addition & 1 deletion src/backend/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ build_order_api(){
}

build_basket_api() {
cd ./services/basket.api/
cd ./services/cart-api/
echo "#### Building Basket API"
sh build.sh
cd -
Expand Down
2 changes: 1 addition & 1 deletion src/backend/scripts/qa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ main () {
}

qa_basket_api() {
cd ./services/basket.api
cd ./services/cart-api
sh qa.sh
}

Expand Down
29 changes: 0 additions & 29 deletions src/backend/services/basket-api/internal/models/checkout.go

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions src/backend/services/basket-api/release.Dockerfile

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ RUN go mod download

COPY ./ ./

RUN CGO_ENABLED=0 go build -installsuffix 'static' -o basket-api cmd/api/main.go
RUN CGO_ENABLED=0 go build -installsuffix 'static' -o cart-api cmd/api/main.go
RUN CGO_ENABLED=0 go test -c ./internal/handlers -o handlers.test -cover

#final stage
FROM alpine:latest
RUN apk --no-cache add ca-certificates

COPY --from=builder /src ./
CMD ["./basket-api"]
LABEL Name=basket.api Version=0.0.1
CMD ["./cart-api"]
LABEL Name=cart-api Version=0.0.1
EXPOSE 5200
ENV PORT 5200
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 5c65004

Please sign in to comment.