/images/avatar.png

🍞πŸ₯πŸ₯– 라일리의 μ½”λ“œ λΆ€μŠ€λŸ¬κΈ° 🍞πŸ₯πŸ₯–

[NGINX] nginx CORS ν™œμ„±ν™” ν•˜κΈ°

nginx CORS ν™œμ„±ν™” ν•˜κΈ° nginxμ—μ„œ CORS(Cross-Origin Resource Sharing) 섀정을 ν™œμ„±ν™”ν•œλ‹€. nginx μ„€μ •νŒŒμΌ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 # # Wide-open CORS config for nginx # location / { if ($request_method = 'OPTIONS') { add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; # # Custom headers and headers various browsers *should* be OK with but aren't # add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; # # Tell client that this pre-flight info is valid for 20 days # add_header 'Access-Control-Max-Age' 1728000; add_header 'Content-Type' 'text/plain; charset=utf-8'; add_header 'Content-Length' 0; return 204; } if ($request_method = 'POST') { add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range'; } if ($request_method = 'GET') { add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range'; } }

[Java Fundamental] Multi Thread

μžλ°” κΈ°λ³Έ μžŠμ§€ μ•Šκ²Œ μ •λ¦¬ν•˜κΈ°! πŸ€” ν”„λ‘œμ„ΈμŠ€μ™€ μŠ€λ ˆλ“œ ν”„λ‘œμ„ΈμŠ€(process) : μš΄μ˜μ²΄μ œμ—μ„œ μ‹€ν–‰ 쀑인 ν•˜λ‚˜μ˜ μ• ν”Œλ¦¬μΌ€μ΄μ…˜μ„ 의미 λ©€ν‹° νƒœμŠ€ν‚Ή(multi tasking) 운영 μ²΄μ œμ—μ„œ 두 가지 μ΄μƒμ˜ 닀쀑 μž‘μ—…(ν”„λ‘œμ„ΈμŠ€)λ₯Ό λ™μ‹œμ— μ²˜λ¦¬ν•˜λŠ” 것을 의미. 운영 μ²΄μ œμ—μ„œλŠ” λ©€ν‹° νƒœμŠ€ν‚Ήμ„ ν•  수 μžˆλ„λ‘ CPU 및 λ©”λͺ¨λ¦¬ μžμ›μ„ 적절히 ν• λ‹Ήν•˜κ³  λ³‘λ ¬λ‘œ μ‹€ν–‰μ‹œν‚¨λ‹€. 할당받은 λ©”λͺ¨λ¦¬λ₯Ό 가지고 μ‹€ν–‰ν•˜κΈ° λ•Œλ¬Έμ— 독립적이닀. 메인 μŠ€λ ˆλ“œ μžλ°” μ• ν”Œλ¦¬μΌ€μ΄μ…˜μ€ 메인 μŠ€λ ˆλ“œ(main thread)κ°€ main() λ©”μ†Œλ“œλ₯Ό μ‹€ν–‰ ν•˜λ©΄μ„œ μ‹œμž‘. 메인 μŠ€λ ˆλ“œλŠ” ν•„μš”μ— 따라 μž‘μ—… μŠ€λ ˆλ“œλ₯Ό λ§Œλ“€μ–΄ λ³‘λ ¬λ‘œ μ‹€ν–‰ κ°€λŠ₯ν•˜λ‹€.

[Issue Note] H2 Database ~ not found, and IFEXISTS=true, so we cant auto-create it [90146-199]

이슈 ν•΄λ‹Ή 정보λ₯Ό μž…λ ₯ν•˜κ³  연결정보λ₯Ό ν΄λ¦­μ‹œ μ•„λž˜μ™€ 같은 μ—λŸ¬κ°€ λ°œμƒν•˜μ˜€λ‹€. Database "/Users/riley/test" not found, and IFEXISTS=true, so we cant auto-create it [90146-199] 90146/90146 문제 ν•΄κ²° 단계 μ•„λž˜ 링크λ₯Ό ν†΅ν•˜μ—¬ test λΌλŠ” μ΄λ¦„μ˜ μƒˆλ‘œμš΄ λ°μ΄ν„°λ² μ΄μŠ€λ₯Ό μƒμ„±ν•΄μ€ŒμœΌλ‘œμ¨ ν•΄κ²°ν•˜μ˜€λ‹€. http://www.h2database.com/html/tutorial.html#creating_new_databases 1 2 # μ„€μΉ˜κ²½λ‘œλ‘œ 이동 cd /Users/riley/Utils/h2/bin μ΄λ™ν•˜λ©΄ h2-버전λͺ… jar 파일이 μžˆλ‹€. h2 μ‰˜μ„ μ•„λž˜μ™€ 같이 μ‹€ν–‰ν•΄μ€€λ‹€. 1 java -cp h2-1.4.199.jar org.h2.tools.Shell URL 은 jdbc:h2:~/test 둜 μ§€μ •ν•˜μ˜€λ‹€. jdbc:h2:~/test 둜 접속 URL 을 μ„€μ •ν•˜μ˜€μ§€λ§Œ μ–΄ν”Œλ¦¬μΌ€μ΄μ…˜μ—μ„œ μ ‘μ†μ‹œ URL 은 jdbc:h2:tcp://localhost/~/test 둜 μ ‘μ†ν•΄μ•Όν•œλ‹€.

AWS CentOS 7 ν…ŒμŠ€νŠΈ μ„œλ²„ κ΅¬μΆ•ν•˜κΈ°

λͺ©ν‘œ 😁😁😁 AWSμ—μ„œ Cent OS 7둜 ν…ŒμŠ€νŠΈ μ„œλ²„λ₯Ό κ΅¬μΆ•ν•œλ‹€. μ½˜μ†”μ ‘μ†κ²½λ‘œ AWS EC2 μΈμŠ€ν„΄μŠ€ μΆ”κ°€ν•˜κΈ° 1. μ½˜μ†” λŒ€μ‹œλ³΄λ“œμ—μ„œ μΈμŠ€ν„΄μŠ€ μ‹œμž‘μ„ μ„ νƒν•œλ‹€. 2. Amazon Machine Image(AMI)μ—μ„œ μΈμŠ€ν„΄μŠ€ ν…œν”Œλ¦Ώμ„ μ„ νƒν•œλ‹€. 검색 창에 centosλ₯Ό 검색 ν›„ μ›ν•˜λŠ” 버전을 μ„ νƒν•œλ‹€. 3. μΈμŠ€ν„΄μŠ€ μœ ν˜• 선택 νŽ˜μ΄μ§€μ—μ„œ ν•˜λ“œμ›¨μ–΄ ꡬ성을 μ„ νƒν•œλ‹€. 일단 λ‚œ ν”„λ¦¬ν‹°μ–΄λ‹ˆκΉ… t2.microλ₯Ό 선택 πŸ€” 4. πŸ€·πŸ»β€β™€οΈ κ²€ν†  ν›„ μ‹œμž‘(Review and Launch) λ²„νŠΌμ„ ν΄λ¦­ν•˜μ—¬ ꡬ성을 μ™„λ£Œν•œλ‹€. 5. λ³΄μ•ˆ κ·Έλ£Ή ꡬ성 6. μΈμŠ€ν„΄μŠ€ μ‹œμž‘ κ²€ν†  νŽ˜μ΄μ§€μ—μ„œ μ‹œμž‘μ„ μ„ νƒν•œλ‹€.

[μ‹œμž‘ν•˜μ„Έμš”! 도컀/μΏ λ²„λ„€ν‹°μŠ€] Chapter 1. 도컀

μ‹œμž‘ν•˜μ„Έμš”! 도컀/μΏ λ²„λ„€ν‹°μŠ€ μ±… 정리 🐳🐳🐳 도컀(docker)λŠ” λ¦¬λˆ…μŠ€ μ»¨ν…Œμ΄λ„ˆμ— μ—¬λŸ¬ κΈ°λŠ₯을 μΆ”κ°€ν•¨μœΌλ‘œμ¨ μ• ν”Œλ¦¬μΌ€μ΄μ…˜μ„ μ»¨ν…Œμ΄λ„ˆλ‘œμ„œ μ’€ 더 μ‰½κ²Œ μ‚¬μš©ν•  수 있게 λ§Œλ“€μ–΄μ§„ μ˜€ν”ˆμ†ŒμŠ€ ν”„λ‘œμ νŠΈμ΄λ‹€. GO μ–Έμ–΄λ‘œ μž‘μ„±λ˜μ–΄ 있으며 2013λ…„ 3월에 첫 번째 λ¦΄λ¦¬μŠ€κ°€ λ°œν‘œλœ 이후 μ§€κΈˆκΉŒμ§€ κΎΈμ€€νžˆ 개발되고 μžˆλ‹€. 도컀와 κ΄€λ ¨λœ ν”„λ‘œμ νŠΈ Docker Compose Private Registry Docker Machine Kitematic 도컀라고 ν•˜λ©΄ Docker Engine ν˜Ήμ€ 도컀와 κ΄€λ ¨λœ λͺ¨λ“  ν”„λ‘œμ νŠΈλ₯Ό μ˜λ―Έν•œλ‹€. 도컀 μƒνƒœκ³„μ— μžˆλŠ” μ—¬λŸ¬ ν”„λ‘œμ νŠΈλ“€μ€ 도컀 엔진을 μ’€ 더 효율적으둜 μ‚¬μš©ν•˜κΈ° μœ„ν•œ 것에 λΆˆκ³Όν•˜λ©° 핡심이 λ˜λŠ” 것은 도컀 엔진이닀.

[μžλ°” ORM ν‘œμ€€ JPA ν”„λ‘œκ·Έλž˜λ°] 6μž₯ λ‹€μ–‘ν•œ 연관관계 맀핑 - μΌλŒ€λ‹€

μžλ°” ORM ν‘œμ€€ JPA ν”„λ‘œκ·Έλž˜λ° ν•™μŠ΅ λ‚΄μš© μ •λ¦¬ν•œ ν¬μŠ€νŒ… μž…λ‹ˆλ‹€. μΌλŒ€λ‹€ μΌλŒ€λ‹€ κ΄€κ³„λŠ” μ—”ν‹°ν‹°λ₯Ό ν•˜λ‚˜ 이상 μ°Έμ‘°ν•  수 μžˆμœΌλ―€λ‘œ μžλ°” μ»¬λ ‰μ…˜ (Collection, List, Set, Map ) 쀑 ν•˜λ‚˜λ₯Ό μ‚¬μš©ν•œλ‹€. μΌλŒ€λ‹€ 단방ν–₯ [1:N] μΌλŒ€λ‹€ 단방ν–₯ κ΄€κ³„λŠ” JPA 2.0 λΆ€ν„° μ§€μ›ν•œλ‹€. μΌλŒ€λ‹€ 단방ν–₯의 경우 λ°˜λŒ€νŽΈμ—μ„œ ν…Œμ΄λΈ”μ˜ μ™Έλž˜ν‚€λ₯Ό κ΄€λ¦¬ν•˜λŠ” νŠΉμ΄ν•œ λͺ¨μŠ΅μ΄ λ‚˜νƒ€λ‚œλ‹€. Team.java 1 2 3 4 5 6 7 8 9 10 11 12 13 14 @Entity public class Team { @Id @GeneratedValue @Column(name = "TEAM_ID") private String id; private String name; @OneToMany @JoinColumn (name = "TEAM_ID") // MEMBER ν…Œμ΄λΈ”μ˜ TEAM_ID (FK) private List<Member> members = new ArrayList<Member>(); } Member.