Skip to content
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

bug: aws 인스턴스에 환경변수 전달 안되는 문제 수정 및 docker compose 파일 db에 의존성 가지게 수정 #5

Merged
merged 6 commits into from
Jul 20, 2024

Conversation

injoon2019
Copy link
Collaborator

💡 이슈 번호

#4

✨ 작업 내용

  • 환경변수를 인스턴스에 쓰고, 도커가 뜰때 읽도록 수정
  • docker-compose 파일에서 스프링부트가 뜰때 의존성을 db에 갖게 수정
  • docker-compose 파일에서 service가 deprecated 되어서 warn이 나와서 제거

🚀 전달 사항

image

deploy.sh Outdated
Comment on lines 26 to 27

rm /home/$SERVER_USER_NAME/deploy/env_vars.sh
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

일단 rm넣지 말고 파일 어떻게 생성되나 디버깅해도 좋을거 같기도하고.. 어떻게 생각하시나요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

rm 하는 부분 제거했어요. pr 머지하고 원격접속해서 파일 확인해보면 좋을거 같아

Copy link
Member

Choose a reason for hiding this comment

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

아하 여기서 rm 제거하고 환경변수 설정할 때 파일이 존재하면 삭제하는걸로 바꾼거죠?

@@ -19,7 +17,7 @@ services:
ports:
- "8080:8080"
depends_on:
- mysql
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

이거 아래 db에 의존성이 있는거 같아 수정했어요!

export DB_USER_NAME=${{ secrets.DB_USER_NAME }}
export DB_PASSWORD=${{ secrets.DB_PASSWORD }}
export DISCORD_WEBHOOK_URL=${{ secrets.DISCORD_WEBHOOK_URL }}
echo "SERVER_NGINX_CONF=${{ secrets.SERVER_NGINX_CONF }}" > /home/$SERVER_USER_NAME/deploy/env_vars.sh
Copy link
Collaborator Author

@injoon2019 injoon2019 Jul 19, 2024

Choose a reason for hiding this comment

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

일단 디버깅도 할겸 파일로 써볼까 합니다! export가 해당 세션 및 자식 세션에서 환경 변수가 유지된다고 하는데 끊기는건가 싶기도하네요

Copy link
Member

Choose a reason for hiding this comment

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

좋아요! 이상하게 deploy.sh -> notify_error.sh 까지 환경변수가 잘 전달되는데 docker-compose.yml에서만 인식을 못하더라구요..

Copy link
Member

@miseongk miseongk left a comment

Choose a reason for hiding this comment

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

버그 고치느라 고생하셨어요!! 👍👍👍

Comment on lines 60 to 62
if [ -f /home/$SERVER_USER_NAME/deploy/env_vars.sh ]; then
rm /home/$SERVER_USER_NAME/deploy/env_vars.sh
fi
Copy link
Member

Choose a reason for hiding this comment

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

SERVER_USER_NAME도 ${{ secrets.SERVER_USER_NAME }} 이렇게 해야하지 않을까요?!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

오 감사합니다 수정했어요!!

@injoon2019 injoon2019 merged commit 2aba7ff into develop Jul 20, 2024
1 check passed
@injoon2019 injoon2019 deleted the bug/3 branch July 22, 2024 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants