GitHub Actions๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ CI/CD ํŒŒ์ดํ”„๋ผ์ธ yml ํŒŒ์ผ
ยท
study
GitHub Actions๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ CI/CD(์ง€์†์  ํ†ตํ•ฉ ๋ฐ ์ง€์†์  ๋ฐฐํฌ) ํŒŒ์ดํ”„๋ผ์ธ์„ ์„ค์ •ํ•˜๋Š” ์›Œํฌํ”Œ๋กœ์šฐ# ์›Œํฌํ”Œ๋กœ์˜ ์ด๋ฆ„ ์ง€์ •name: CI/CD#์›Œํฌ ํ”Œ๋กœ๊ฐ€ ์‹œ์ž‘๋  ์กฐ๊ฑด ์ง€์ •on: push: branches: [ main ]jobs: build: runs-on: ubuntu-latest #์‹คํ–‰ํ™˜๊ฒฝ ์ง€์ • #์‹คํ–‰ ์Šคํ… ์ง€์ • steps: - uses: actions/checkout@v3 - uses: actions/setup-java@v3 with: distribution: 'corretto' java-version: '17' # ์‹คํ–‰ ๊ถŒํ•œ ๋ถ€์—ฌ - name: Grant execute permissio..
OAuth2 ์„ค์ • ํŒŒ์ผ ์ž‘์„ฑํ•˜๊ธฐ
ยท
TIL/Java
@RequiredArgsConstructor@Configurationpublic class WebOAuthSecurityConfig { // ์Šคํ”„๋ง ์‹œํ๋ฆฌํ‹ฐ ๊ธฐ๋Šฅ ๋น„ํ™œ์„ฑํ™” @Bean public WebSecurityCustomizer configure() { return (web) -> web.ignoring() .requestMatchers(toH2Console()) .requestMatchers("/img/**", "/css/**", "/js/**"); } @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { ..
Spring Security ํŒŒ์ผ ์„ค์ •ํ•˜๊ธฐ
ยท
TIL/Java
@Configuration@RequiredArgsConstructorpublic class WebSecurityConfig { private final UserDetailService userService; @Bean public WebSecurityCustomizer configure() { return (web) -> web.ignoring() .requestMatchers(toH2Console()) .requestMatchers("/static/**"); } @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception ..
9์›” ํšŒ๊ณ 
ยท
TIL/ํšŒ๊ณ 
์ด๋ ฅ์„œ์š”์ฆ˜ ์ด๋ ฅ์„œ๋ฅผ ๋‹ค๋“ฌ๋Š” ๋ฐ ๋งŽ์€ ์‹œ๊ฐ„์„ ๋ณด๋‚ด๊ณ  ์žˆ๋‹ค. ๋ฌด์–ธ๊ฐ€๋ฅผ ์—ด์‹ฌํžˆ ํ•ด์™”๋˜ ๊ฒƒ ๊ฐ™์€๋ฐ ๋ง‰์ƒ ์ ์œผ๋ ค๋‹ˆ ๊ทธ ๋ฌด์–ธ๊ฐ€๋“ค์€ ์–ด๋””๊ฐ”๋Š”์ง€ ๋ฌด์—‡์„ ์จ์•ผํ• ์ง€ ๋ง‰๋ง‰ํ•ด์ง„๋‹ค. ์ผ๋‹จ ์‹œ์ž‘ํ•ด๋ณด์ž  java ๊ณต๋ถ€java ๊ณต๋ถ€๋ฅผ ๋‹ค์‹œ ์‹œ์ž‘ํ–ˆ๋‹ค. ๊ทธ๋™์•ˆ ์ž๊ฒฉ์ฆ ์ค€๋น„์— ์ง‘์ค‘ํ•˜๋Š๋ผ ์ž ์‹œ ์†์„ ๋†“์•˜๋˜ ํƒ“์ธ์ง€, ์žŠ์–ด๋ฒ„๋ฆฐ ๋ถ€๋ถ„๋“ค์ด ๋งŽ์•„ ๋‹ค์‹œ ์ตํžˆ๋Š” ๋ฐ ์‹œ๊ฐ„์ด ๊ฑธ๋ฆฌ๊ณ  ์žˆ๋‹ค. ๊ทธ๋ž˜๋„ ์ฐจ๊ทผ์ฐจ๊ทผ ๋ณต์Šตํ•˜๋ฉด์„œ ์ด์ „์— ๋ฐฐ์› ๋˜ ๊ฒƒ๋“ค์„ ๋˜์ฐพ๊ณ  ์žˆ๊ณ , ๋” ๊นŠ์ด ์žˆ๋Š” ์ดํ•ด๋ฅผ ๋ชฉํ‘œ๋กœ ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฒˆ์—๋Š” ๋” ๊พธ์ค€ํžˆ, ์ฒด๊ณ„์ ์œผ๋กœ ๊ณต๋ถ€ ๊ณ„ํš์„ ์„ธ์›Œ์„œ ์ง„ํ–‰ํ•  ๊ณ„ํš์ด๋‹ค. ์˜์–ด ๊ณต๋ถ€ ์ •๋ง ๋งค์ผ ํ•˜๊ณ  ์žˆ๋Š” ๊ณต๋ถ€! ์ด๋ฒˆ ๋‹ฌ๋„ ์˜์–ด ๊ณต๋ถ€๋Š” ๊ฐœ๊ทผ. ๊พธ์ค€ํžˆ ํ•™์Šตํ•  ์ˆ˜ ์žˆ๊ฒŒ ์•ฑ๋‚ด ๋ฆฌ๊ทธ๋ผ๋Š” ์‹œ์Šคํ…œ์ด ์žˆ๋Š”๋ฐ ์ด๋ฒˆ๋‹ฌ์— ๋ฌด๋ ค ๋งˆ์ง€๋ง‰ ๋ฆฌ๊ทธ์ธ ๊ทธ๋žœ๋“œ๋งˆ์Šคํ„ฐ๊นŒ์ง€ ๋‹ฌ์„ฑํ–ˆ๋‹ค. ๋งค์ผ 30๋ถ„ ์ •..
aws Elastic Beanstalk 502 Bad Gatway ํ•ด๊ฒฐ๋ฐฉ๋ฒ•
ยท
์—๋Ÿฌ๋ชจ์Œ์ง‘
spring boot ํ”„๋กœ์ ํŠธ๋ฅผ aws Elastic ์œผ๋กœ ๋ฐฐํฌ ํ•˜๋ ค ์‹œ๋„ ํ•˜์˜€์œผ๋‚˜ ์œ„์™€ ๊ฐ™์€ 502 ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค.   aws Elastic Beanstalk ์€ ๊ธฐ๋ณธํฌํŠธ๋กœ 5000์„ ์‚ฌ์šฉํ•œ๋‹ค๊ณ  ํ•จ. ๊ทธ๋ ‡๊ธฐ์— ํฌํŠธ๋ฅผ ์ง€์ •ํ•ด์ค€๋‹ค.   [๊ตฌ์„ฑ] ๋ฉ”๋‰ด๋กœ ๋“ค์–ด๊ฐ€ [์—…๋ฐ์ดํŠธ, ๋ชจ๋‹ˆํ„ฐ๋ง ๋ฐ ๋กœ๊น…] ์˜ ํŽธ์ง‘ ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ ์ด๋™ํ•œ๋‹ค.  ํ™˜๊ฒฝ์†์„ฑ ๋ถ€๋ถ„์— ์•„๋ž˜์™€ ๊ฐ™์ด ํฌํŠธ๋ฅผ ์ถ”๊ฐ€ํ•ด์ฃผ๋ฉด ํ•ด์ฃผ๋„๋ก ํ•œ๋‹ค.    ํ•ด๊ฒฐ์™„๋ฃŒ!  SERVER_PORT๋Š” ์™œ 5000์ผ๊นŒ์š”?Elastic Beanstalk๋Š” nginx๋ฅผ ์—ญ๋ฐฉํ–ฅ ํ”„๋ก์‹œ๋กœ ์‚ฌ์šฉํ•˜์—ฌ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ํฌํŠธ 80์˜ Elastic Load Balancing ๋กœ๋“œ ๋ฐธ๋Ÿฐ์„œ์— ๋งคํ•‘ํ•ฉ๋‹ˆ๋‹ค. Elastic Beanstalk๋Š” ํ™•์žฅํ•˜๊ฑฐ๋‚˜ ์ž์ฒด ๊ตฌ์„ฑ์œผ๋กœ ์™„์ „ํžˆ ์žฌ์ •์˜ํ•  ์ˆ˜ ์žˆ๋Š” ๊ธฐ๋ณธ nginx..
๋ž˜๋‹ˆ
Digging.dev๐Ÿ‹๋””๊น…๋Œ‘