Skip to content

Invalid database name #230

@jawira

Description

@jawira

Describe the issue

When using custom configuration for Postgres (database, user and password), Weblate container will stop because it will not be able to connect to database.

For example if I use the following values in ./environment, then Weblate container will never start properly:

POSTGRES_DATABASE=weblate
POSTGRES_USER=wluser
POSTGRES_PASSWORD=wlpass

The reason is that in Postgres 16 the default environment variable for declaring a database is POSTGRES_DB and not POSTGRES_DATABASE.

According to Postgres documentation:

POSTGRES_DB
This optional environment variable can be used to define a different name for the default database that is created when the image is first started. If it is not specified, then the value of POSTGRES_USER will be used.

The default ./environment values will work because you are using the same value for database, username and password.

I already tried

  • I've read and searched the documentation.
  • I've searched for similar filed issues in this repository.

Steps to reproduce the behavior

  1. Clone the weblate-docker repo.
  2. Edit ./environment and use different values for POSTGRES_DATABASE, POSTGRES_USER and POSTGRES_PASSWORD.
  3. Execute docker compose up.
  4. You will see Weblate will never start because it can't establish a connection with database due to unknown database.

Expected behavior

Weblate container must start properly.

Screenshots

As you can see Postgress creates database wluser instead of weblate because POSTGRES_DB is not used.

image

Exception traceback

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething is broken.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions