-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/uoslife/server-meeting
- Loading branch information
Showing
50 changed files
with
689 additions
and
409 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
|
||
name: Deployment | ||
|
||
run-name: Deploy by @${{ github.actor }} | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
- name: Cache Gradle Dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v4 | ||
|
||
- name: Build with Gradle Wrapper | ||
run: ./gradlew build -x test | ||
|
||
- name: Docker build & push to Docker hub | ||
run: | | ||
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | ||
docker build -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}:0.1 . | ||
docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}:0.1 | ||
- name: Docker image pull & Deploy to EC2 | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.EC2_HOST }} | ||
username: ubuntu | ||
key: ${{ secrets.EC2_PRIVATE_KEY }} | ||
script: | | ||
sudo docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | ||
sudo docker rm -f $(sudo docker ps -qa) | ||
sudo docker rmi ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}:0.1 | ||
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}:0.1 | ||
sudo docker-compose up -d | ||
sudo docker image prune -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/kotlin/uoslife/servermeeting/global/config/AsyncConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package uoslife.servermeeting.global.config | ||
|
||
import java.util.concurrent.Executor | ||
import org.springframework.context.annotation.Configuration | ||
import org.springframework.scheduling.annotation.AsyncConfigurer | ||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor | ||
|
||
@Configuration | ||
class AsyncConfig : AsyncConfigurer { | ||
override fun getAsyncExecutor(): Executor { | ||
val executor = ThreadPoolTaskExecutor() | ||
executor.corePoolSize = 5 | ||
executor.maxPoolSize = 10 | ||
executor.queueCapacity = 50 | ||
executor.setThreadNamePrefix("CustomAsyncExecutor-") | ||
executor.initialize() | ||
return executor | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 44 additions & 44 deletions
88
src/main/kotlin/uoslife/servermeeting/global/external/UOSLIFEAccountApi.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,44 @@ | ||
package uoslife.servermeeting.global.external | ||
|
||
import feign.auth.BasicAuthRequestInterceptor | ||
import org.springframework.beans.factory.annotation.Value | ||
import org.springframework.cloud.openfeign.FeignClient | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.PathVariable | ||
import org.springframework.web.bind.annotation.RequestHeader | ||
import org.springframework.web.bind.annotation.RequestParam | ||
|
||
@FeignClient(name = "uoslife-account-api-user", url = "\${account.url}") | ||
interface UserClient { | ||
@GetMapping("/v1/users/me") | ||
fun getAuthenticatedUserProfile( | ||
@RequestHeader("Authorization") token: String, | ||
): UOSLIFEUserProfileResponse? | ||
} | ||
|
||
@FeignClient( | ||
name = "uoslife-account-api-server", | ||
url = "\${account.url}", | ||
configuration = [ServerClient.BasicAuthConfiguration::class] | ||
) | ||
interface ServerClient { | ||
@GetMapping("/v1/users/{userId}") | ||
fun getUserProfile(@PathVariable("userId") userId: Long): UOSLIFEUserProfileResponse | ||
|
||
@GetMapping("/v1/users/{userId}/devices") | ||
fun getUserDevices(@PathVariable("userId") userId: Long): List<UOSLIFEUserDeviceResponse> | ||
|
||
@GetMapping("/v1/push-tokens") | ||
fun getUserPushTokens(@RequestParam("userIds") userId: List<Long>): List<String> | ||
|
||
class BasicAuthConfiguration( | ||
@Value("\${account.access.id}") private val accessKeyId: String, | ||
@Value("\${account.access.secret}") private val accessKeySecret: String, | ||
) { | ||
@Bean | ||
fun basicAuthRequestInterceptor(): BasicAuthRequestInterceptor { | ||
return BasicAuthRequestInterceptor(accessKeyId, accessKeySecret) | ||
} | ||
} | ||
} | ||
// package uoslife.servermeeting.global.external | ||
// | ||
// import feign.auth.BasicAuthRequestInterceptor | ||
// import org.springframework.beans.factory.annotation.Value | ||
// import org.springframework.cloud.openfeign.FeignClient | ||
// import org.springframework.context.annotation.Bean | ||
// import org.springframework.web.bind.annotation.GetMapping | ||
// import org.springframework.web.bind.annotation.PathVariable | ||
// import org.springframework.web.bind.annotation.RequestHeader | ||
// import org.springframework.web.bind.annotation.RequestParam | ||
// | ||
// @FeignClient(name = "uoslife-account-api-user", url = "\${account.url}") | ||
// interface UserClient { | ||
// @GetMapping("/v1/users/me") | ||
// fun getAuthenticatedUserProfile( | ||
// @RequestHeader("Authorization") token: String, | ||
// ): UOSLIFEUserProfileResponse? | ||
// } | ||
// | ||
// @FeignClient( | ||
// name = "uoslife-account-api-server", | ||
// url = "\${account.url}", | ||
// configuration = [ServerClient.BasicAuthConfiguration::class] | ||
// ) | ||
// interface ServerClient { | ||
// @GetMapping("/v1/users/{userId}") | ||
// fun getUserProfile(@PathVariable("userId") userId: Long): UOSLIFEUserProfileResponse | ||
// | ||
// @GetMapping("/v1/users/{userId}/devices") | ||
// fun getUserDevices(@PathVariable("userId") userId: Long): List<UOSLIFEUserDeviceResponse> | ||
// | ||
// @GetMapping("/v1/push-tokens") | ||
// fun getUserPushTokens(@RequestParam("userIds") userId: List<Long>): List<String> | ||
// | ||
// class BasicAuthConfiguration( | ||
// @Value("\${account.access.id}") private val accessKeyId: String, | ||
// @Value("\${account.access.secret}") private val accessKeySecret: String, | ||
// ) { | ||
// @Bean | ||
// fun basicAuthRequestInterceptor(): BasicAuthRequestInterceptor { | ||
// return BasicAuthRequestInterceptor(accessKeyId, accessKeySecret) | ||
// } | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.