Skip to content

Commit

Permalink
feat(book): Refactor for RESTfull service
Browse files Browse the repository at this point in the history
Signed-off-by: Vitalijs <[email protected]>
  • Loading branch information
lvvorovi committed Sep 4, 2023
0 parents commit 2032439
Show file tree
Hide file tree
Showing 52 changed files with 2,140 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/git-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: bookstore-job

on:
push:
branches: [ "master" ]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Build with Gradle
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: build

- name: Build and Push Docker Image
uses: mr-smithers-excellent/docker-build-push@v6
with:
image: lvvorovi/bookstore
tags: 2.0, 9
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
multiPlatform: true
platform: linux/amd64,linux/arm64
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM openjdk:17-ea-16-jdk
ARG JAR_FILE=build/libs/*jar
COPY ./build/libs/nine-1.0.0.jar app.jar
ENTRYPOINT ["java", "-jar", "/app.jar"]

62 changes: 62 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.1.3'
id 'io.spring.dependency-management' version '1.1.3'
}


group = 'com.bookstore'
version = '1.0.0'

java {
sourceCompatibility = '17'
}

repositories {
mavenCentral()
}

ext {
set('springCloudVersion', "2022.0.4")
}

dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
implementation 'org.springframework.boot:spring-boot-starter-actuator'

implementation 'org.springframework.cloud:spring-cloud-starter'

implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0'

implementation 'org.flywaydb:flyway-core'
implementation 'org.flywaydb:flyway-mysql'

compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'

runtimeOnly 'com.mysql:mysql-connector-j'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'com.h2database:h2:2.2.222'
testImplementation 'org.flywaydb:flyway-core'
testImplementation 'org.junit.jupiter:junit-jupiter-api'
testImplementation('it.ozimov:embedded-redis:0.7.3') {
exclude group: "org.slf4j"
}
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
}

tasks.named('test') {
useJUnitPlatform()
}
82 changes: 82 additions & 0 deletions compose9.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
version: '2'

networks:
bookstore-network:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.26.0.0/16
gateway: 172.26.0.1


services:

bookstoredb:
container_name: bookstoredb
image: mysql:8
restart: always
ports:
- "3306:3306"
networks:
- bookstore-network
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=bookdb

cache-service:
container_name: cache-service
image: redis
restart: always
ports:
- "6379:6379"
networks:
- bookstore-network


auth-service:
container_name: auth-service
image: lvvorovi/bookstore:auth
restart: always
ports:
- "9090:9090"
networks:
- bookstore-network
environment:
- SERVER_PORT=9090
- SERVER_HOST=172.26.0.1


bookstore-service:
container_name: bookstore-service
image: lvvorovi/bookstore:9
restart: always
ports:
- "8080:8080"
networks:
- bookstore-network
environment:
- MYSQL_HOST=172.26.0.1
- MYSQL_PORT=3306
- MYSQL_SCHEMA_NAME=bookdb
- LOGGING_LEVEL_ROOT=info
- MYSQL_USER=root
- MYSQL_PASS=root
- REDIS_HOST=172.26.0.1
- REDIS_PORT=6379
- SERVER_PORT=8080
- CACHE_TTL=10
- JWT_SET_URI=http://172.26.0.1:9090/oauth2.jwks













Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 2032439

Please sign in to comment.