InfoGrab DocsInfoGrab Docs

pgai Ruby 젬을 사용한 Database Lab 접근

요약

@mbobin 이 만든 pgai Ruby Gem은 데이터베이스 클론 접근을 크게 단순화하며, 다음을 지원합니다. pgai gem을 설정하는 방법은 다음과 같습니다. 먼저 Postgres.ai instances page에서 몇 가지 값을 수집해야 합니다.

@mbobin 이 만든 pgai Ruby Gem은 데이터베이스 클론 접근을 크게 단순화하며, 다음을 지원합니다.

  • Postgres.ai instances page에 나열된 모든 데이터베이스 클론에 접근.
  • 동일한 클론에서 여러 개의 psql 세션 사용.

사전 요구 사항#

pgai gem을 설정하는 방법은 다음과 같습니다.

  1. 먼저 Postgres.ai instances page에서 몇 가지 값을 수집해야 합니다.

    1. 설정하려는 인스턴스로 이동한 다음 화면 오른쪽을 확인합니다.

    2. Connection에서 Connect를 선택합니다. 메뉴가 접혀 있을 수 있습니다.

      설정에 필요한 모든 정보가 담긴 대화 상자가 다음 형식으로 나타납니다.

      dblab init --url "http://127.0.0.1:<local-port>" --token TOKEN --environment-id <environment-id>
      
      ssh -NTML <local-port>:localhost:<instance-port> <instance-host> -i ~/.ssh/id_rsa
      
  2. ssh를 설정하려면 psql로 콘솔 접근의 안내를 따르며, ${USER}를 본인의 postgres.ai 사용자 이름으로 바꿉니다.

  3. 다음 명령을 실행합니다.

    gem install pgai
    
    # Generate an encryption key and store it in 1Password
    pgai enc keygen
    
    # Before running the following command,
    # grab an access token from https://console.postgres.ai/gitlab/tokens
    pgai config --prefix=<postgresai-user>
    
    # Grab the respective port values from https://console.postgres.ai/gitlab/instances
    # for the instances you'll be using (in this case, for the `main` database instance)
    pgai env add --alias main --id <instance-host> --port <instance-port> -n gitlabhq_dblab
    
  4. 이 일회성 설정을 마치면 pgai connect로 특정 데이터베이스에 연결할 수 있습니다. 예를 들어 main 데이터베이스에 연결하려면 다음과 같이 실행합니다.

    pgai connect main
    
  5. 클론 사용을 마치면 다음과 같이 삭제할 수 있습니다.

    pgai destroy main
    

pgai Ruby 젬을 사용한 Database Lab 접근

GitLab v19.4
원문 보기

요약

@mbobin 이 만든 pgai Ruby Gem은 데이터베이스 클론 접근을 크게 단순화하며, 다음을 지원합니다. pgai gem을 설정하는 방법은 다음과 같습니다. 먼저 Postgres.ai instances page에서 몇 가지 값을 수집해야 합니다.

@mbobin 이 만든 pgai Ruby Gem은 데이터베이스 클론 접근을 크게 단순화하며, 다음을 지원합니다.

  • Postgres.ai instances page에 나열된 모든 데이터베이스 클론에 접근.
  • 동일한 클론에서 여러 개의 psql 세션 사용.

사전 요구 사항#

pgai gem을 설정하는 방법은 다음과 같습니다.

  1. 먼저 Postgres.ai instances page에서 몇 가지 값을 수집해야 합니다.

    1. 설정하려는 인스턴스로 이동한 다음 화면 오른쪽을 확인합니다.

    2. Connection에서 Connect를 선택합니다. 메뉴가 접혀 있을 수 있습니다.

      설정에 필요한 모든 정보가 담긴 대화 상자가 다음 형식으로 나타납니다.

      dblab init --url "http://127.0.0.1:<local-port>" --token TOKEN --environment-id <environment-id>
      
      ssh -NTML <local-port>:localhost:<instance-port> <instance-host> -i ~/.ssh/id_rsa
      
  2. ssh를 설정하려면 psql로 콘솔 접근의 안내를 따르며, ${USER}를 본인의 postgres.ai 사용자 이름으로 바꿉니다.

  3. 다음 명령을 실행합니다.

    gem install pgai
    
    # Generate an encryption key and store it in 1Password
    pgai enc keygen
    
    # Before running the following command,
    # grab an access token from https://console.postgres.ai/gitlab/tokens
    pgai config --prefix=<postgresai-user>
    
    # Grab the respective port values from https://console.postgres.ai/gitlab/instances
    # for the instances you'll be using (in this case, for the `main` database instance)
    pgai env add --alias main --id <instance-host> --port <instance-port> -n gitlabhq_dblab
    
  4. 이 일회성 설정을 마치면 pgai connect로 특정 데이터베이스에 연결할 수 있습니다. 예를 들어 main 데이터베이스에 연결하려면 다음과 같이 실행합니다.

    pgai connect main
    
  5. 클론 사용을 마치면 다음과 같이 삭제할 수 있습니다.

    pgai destroy main