Skip to content

feat: AWS -> OCI로 마이그레이션#27

Merged
mungmnb777 merged 6 commits into
mainfrom
feat/migrate-oci
Mar 13, 2026
Merged

feat: AWS -> OCI로 마이그레이션#27
mungmnb777 merged 6 commits into
mainfrom
feat/migrate-oci

Conversation

@mungmnb777

Copy link
Copy Markdown
Collaborator

요약

OCI로의 마이그레이션을 진행합니다.

구현 내용 사항

1. Github Actions 워크플로우가 추가됐습니다.(.github/workflows/deploy-oci.yml)

해당 클라우드의 아키텍처가 arm64라서 기존 bootBuildImage 태스크를 변경하지 않고는 이미지 빌드가 어렵습니다.
그래서 buildpack cli(https://github.com/buildpacks/pack) 방식으로 이미지 빌드를 진행했습니다.

2. Grafana + Loki 라벨에 cloud_provider가 추가됐습니다.

AWS 서버도 1~2달은 유지할 생각이라, aws와 oci 로그를 분리하기 위해 cloud_provider를 추가했습니다.

3. AlrimFcmManager와 AlrimEventBatch에 @ConditionalOnProperty 애노테이션을 추가했습니다.

AWS와 OCI 두 서버에서 모두 스케줄링이 돌아가면 중복 데이터가 DB에 쌓일 수도 있어서, OCI에서만 배치가 돌아가게 하기 위함입니다.
또한, 제 로컬 개발 환경에서는 AlrimEventBatch가 동작하지 않게 하기 위함도 있습니다.


아래는 코드와 관련된 사항은 아닙니다. 마이그레이션으로 인해 인프라적인 측면이 변한 부분에 대해 설명드립니다.

1. RDS

RDS를 사용하지 않고, OCI 인스턴스에 MySQL 컨테이너를 셀프 호스팅하여 사용하는 방식으로 수정했습니다.
AWS, OCI -> MySQL(OCI) 이런 상태입니다.

2. S3

S3의 경우에는 프리티어가 끝나도 비용이 많이 나오지 않을 것 같아서 유지하려고 합니다

현재 오라클 클라우드 접근은 tailscale을 통해서만 할 수 있기 때문에, DB에 접근하고 싶으시다면 tailscale 머신에 대한 접근 권한을 받아야 합니다.


1~2달 간은 AWS와 OCI 둘 다 유지할 예정이며, 이후 AWS는 종료할 예정입니다.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 애플리케이션을 AWS에서 OCI(Oracle Cloud Infrastructure)로 마이그레이션하는 작업을 포함합니다. 기존 AWS 환경과 OCI 환경이 1~2개월간 병행 운영될 예정이며, 이 기간 동안 로그 분리 및 배치 작업의 중복 실행 방지를 위한 설정 변경이 이루어졌습니다. 또한, RDS를 OCI 인스턴스 내 MySQL 컨테이너로 대체하는 등 인프라적인 변경 사항도 반영되었습니다.

Highlights

  • Github Actions 워크플로우 추가: OCI 환경을 위한 새로운 Github Actions 워크플로우가 추가되었으며, arm64 아키텍처 지원을 위해 buildpack CLI 방식으로 이미지를 빌드하도록 변경되었습니다.
  • Grafana + Loki 라벨에 cloud_provider 추가: AWS와 OCI 환경의 로그를 명확히 분리하기 위해 Grafana + Loki 라벨에 cloud_provider 필드가 추가되었습니다.
  • @ConditionalOnProperty 애노테이션 적용: AlrimFcmManager와 AlrimEventBatch에 @ConditionalOnProperty 애노테이션을 추가하여 OCI 환경에서만 배치 작업이 실행되도록 설정하고, 로컬 개발 환경에서의 중복 실행을 방지했습니다.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/main/java/com/maple/api/alrim/application/command/AlrimEventBatch.java
    • @ConditionalOnProperty 애노테이션을 추가하여 특정 조건에서만 빈이 활성화되도록 변경되었습니다.
  • src/main/java/com/maple/api/alrim/application/command/AlrimFcmManager.java
    • @ConditionalOnProperty 애노테이션을 추가하여 특정 조건에서만 빈이 활성화되도록 변경되었습니다.
  • src/main/resources/application.yml
    • batch.alrim-event.enabled 속성을 추가하여 배치 작업의 활성화 여부를 제어할 수 있도록 설정되었습니다.
  • src/main/resources/logback-spring.xml
    • Loki 로깅 설정에 cloud_provider 라벨을 추가하여 클라우드 환경별 로그를 구분할 수 있도록 변경되었습니다.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/deploy-oci.yml
Activity
  • 현재까지 이 PR에 대한 활동은 없습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

OCI로 마이그레이션을 위한 변경 사항 잘 검토했습니다. 배치 작업과 FCM 관리자를 @ConditionalOnProperty를 사용해 조건부로 활성화하고, application.yml에서 환경 변수로 제어할 수 있도록 구성한 점이 좋습니다. 또한, logback-spring.xmlcloud_provider 라벨을 추가하여 여러 클라우드 환경의 로그를 명확히 구분할 수 있게 한 점도 좋은 변경입니다.

다만, logback-spring.xml에 추가된 CLOUD_PROVIDER 환경 변수에 기본값을 설정하여, 해당 변수가 없는 환경에서도 애플리케이션이 안정적으로 실행될 수 있도록 개선하는 것을 제안합니다. 자세한 내용은 코드 댓글을 참고해주세요.

service_name = mapleland-api
level = %level
service_name = mapleland-api
cloud_provider = ${CLOUD_PROVIDER}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

CLOUD_PROVIDER 환경 변수가 설정되지 않은 경우, Spring Boot가 플레이스홀더를 해석하지 못해 애플리케이션 시작에 실패할 수 있습니다. 예상치 못한 환경 구성 오류로 인해 서비스가 중단되는 것을 방지하기 위해, 다음과 같이 기본값을 설정하는 것을 권장합니다. 이렇게 하면 환경 변수가 누락되더라도 애플리케이션이 정상적으로 실행되며, 로그를 통해 설정 문제를 쉽게 인지할 수 있습니다.

Suggested change
cloud_provider = ${CLOUD_PROVIDER}
cloud_provider = ${CLOUD_PROVIDER:unknown}

@mungmnb777 mungmnb777 merged commit c6549cc into main Mar 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant