Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 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
14 changes: 13 additions & 1 deletion .github/workflows/dev-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ jobs:
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/aics-admin:${{ github.sha }} -f aics-admin/Dockerfile .
docker tag ${{ secrets.DOCKERHUB_USERNAME }}/aics-admin:${{ github.sha }} ${{ secrets.DOCKERHUB_USERNAME }}/aics-admin:latest

- name: Docker image build for aics-auth
run: |
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/aics-auth:${{ github.sha }} -f aics-auth/Dockerfile .
docker tag ${{ secrets.DOCKERHUB_USERNAME }}/aics-auth:${{ github.sha }} ${{ secrets.DOCKERHUB_USERNAME }}/aics-auth:latest

# Docker Hub 이미지 푸시
- name: docker Hub push for aics-api
run: |
Expand All @@ -60,6 +65,11 @@ jobs:
docker push ${{ secrets.DOCKERHUB_USERNAME }}/aics-admin:${{ github.sha }}
docker push ${{ secrets.DOCKERHUB_USERNAME }}/aics-admin:latest

- name: docker Hub push for aics-auth
run: |
docker push ${{ secrets.DOCKERHUB_USERNAME }}/aics-auth:${{ github.sha }}
docker push ${{ secrets.DOCKERHUB_USERNAME }}/aics-auth:latest

deploy-to-dev:
runs-on: ubuntu-latest
needs: build-docker-image
Expand All @@ -75,5 +85,7 @@ jobs:
script: |
echo "${{ secrets.SERVER_PASSWORD }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }} pull aics-api
echo "${{ secrets.SERVER_PASSWORD }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }} pull aics-admin
echo "${{ secrets.SERVER_PASSWORD }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }} pull aics-auth
echo "${{ secrets.SERVER_PASSWORD }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }} up -d aics-api
echo "${{ secrets.SERVER_PASSWORD }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }} up -d aics-admin
echo "${{ secrets.SERVER_PASSWORD }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }} up -d aics-admin
echo "${{ secrets.SERVER_PASSWORD }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }} up -d aics-auth
1 change: 1 addition & 0 deletions .github/workflows/pull-request-test-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
${{ github.workspace }}/aics-domain/build/jacoco/test/jacocoTestReport.xml
${{ github.workspace }}/aics-api/build/jacoco/test/jacocoTestReport.xml
${{ github.workspace }}/aics-admin/build/jacoco/test/jacocoTestReport.xml
${{ github.workspace }}/aics-auth/build/jacoco/test/jacocoTestReport.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 80
min-coverage-changed-files: 70
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
package kgu.developers.admin.config;

import static java.lang.String.format;
import static org.springframework.security.config.Elements.JWT;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
Expand All @@ -23,6 +8,19 @@
import io.swagger.v3.oas.models.servers.Server;
import jakarta.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import static java.lang.String.format;
import static org.springframework.security.config.Elements.JWT;

@Configuration
@RequiredArgsConstructor
Expand All @@ -39,6 +37,9 @@ public class SwaggerConfig {
@Value("${profiles.admin-api-port}")
private int adminApiPort;

@Value("${profiles.auth-api-port}")
private int authApiPort;

private final Map<String, Map<String, Object>> profileServerConfig = new HashMap<>();

@PostConstruct
Expand Down Expand Up @@ -96,19 +97,32 @@ private SecurityScheme securityScheme() {
private String getDescription() {
String activeProfile = getActiveProfile();
return format("""
AI 컴퓨터공학부 커뮤니티 관리자, AICS-HOME ADMIN API 입니다.\n\n
로그인 API를 통해 액세스 토큰을 발급 받고 헤더에 값을 넣어주세요 . \n\n
별다른 절차 없이 API를 사용하실 수 있습니다.\n\n

사용자 API 문서는 다음 링크에서 확인하실 수 있습니다.\n
<ul>
<li>AICS-HOME API : <a href="%s" target="_blank">%s</a></li>
</ul>
""",
getApiSwaggerByProfile(activeProfile), getApiSwaggerByProfile(activeProfile)
AI 컴퓨터공학부 커뮤니티 관리자, AICS-HOME ADMIN API 입니다.

로그인 API를 통해 액세스 토큰을 발급 받고 헤더에 값을 넣어주세요.

별다른 절차 없이 API를 사용하실 수 있습니다.

사용자 API 문서는 다음 링크에서 확인하실 수 있습니다.
<ul>
<li>AICS-HOME API : <a href="%s" target="_blank">%s</a></li>
</ul>

인증 인가 API 문서는 다음 링크에서 확인하실 수 있습니다.
<ul>
<li>AICS-HOME AUTH API : <a href="%s" target="_blank">%s</a></li>
</ul>
""",
getApiSwaggerByProfile(activeProfile), getApiSwaggerByProfile(activeProfile),
getAuthSwaggerByProfile(activeProfile), getAuthSwaggerByProfile(activeProfile)
);
}

private String getAuthSwaggerByProfile(String profile) {
String url = (String) profileServerConfig.get(profile).get("url");
return url + ":" + authApiPort + "/swagger-ui/index.html";
}

private String getApiSwaggerByProfile(String profile) {
String url = (String) profileServerConfig.get(profile).get("url");
return url + ":" + apiPort + "/swagger-ui/index.html";
Expand Down
3 changes: 2 additions & 1 deletion aics-admin/src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ spring:
profiles:
current-ip: ${CURRENT_IP}
api-port: ${API_SERVER_PORT:8080}
admin-api-port: ${ADMIN_API_SERVER_PORT:8081}
admin-api-port: ${ADMIN_API_SERVER_PORT:8081}
auth-api-port: ${AUTH_API_SERVER_PORT:8082}
3 changes: 2 additions & 1 deletion aics-admin/src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ spring:
profiles:
current-ip: ${CURRENT_IP:localhost}
api-port: ${API_SERVER_PORT:8080}
admin-api-port: ${ADMIN_API_SERVER_PORT:8081}
admin-api-port: ${ADMIN_API_SERVER_PORT:8081}
auth-api-port: ${AUTH_API_SERVER_PORT:8082}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void init() {
.loc("8500")
.site("http://labA.kyonggi.ac.kr")
.advisor("박민준")
.file(testFile)
.imgFile(testFile)
.build()
);
}
Expand Down
66 changes: 41 additions & 25 deletions aics-api/src/main/java/kgu/developers/api/config/SwaggerConfig.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
package kgu.developers.api.config;

import static java.lang.String.format;
import static org.springframework.security.config.Elements.JWT;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
Expand All @@ -23,6 +8,19 @@
import io.swagger.v3.oas.models.servers.Server;
import jakarta.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import static java.lang.String.format;
import static org.springframework.security.config.Elements.JWT;

@Configuration
@RequiredArgsConstructor
Expand All @@ -39,6 +37,9 @@ public class SwaggerConfig {
@Value("${profiles.admin-api-port}")
private int adminApiPort;

@Value("${profiles.auth-api-port}")
private int authApiPort;

private final Map<String, Map<String, Object>> profileServerConfig = new HashMap<>();

@PostConstruct
Expand Down Expand Up @@ -96,16 +97,26 @@ private SecurityScheme securityScheme() {
private String getDescription() {
String activeProfile = getActiveProfile();
return format("""
AI 컴퓨터공학부 커뮤니티, AICS-HOME API 입니다.\n\n
로그인 API를 통해 액세스 토큰을 발급 받고 헤더에 값을 넣어주세요 . \n\n
별다른 절차 없이 API를 사용하실 수 있습니다.\n\n

관리자 API 문서는 다음 링크에서 확인하실 수 있습니다.\n
<ul>
<li>AICS-HOME ADMIN API : <a href="%s" target="_blank">%s</a></li>
</ul>
""",
getAdminSwaggerByProfile(activeProfile), getAdminSwaggerByProfile(activeProfile)
AI 컴퓨터공학부 커뮤니티 관리자, AICS-HOME ADMIN API 입니다.

로그인 API를 통해 액세스 토큰을 발급 받고 헤더에 값을 넣어주세요.

별다른 절차 없이 API를 사용하실 수 있습니다.

관리자 API 문서는 다음 링크에서 확인하실 수 있습니다.
<ul>
<li>AICS-HOME ADMIN API : <a href="%s" target="_blank">%s</a></li>
</ul>

인증 인가 API 문서는 다음 링크에서 확인하실 수 있습니다.
<ul>
<li>AICS-HOME AUTH API : <a href="%s" target="_blank">%s</a></li>
</ul>
""",
getAdminSwaggerByProfile(activeProfile),
getAdminSwaggerByProfile(activeProfile),
getAuthSwaggerByProfile(activeProfile),
getAuthSwaggerByProfile(activeProfile)
);
}

Expand All @@ -114,6 +125,11 @@ private String getAdminSwaggerByProfile(String profile) {
return url + ":" + adminApiPort + "/swagger-ui/index.html";
}

private String getAuthSwaggerByProfile(String profile) {
String url = (String) profileServerConfig.get(profile).get("url");
return url + ":" + authApiPort + "/swagger-ui/index.html";
}

private String getActiveProfile() {
return Arrays.stream(environment.getActiveProfiles())
.findFirst()
Expand Down
3 changes: 2 additions & 1 deletion aics-api/src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ spring:
profiles:
current-ip: ${CURRENT_IP}
api-port: ${API_SERVER_PORT:8080}
admin-api-port: ${ADMIN_API_SERVER_PORT:8081}
admin-api-port: ${ADMIN_API_SERVER_PORT:8081}
auth-api-port: ${AUTH_API_SERVER_PORT:8082}
3 changes: 2 additions & 1 deletion aics-api/src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ spring:
profiles:
current-ip: ${CURRENT_IP:localhost}
api-port: ${API_SERVER_PORT:8080}
admin-api-port: ${ADMIN_API_SERVER_PORT:8081}
admin-api-port: ${ADMIN_API_SERVER_PORT:8081}
auth-api-port: ${AUTH_API_SERVER_PORT:8082}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import java.util.List;

import kgu.developers.domain.file.domain.FileEntity;
import mock.repository.FakeFileRepository;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand All @@ -21,16 +23,20 @@ public class LabFacadeTest {
@BeforeEach
public void init() {
FakeLabRepository fakeLabRepository = new FakeLabRepository();
FakeFileRepository fakeFileRepository = new FakeFileRepository();
labFacade = new LabFacade(
new LabQueryService(fakeLabRepository)
);

FileEntity testFile = fakeFileRepository.save(FileEntity.builder().id(1L).build());

fakeLabRepository.save(
Lab.create(
"인공지능 연구실",
"8502, 8503",
"http://ailab.kyonggi.ac.kr",
"김인철"
"김인철",
testFile
)
);

Expand All @@ -39,7 +45,8 @@ public void init() {
"알고리즘 연구실",
"8504",
"http://algeo.kyonggi.ac.kr/",
"배상원"
"배상원",
testFile
)
);
}
Expand Down
32 changes: 32 additions & 0 deletions aics-auth/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
bootJar {
enabled = true
}

jar {
enabled = true
}

dependencies {
implementation project(':aics-domain')
implementation project(':aics-common')
implementation project(':aics-infra')
implementation project(':aics-global-utils')

testFixturesImplementation project(':aics-domain')
testFixturesImplementation project(':aics-common')
testFixturesImplementation project(':aics-infra')
testFixturesImplementation project(':aics-global-utils')

testFixturesImplementation testFixtures(project(':aics-domain'))
testFixturesImplementation testFixtures(project(':aics-global-utils'))
}

apply from: "../gradle/jacoco.gradle"

jacocoTestReport {
dependsOn test
reports {
xml.required = true
html.required = true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package kgu.developers.auth;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class AicsAuthApplication {

public static void main(String[] args) {
SpringApplication.run(AicsAuthApplication.class, args);
}

}
Loading