shinhancard / dev-portal

Shinhancard developer portal public github repository
Apache License 2.0
9 stars 2 forks source link

docs: postgresql install #48

Closed hellices closed 1 year ago

hellices commented 1 year ago

Current State

현재 구성되는 서버는 sqlite3를 인메모리 형식으로 사용중이나, 개발 서버에는 데이터 유지를 위해 별도 db가 필요할듯.

Desired State

postgresql을 sandbox에 설치

hellices commented 1 year ago

postgresql helm chart backstage k8s deploy

hellices commented 1 year ago

Please be patient while the chart is being deployed

PostgreSQL can be accessed via port 5432 on the following DNS names from within your cluster:

backstage-postgresql.swa-hih.svc.cluster.local - Read/Write connection

To get the password for "postgres" run:

export POSTGRES_ADMIN_PASSWORD=$(kubectl get secret --namespace swa-hih backstage-postgresql -o jsonpath="{.data.postgres-password}" | base64 -d)

To get the password for "backstage" run:

export POSTGRES_PASSWORD=$(kubectl get secret --namespace swa-hih backstage-postgresql -o jsonpath="{.data.password}" | base64 -d)

To connect to your database run the following command:

kubectl run backstage-postgresql-client --rm --tty -i --restart='Never' --namespace swa-hih --image docker.io/bitnami/postgresql:15.3.0-debian-11-r24 --env="PGPASSWORD=$POSTGRES_PASSWORD" \
  --command -- psql --host backstage-postgresql -U backstage -d backstage -p 5432

> NOTE: If you access the container using bash, make sure that you execute "/opt/bitnami/scripts/postgresql/entrypoint.sh /bin/bash" in order to avoid the error "psql: local user with ID 1001} does not exist"

To connect to your database from outside the cluster execute the following commands:

kubectl port-forward --namespace swa-hih svc/backstage-postgresql 5432:5432 &
PGPASSWORD="$POSTGRES_PASSWORD" psql --host 127.0.0.1 -U backstage -d backstage -p 5432

WARNING: The configured password will be ignored on new installation in case when previous PostgreSQL release was deleted through the helm command. In that case, old PVC will have an old password, and setting it through helm won't take effect. Deleting persistent volumes (PVs) will solve the issue.

hellices commented 1 year ago

접속 확인 완료 스크린샷 2023-07-19 오후 4 17 55 퍼블릭 엔드포인트 구성 안 함.

서비스 정보

backstage-postgresql:5432

hellices commented 1 year ago

eks 의 swa-hih 네임스페이스에 secret 생성 - postgres-secrets https://backstage.io/docs/deployment/k8s#creating-a-postgresql-secret

아래를 따라 마무리하면 됨 https://backstage.io/docs/deployment/k8s#creating-a-backstage-deployment

hellices commented 1 year ago

로컬환경에서 접속할 수 있는 방안 검토. ingress를 붙이자

hellices commented 1 year ago

alb는 L7 proxy로 TCP통신 불가 pgadmin을 설치

url : https://swa-pgadm.shrnd.link/ 계정정보는 별도 컨택바람. @seowjin1060 @hemoi @jobum97 @dev-shin @YOOMYE89 @wijihoon