-
Notifications
You must be signed in to change notification settings - Fork 163
Description
Description:
There is an inconsistency in the DATABASE_URL configuration between the Docker setup instructions and the .env.example files in the repository, which may cause issues when booting up the application.
Steps to Reproduce:
-
Follow the Docker setup instructions in the
README.md:docker run -d \ --name muzer-db \ -e POSTGRES_USER=myuser \ -e POSTGRES_PASSWORD=mypassword \ -e POSTGRES_DB=mydatabase \ -p 5432:5432 \ postgres
In this setup, the
POSTGRES_USERis set tomyuserandPOSTGRES_PASSWORDis set tomypassword. -
Compare the
DATABASE_URLin the.env.examplefiles for bothnext-appandwsfolders:DATABASE_URL=postgresql://postgres:postgres@postgres:5432/postgres
Problems:
-
Inconsistent Credentials:
The Docker setup usesmyuserandmypassword, whereas the.env.examplefile usespostgresfor both the username and password. This inconsistency can lead to authentication errors when starting the application, as theDATABASE_URLwon't match the credentials defined in the Docker container. -
Hostname Mismatch:
The.env.examplefiles usepostgresas the host (@postgres:5432), assuming the application is being run inside a Docker network. However, when not using Docker, the hostname should belocalhost:DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
This causes a problem for users who are not using Docker, as the application tries to connect to
postgresinstead oflocalhost.
Proposed Solutions:
-
Update the Docker instructions in the
README.mdto match the.env.examplefile, using:docker run -d \ --name muzer-db \ -e POSTGRES_USER=postgres \ -e POSTGRES_PASSWORD=postgres \ -e POSTGRES_DB=postgres \ -p 5432:5432 \ postgres
-
Modify the
.env.examplefile to include a note or conditional configuration for users who are not using Docker, ensuring they switch the host tolocalhost:# When using Docker, use the 'postgres' hostname # DATABASE_URL=postgresql://postgres:postgres@postgres:5432/postgres # For non-Docker setups, use 'localhost' DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
Additional Information:
- The mismatch between
localhostandpostgrescreates boot-up errors for users who are not running the database in a Docker network. - Providing clear instructions for both Docker and non-Docker setups would improve the developer experience and reduce confusion.
Please let me know if any further clarification is needed!