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

DB user cannot create extensions during db migrations (using PostgreSQL - Flexible Server in Azure) #6721

Open
yavorivanov-cw opened this issue Nov 26, 2024 · 1 comment

Comments

@yavorivanov-cw
Copy link

yavorivanov-cw commented Nov 26, 2024

Describe the bug
We installed the helm chart on our AKS and we wanted to use an Azure Database for PostgreSQL - Flexible Server. When the container tries to do the DB migrations it throws the following error (see bellow). As discussed here and documented here the user needs to be member of the azure_pg_admin role (something that we want to avoid). This was introduces in the new updates of the server.

It would be nice to have this create-extension disabled when using Azure Database for PostgreSQL - Flexible Server as host. For other applications we already use a workaround (pod that executes the create extension commands for us). Of course we would need to know which extensions we have to create.

The error that we get is:

django.db.utils.ProgrammingError: Only members of "azure_pg_admin" are allowed to use CREATE EXTENSION

To Reproduce
Steps to reproduce the behavior:

  1. Install the helm chart on AKS
helm repo add heartex https://charts.heartex.com/
helm search repo heartex
helm install my-release heartex/label-studio --values values.yaml
  1. Use Azure Database for PostgreSQL - Flexible Server as host

with the following values.yaml

global:
  image:
  pgConfig:
    dbName: labelstudio #POSTGRE_NAME
    host: examplepsql.postgres.database.azure.com  #POSTGRE_HOST
    port: 5432 #POSTGRE_PORT
    userName: labelstudio #POSTGRE_USER
    password:  #POSTGRE_PASSWORD
      secretName: label-studio-db-credentials
      secretKey: POSTGRES_PASSWORD

  persistence:
    enabled: true
    type: azure
    config:
        azure:
          storageAccountNameExistingSecret: "azure-secret"
          storageAccountNameExistingSecretKey: "azurestorageaccountname"
          storageAccountKeyExistingSecret: "azure-secret"
          storageAccountKeyExistingSecretKey: "azurestorageaccountkey"
          containerName: "label-studio"

app:
  FullnameOverride: label-studio
  ingress:
    enabled: false

postgresql:
  enabled: false

cronjob:
  enabled: false

metrcis:
  enabled: true

Expected behavior
DB migrations to be succesfull

Environment (please complete the following information):

  • OS: AKS
  • Label Studio Version: 1.14.0.post0
@farioas
Copy link
Member

farioas commented Nov 28, 2024

It's already supported but not well documented:
https://github.com/HumanSignal/label-studio/blob/develop/label_studio/core/utils/common.py#L658-L662

Just add SKIP_TRIGRAM_EXTENSION=true env varible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants