Skip to content

sanggi-wjg/my-ide-java

Repository files navigation

MY IDE (version. JAVA)

✅ Build and Test CodeFactor codecov

Development Environment

Java SpringBoot MySQL Apache Kafka

Java 17 (corretto)
Spring boot 3.0.2
JPA Hibernate 6.1.6
MySQL 8.0
Apache Kafka

TODO

  • Redis는 할까? 말까? 할까? 말까?
  • Gradle 멀티 모듈 변경

Install & Start

  • To begin, Install Docker and Docker Compose on your server or local machine.
  • Once installed successfully, run the below docker-compose command.
docker-compose --env-file container/.env.docker up -d
  • After Gradle build, execute MainApplication(MyIdeJavaApplication) with the local profile as Spring Boot active profiles.

Concept Description

I wanted to explore different ways of executing actual code in Docker containers.
So I proceeded with three ways.

Python 3.8

Implement using an HTTP request with container.

sequenceDiagram
  box Client
  participant SpringBoot
  participant DockerClient
  end
  
  box Docker Container
  participant Container
  end
  
  SpringBoot->>DockerClient: Transfer Code 
  DockerClient->>Container: HTTP Post Request to Flask route
  Container->>DockerClient: Run a Code then respond result whatever success or failure as HTTP Response
  DockerClient->>SpringBoot: Transfer result

Python 2.7

Run a file, that is already implemented with a queue, on container.

sequenceDiagram
  box Client
  participant SpringBoot
  participant DockerClient
  end
  
  box Docker Container
  participant Container
  end
  
  SpringBoot->>DockerClient: Transfer Code 
  DockerClient->>Container: Container file로 전달 받은 Code를 arguments로 하여 파일 실행, Read Queue에 전달
  Container->>DockerClient: Code를 실행하고 성공 or 실패한 출력 결과 Writer Queue가 출력
  DockerClient->>SpringBoot: Transfer result

PHP 8.2, PHP 7.4, GCC 4.9, JDK, GoLang

After create temp file, transfer the file to container.
Then, run a file on container.

sequenceDiagram
  box Client
  participant SpringBoot
  participant DockerClient
  end
  
  box Docker Container
  participant Container
  end
  
  SpringBoot->>DockerClient: Transfer Code 
  DockerClient->>Container: 임시 파일을 생성하고 Container로 생성한 파일 전달
  Container->>DockerClient: 전달 받은 파일을 실행하고 성공 or 실패한 출력 결과 출력
  DockerClient->>SpringBoot: Transfer result

Tools

Swagger

Kafka UI

Jacoco

  • gradle > Tasks > verification > test (For Result of Test)
    • build > reports > tests > index.html
  • gradle > Tasks > verification > jacocoTestReport (For Coverage)
    • build > jacoco > test > html > index.html

Codecov

Local Test view

  • Test viewfile for API Test on local
    • test/resources/test_view.html

GitHub action script test using act

act -l
act -j build-test --container-architecture linux/amd64

Ref