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 tax service #549

Merged
merged 12 commits into from
Mar 31, 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
64 changes: 64 additions & 0 deletions .github/workflows/tax-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: tax service ci

on:
push:
branches: ["main"]
paths:
- "tax/**"
- ".github/workflows/actions/action.yaml"
- ".github/workflows/tax-ci.yaml"
pull_request:
branches: ["main"]
paths:
- "tax/**"
- ".github/workflows/actions/action.yaml"
- ".github/workflows/tax-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 tax
- 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 tax
- 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: ./tax
push: true
tags: ghcr.io/nashtech-garage/yas-tax: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 tax
- name: Unit Test Results
uses: dorny/test-reporter@v1
if: always()
with:
name: Unit-Test-Results
path: "tax/**/surefire-reports/*.xml"
reporter: java-junit

8 changes: 8 additions & 0 deletions backoffice-bff/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ spring:
filters:
- RewritePath=/api/(?<segment>.*), /$\{segment}
- TokenRelay=
- id: api_tax_local
uri: http://localhost:8091
# uri: http://api.yas.local
predicates:
- Path=/api/tax/**
filters:
- RewritePath=/api/(?<segment>.*), /$\{segment}
- TokenRelay=
- id: api_cart_local
uri: http://localhost:8084
# uri: http://api.yas.local
Expand Down
11 changes: 10 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ services:
YAS_SERVICES_ORDER: http://order/order
YAS_SERVICES_LOCATION: http://location/location
YAS_SERVICES_INVENTORY: http://inventory/inventory
YAS_SERVICES_TAX: http://tax/tax
storefront-nextjs:
image: ghcr.io/nashtech-garage/yas-storefront:latest
media:
Expand Down Expand Up @@ -123,14 +124,22 @@ services:
YAS_PUBLIC_URL: http://api.yas.local/inventory
YAS_SERVICES_PRODUCT: http://product/product
SERVER_PORT: "80"
tax:
image: ghcr.io/nashtech-garage/yas-tax:latest
environment:
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/tax
SERVER_SERVLET_CONTEXT_PATH: /tax
YAS_PUBLIC_URL: http://api.yas.local/tax
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/order/v3/api-docs', name: 'Order'},
{ url: 'http://api.yas.local/location/v3/api-docs', name: 'Location'}, { url: 'http://api.yas.local/inventory/v3/api-docs', name: 'Inventory'}]"
{ url: 'http://api.yas.local/location/v3/api-docs', name: 'Location'}, { url: 'http://api.yas.local/inventory/v3/api-docs', name: 'Inventory'},
{ url: 'http://api.yas.local/tax/v3/api-docs', name: 'tax' }]"
OAUTH_CLIENT_ID: swagger-ui
OAUTH_USE_PKCE: "true"
postgres:
Expand Down
6 changes: 5 additions & 1 deletion docker/prometheus/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@ scrape_configs:
- job_name: "inventory"
metrics_path: "/inventory/actuator/prometheus"
static_configs:
- targets: ["inventory"]
- targets: ["inventory"]
- job_name: "tax"
metrics_path: "/tax/actuator/prometheus"
static_configs:
- targets: [ "tax" ]
6 changes: 4 additions & 2 deletions identity/realm-export.json
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,8 @@
"http://localhost:8084/*",
"http://localhost:8085/*",
"http://localhost:8086/*",
"http://localhost:8090/*"
"http://localhost:8090/*",
"http://localhost:8091/*"
],
"webOrigins": [
"http://localhost:8084",
Expand All @@ -1137,7 +1138,8 @@
"http://localhost:8089",
"http://localhost:8085",
"http://localhost:8086",
"http://localhost:8090"
"http://localhost:8090",
"http://localhost:8091"
],
"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 @@ -27,6 +27,9 @@ server {
location /inventory/ {
proxy_pass http://inventory;
}
location /tax/ {
proxy_pass http://tax;
}
}

server {
Expand Down
3 changes: 3 additions & 0 deletions postgres_init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ LIMIT = -1;
CREATE DATABASE inventory WITH OWNER = admin ENCODING = 'UTF8' LC_COLLATE = 'en_US.utf8' LC_CTYPE = 'en_US.utf8' TABLESPACE = pg_default CONNECTION
LIMIT = -1;

CREATE DATABASE tax WITH OWNER = admin ENCODING = 'UTF8' LC_COLLATE = 'en_US.utf8' LC_CTYPE = 'en_US.utf8' TABLESPACE = pg_default CONNECTION
LIMIT = -1;

33 changes: 33 additions & 0 deletions tax/.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 tax/.mvn/wrapper/maven-wrapper.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions tax/.mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.5/apache-maven-3.8.5-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
4 changes: 4 additions & 0 deletions tax/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM eclipse-temurin:17-jre-alpine
ADD target/tax-0.0.1-SNAPSHOT.jar tax-0.0.1-SNAPSHOT.jar
ENTRYPOINT ["java", "-jar", "/tax-0.0.1-SNAPSHOT.jar"]

Loading