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

kafka-to-postgresql: Postgres not yet available: pq: database "sslmode=true" does not exist #1406

Open
desertspider opened this issue Jan 6, 2023 · 2 comments · Fixed by #1419
Labels
type: bug Something isn't working

Comments

@desertspider
Copy link

Expected Behavior

I am testing kafka-to-postgresql. I get the following Error:

kafka-to-postgresql: Postgres not yet available: pq: database "sslmode=true" does not exist

My docker compose:

  kafka-to-postgresql:
    image: a0aa3649a177
    restart: always
    environment:
     - DRY_RUN=false
     - KAFKA_BOOTSTRAP_SERVER=kafka:9092
     - KAFKA_LISTEN_TOPIC=^ia.+
     - POSTGRES_HOST='azuretenant.postgres.database.azure.com'
     - POSTGRES_PORT=5432
     - POSTGRES_SSLMODE=true
     - POSTGRES_USER=username
     - POSTGRES_PASSWORD=password
     - POSTGRES_DB=FACTORYINSIGHT_DATABASE
    depends_on:
     - kafka

POSTGRES_SSLMODE to false gives the same error, only with database sslmode=false

Clearly it uses the ssl mode als database name.

I pulled the latest code from git and compiled all the images with "compile_all_containers.sh"

If i use the Postgres 12 default docker compose database, i get errors that SSL is not enabled (even if i set SSLMODE to false)

Current Behavior

.

Relevant log output

No response

Steps to Reproduce

.

Context (Environment)

.

Possible Solution

No response

Version

not applicable

Anything else?

No response

@desertspider desertspider added the type: bug Something isn't working label Jan 6, 2023
@Scarjit
Copy link
Member

Scarjit commented Jan 6, 2023

The key should be POSTGRES_DATABASE instead of POSTGRES_DB.

We should make it give out an better error if it not set.

// Postgres
PQHost := os.Getenv("POSTGRES_HOST")
PQPort := 5432
PQUser := os.Getenv("POSTGRES_USER")
PQPassword := os.Getenv("POSTGRES_PASSWORD")
PWDBName := os.Getenv("POSTGRES_DATABASE")
PQSSLMode := os.Getenv("POSTGRES_SSLMODE")
if PQSSLMode == "" {
PQSSLMode = "require"
} else {
zap.S().Warnf("Postgres SSL mode is set to %s", PQSSLMode)
}

@desertspider
Copy link
Author

Good catch. I just copied the compose commands from
deployment/kafka-to-postgresql/docker-compose.yml
without checking the ENV variables. Changing to POSTGRES_DATABASE fixes the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
2 participants