Open etayruben opened 2 years ago
It's not clear what is your setup: pg version? how you created certs? how you deliver them into container, etc
I created the certs through using openssl and i know they work because i use them in my PgAdmin4 and some code i wrote with sqlalchemy
Im using PostgresSQL 12.2
I deliver the certs to the container with COPY command from my docker file and i change the mode of the certs to 600 after
I have the same issue. I configured a GCP cloud run with label studio community edition to connect to a GCP PostgreSQL version 15.
psycopg2.OperationalError: connection to server at "10.96.48.50", port 5432 failed: FATAL: connection requires a valid client certificate
By the way, I tested the same certificates with other container images, such as Pgadmin, directus, and retool, and it worked.
# Use the official Label Studio image as a parent image
FROM --platform=linux/amd64 heartexlabs/label-studio:latest
# Set environment variables for Label Studio
ENV DATABASE_URL=postgres://myuser:mypassword@myhost:5432/mydatabase
ENV DATABASE_SSLMODE=require
ENV DATABASE_SSLROOTCERT=/etc/ssl/certs/ca-certificates.crt
ENV DATABASE_SSLCERT=/etc/ssl/certs/client-cert.pem
ENV DATABASE_SSLKEY=/etc/ssl/private/client-key.pem
# Copy the SSL certificates into the container
COPY path/to/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY path/to/client-cert.pem /etc/ssl/certs/client-cert.pem
COPY path/to/client-key.pem /etc/ssl/private/client-key.pem
# Expose the port Label Studio runs on
EXPOSE 8080
# Run Label Studio
CMD ["label-studio"]
I also tested it with the following env variable:
DATABASE_URL=postgres://postgres:xxxx@xx-xxxxx-xxxx-xxxx-xxxx-xxxx.us-east4.sql.goog:5432/postgres?sslmode=verify-full&sslrootcert=/label-studio/root.crt&sslcert=/label-studio/postgresql.crt&sslkey=/label-studio/postgresql.key
The above env variables did not work for the SSL mode: verify-full
@makseq Could you please share the environment variable names I need to configure for the label studio SSL connection with PostgreSQL?
Hi @makseq, I also found the PR to enable TLS on pgsql: https://github.com/HumanSignal/label-studio/pull/1737/files. it for the PostgreSQL version 11.5. I am using GCP postgresql 15 or 16 and GCP cloud run for label studio community edition now and it has the following three certificates:
Could you please share the instructions for the SSL connection?
I’m trying to connect my label studio to posgresql with client.crt and client.key certificates but i can’t manage to do it
Label studio version: V1.4 OS: linux Trying to run it in a docker container
This is the error I’m getting: The above exception was the direct cause of the following exception: