Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init order service #443

Merged
merged 12 commits into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/order-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: order service ci

on:
push:
branches: ["main"]
paths:
- "order/**"
- ".github/workflows/actions/action.yaml"
- ".github/workflows/order-ci.yaml"
pull_request:
branches: ["main"]
paths:
- "order/**"
- ".github/workflows/actions/action.yaml"
- ".github/workflows/order-ci.yaml"

workflow_dispatch:

jobs:
Build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: ./.github/workflows/actions
- name: Run Maven Build Command
run: mvn clean install -DskipTests -f order
- name: Analyze with sonar cloud
if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }}
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -f order
- name: Log in to the Container registry
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker images
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/build-push-action@v3
with:
context: ./order
push: true
tags: ghcr.io/nashtech-garage/yas-order:latest

Unit-Tests:
needs: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/actions
- name: Run Maven Test
run: mvn test -f order
- name: Unit Test Results
uses: dorny/test-reporter@v1
if: always()
with:
name: Unit-Test-Results
path: "order/**/surefire-reports/*.xml"
reporter: java-junit
12 changes: 11 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ services:
YAS_SERVICES_CUSTOMER: http://customer/customer
YAS_SERVICES_CART: http://cart/cart
YAS_SERVICES_RATING: http://rating/rating
YAS_SERVICES_ORDER: http://order/order
storefront-nextjs:
image: ghcr.io/nashtech-garage/yas-storefront:latest
media:
Expand Down Expand Up @@ -96,13 +97,22 @@ services:
YAS_SERVICES_PRODUCT: http://product/product
YAS_SERVICES_CUSTOMER: http://customer/customer
SERVER_PORT: "80"
order:
image: ghcr.io/nashtech-garage/yas-order:latest
environment:
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/order
SERVER_SERVLET_CONTEXT_PATH: /order
YAS_PUBLIC_URL: http://api.yas.local/order
YAS_SERVICES_PRODUCT: http://product/product
YAS_SERVICES_CUSTOMER: http://customer/customer
SERVER_PORT: "80"
swagger-ui:
image: swaggerapi/swagger-ui:v4.16.0
environment:
BASE_URL: /swagger-ui
URLS: "[{ url: 'http://api.yas.local/product/v3/api-docs', name: 'Product' },{ url: 'http://api.yas.local/media/v3/api-docs', name: 'Media' },
{ url: 'http://api.yas.local/customer/v3/api-docs', name: 'Customer' }, { url: 'http://api.yas.local/cart/v3/api-docs', name: 'Cart'},
{ url: 'http://api.yas.local/rating/v3/api-docs', name: 'Rating' }]"
{ url: 'http://api.yas.local/rating/v3/api-docs', name: 'Rating' }, { url: 'http://api.yas.local/order/v3/api-docs', name: 'Order'}]"
OAUTH_CLIENT_ID: swagger-ui
OAUTH_USE_PKCE: "true"
postgres:
Expand Down
4 changes: 4 additions & 0 deletions docker/prometheus/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ scrape_configs:
metrics_path: "/rating/actuator/prometheus"
static_configs:
- targets: ["rating"]
- job_name: "order"
metrics_path: "/order/actuator/prometheus"
static_configs:
- targets: ["order"]
6 changes: 4 additions & 2 deletions identity/realm-export.json
Original file line number Diff line number Diff line change
Expand Up @@ -1123,15 +1123,17 @@
"http://api.yas.local/*",
"http://localhost:8089/*",
"http://localhost:8088/*",
"http://localhost:8084/*"
"http://localhost:8084/*",
"http://localhost:8085/*"
],
"webOrigins": [
"http://localhost:8084",
"http://localhost:8083",
"http://localhost:8080",
"http://api.yas.local",
"http://localhost:8088",
"http://localhost:8089"
"http://localhost:8089",
"http://localhost:8085"
],
"notBefore": 0,
"bearerOnly": false,
Expand Down
3 changes: 3 additions & 0 deletions nginx/templates/default.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ server {
location /rating/ {
proxy_pass http://rating;
}
location /order/ {
proxy_pass http://order;
}
}

server {
Expand Down
33 changes: 33 additions & 0 deletions order/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
Binary file added order/.mvn/wrapper/maven-wrapper.jar
Binary file not shown.
18 changes: 18 additions & 0 deletions order/.mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
3 changes: 3 additions & 0 deletions order/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM eclipse-temurin:17-jre-alpine
ADD target/order-0.0.1-SNAPSHOT.jar order-0.0.1-SNAPSHOT.jar
ENTRYPOINT ["java", "-jar", "/order-0.0.1-SNAPSHOT.jar"]
Loading