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

🔨 [Chore] PostGIS 설정 #17

Merged
merged 5 commits into from
Aug 30, 2024
Merged

🔨 [Chore] PostGIS 설정 #17

merged 5 commits into from
Aug 30, 2024

Conversation

kimdoyeonn
Copy link
Contributor

@kimdoyeonn kimdoyeonn commented Aug 29, 2024

Summary

  • PostGIS 확장 세팅

Describe your changes

  • PostgreSQL 이미지를 PostGIS 확장을 포함한 이미지로 변경했습니다.
  • 새로운 DB 생성시 PostGIS를 활성화하는 sql을 실행하도록 docker-entrypoint-initdb.d 폴더에 init.sql에 쿼리를 추가했습니다.
  • member, restaurant 테이블에 geometry 타입의 location 컬럼 추가하였습니다.

Issue number and link

closed #14
closed #18

- PostgreSQL 이미지를 PostGIS 확장을 포함한 이미지로 변경
- 새로운 DB 생성시 PostGIS를 활성화하는 sql을 실행
- member, restaurant에 location 컬럼 추가
@kimdoyeonn kimdoyeonn added the enhancement New feature or request label Aug 29, 2024
@kimdoyeonn kimdoyeonn self-assigned this Aug 29, 2024
Copy link
Contributor

@jis-kim jis-kim left a comment

Choose a reason for hiding this comment

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

아... 위키 읽고 왔는데 플랫폼 문제가 있었군요... docker hub 가서 확인해보니 지원 플랫폼에 amd64만 지원한다고 써져있네요..
Screenshot 2024-08-29 at 11 14 14 PM

로제타 덕분에 돌아가기는 할 것 같은데 썩 좋은 방법은 아닌 것 같습니다. 다은님이 저번 프로젝트 하실 땐 이거 어떻게 해결하셨을까요? @ooheunda 혹시 docker 설정하신 분이 인텔맥이었으면 그대로 하셨을 수도..
저희는 큰 기능을 쓰는 게 아니니 ... 해결 방법은 두 가지가 있을 것 같습니다.

  1. 다른 사용자가 만들어놓은 arm64 이미지 사용하기
  • arm64 지원해달라는 이슈에서 arm64이미지 를 만들어 놓은 분이 계십니다(도커에서 스폰서도 받음). 도커허브에서 이거 찾아서 image 지정하는 방법이 있습니다.
  1. 저희가 Dockerfile 만들어서 쓰기
  • 저희는 딱 postgis 만 필요해서 그냥 plugin깔고 use extension 하는 sql까지 실행하는 이미지 만들어도 됩니다.
    지금 init.sql 만들어서 volume에 bind 하시는데 그것보다는 Dockerfile을 만들어 image 생성 단계에서 실행하는 게 좋은 방법이라고 생각합니다. init.sql은 처음 세팅할 때만 필요하고 날아가는 파일이니까 volume 매핑까진 필요없을 것 같아요!

@ooheunda
Copy link
Contributor

@jis-kim 저희 프로젝트 할 땐 관련된 이슈는 따로 없었습니다 ㄱ-...
postgis 이미지 등록하신 분이 윈도우 사용하시긴 했습니다.

도커 무지렁이라 리뷰하며 이거저거 찾아보고 있었는데 정말 생각치도 못한 문제군여...
저는 설정하시는 분 결정에 따르겠습니다!!

- 플랫폼 이슈로 multi-platform 지원하는 PostgreSQL 이미지에서 Dockerfile 생성
- 최소 설정만 넣은 Dockerfile 입니다.
- .env.sample 참고해서 .env의 host 를 맞게 작성하셔야 작동합니다.
@jis-kim
Copy link
Contributor

jis-kim commented Aug 29, 2024

도커파일 작성완료 했습니다.. volume 삭제했다가 다시 npm run docker:dev 해주세요! (삭제방법 README에 써놨습니다)
저는 엔티티에 lon, lat -> location으로 변경된다고 생각했는데 남겨두신 이유가 있을까요?

@kimdoyeonn
Copy link
Contributor Author

@jis-kim 수고하셨습니다~
앗 location에서 lon, lat을 가져올 수 없다고 생각해서 남겨뒀는데 더 찾아보니까 가능하네요! 없애도 될 것 같습니다

- location 컬럼에서 위경도 데이터를 조회할 수 있어 lon, lat 컬럼을 따로 두지 않아도 됨
@jis-kim jis-kim self-requested a review August 30, 2024 01:17
Copy link
Contributor

@ooheunda ooheunda left a comment

Choose a reason for hiding this comment

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

짱 멋있다... 고생하셨습니다~!!👍

Copy link
Contributor

@jis-kim jis-kim left a comment

Choose a reason for hiding this comment

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

LGTM~

@kimdoyeonn kimdoyeonn merged commit 19ad57d into dev Aug 30, 2024
@jis-kim jis-kim deleted the feature/postgis-setup branch August 31, 2024 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🔨 [Chore] PostGIS 커스텀 Dockerfile 생성 🔨 [Chore] PostGIS 설정
3 participants