-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Server 레포지토리에서 분리된 사이드 인프라(Redis, Redis-exporter, Alloy)를 Infra 레포지토리에 통합 #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Hexeong
wants to merge
8
commits into
main
Choose a base branch
from
feat/6-integrate-side-infra
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ce3ea16
feat: config.alloy 파일 생성
Hexeong 300f560
fix: 시스템 업데이트 무한정 대기 오류 해결
Hexeong cff6434
feat: side infra 배포 스크립트 파일 생성
Hexeong a863f0e
docs: 추가된 파일에 따른 README.md 업데이트
Hexeong db4c8bb
feat: 추가된 side infra 배포 관련 설정을 prod/stage 환경에 적용
Hexeong b003435
docs: 추가된 파일에 따른 README.md 업데이트
Hexeong e7760fc
refactor: private IP를 사용하여 접근하도록 수정
Hexeong 18a401e
feat: monitoring ec2에서만 prod/stage의 jvm에 접근 가능하도록 8081 port 허용
Hexeong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Submodule secrets
updated
from c1cf69 to 83f176
This file contains hidden or 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,37 @@ | ||
| livedebugging { | ||
| enabled = true | ||
| } | ||
|
|
||
| logging { | ||
| level = "info" | ||
| format = "logfmt" | ||
| } | ||
|
|
||
| local.file_match "spring_logs" { | ||
| path_targets = [{ __path__ = "/var/log/spring/*.log" }] // 서비스 로그 파일 경로 | ||
| } | ||
|
|
||
| loki.source.file "spring_source" { | ||
| targets = local.file_match.spring_logs.targets // 위에서 정의한 로그 파일 경로 사용 | ||
| forward_to = [loki.process.spring_labels.receiver] // 읽은 로그를 처리 단계로 전달 | ||
| } | ||
|
|
||
| loki.process "spring_labels" { | ||
| forward_to = [loki.write.grafana_loki.receiver] // 처리된 로그를 Loki로 전송 | ||
|
|
||
| stage.static_labels { | ||
| values = { | ||
| service = "backend", | ||
| env = sys.env("ALLOY_ENV"), | ||
| } | ||
| } | ||
| } | ||
|
|
||
| loki.write "grafana_loki" { | ||
| endpoint { | ||
| url = "http://${loki_ip}:3100/loki/api/v1/push" | ||
| tenant_id = "fake" // Loki 테넌트 ID (싱글 테넌시이기에 fake로 설정) | ||
| batch_wait = "1s" // 로그 배치 전송 대기 시간 | ||
| batch_size = "1MB" // 로그 배치 크기 | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add error handling for missing monitoring server.
The data source will fail the Terraform plan if no monitoring server is found or if multiple servers match the filters. Consider adding validation or documentation about this prerequisite.
🔎 Add validation check
You can add a validation step after the module that uses this data source:
Alternatively, add a precondition check in Terraform 1.2+:
data "aws_instance" "monitoring_server" { + lifecycle { + precondition { + condition = length(data.aws_instance.monitoring_server.*.id) == 1 + error_message = "Exactly one monitoring server must exist with tag Name=solid-connection-monitoring in running state" + } + } + filter { name = "tag:Name" values = ["solid-connection-monitoring"] }There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
어차피 aws_instance라는 단수형으로 선언했기에 2개 이상이거나 0개면 error가 나! 그러니 그 부분은 신경 안써도 돼!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Hexeong, you're absolutely right! I appreciate the clarification. The
data "aws_instance"resource (singular) indeed enforces exactly-one semantics automatically, so Terraform will fail during the plan phase if zero or multiple instances match those filters. My suggested validation was redundant. Thank you for pointing that out!✏️ Learnings added