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

Windows Installation Failing | PostgreSQL Initialization Error #2

Closed
n4ze3m opened this issue Jun 7, 2023 · 4 comments
Closed

Windows Installation Failing | PostgreSQL Initialization Error #2

n4ze3m opened this issue Jun 7, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@n4ze3m
Copy link
Owner

n4ze3m commented Jun 7, 2023

Encountered an issue while running a PostgreSQL Docker container on Windows. logs:

postgres  | The files belonging to this database system will be owned by user "postgres".
postgres  | This user must also own the server process.
postgres  |
postgres  | The database cluster will be initialized with locale "en_US.utf8".
postgres  | The default database encoding has accordingly been set to "UTF8".
postgres  | The default text search configuration will be set to "english".
postgres  |
postgres  | Data page checksums are disabled.
postgres  |
postgres  | fixing permissions on existing directory /var/lib/postgresql/data ... ok
postgres  | creating subdirectories ... ok
postgres  | selecting dynamic shared memory implementation ... posix
postgres  | selecting default max_connections ... 100
postgres  | selecting default shared_buffers ... 128MB
postgres  | selecting default time zone ... Etc/UTC
postgres  | creating configuration files ... ok
postgres  | running bootstrap script ... ok
postgres  | performing post-bootstrap initialization ... ok
postgres  | syncing data to disk ... initdb: warning: enabling "trust" authentication for local connections
postgres  | initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.
postgres  | ok
postgres  |
postgres  |
postgres  | Success. You can now start the database server using:
postgres  |
postgres  |     pg_ctl -D /var/lib/postgresql/data -l logfile start
postgres  |
postgres  | waiting for server to start....2023-06-07 10:41:08.567 UTC [49] LOG:  starting PostgreSQL 15.3 (Debian 15.3-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
postgres  | 2023-06-07 10:41:08.572 UTC [49] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres  | 2023-06-07 10:41:08.626 UTC [52] LOG:  database system was shut down at 2023-06-07 10:41:05 UTC
postgres  | 2023-06-07 10:41:08.728 UTC [49] LOG:  database system is ready to accept connections
postgres  |  done
postgres  | server started
postgres  | CREATE DATABASE
postgres  |
postgres  |
postgres  | /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/init.sh
postgres  | /usr/bin/env: ‘bash\r’: No such file or directory
postgres exited with code 127

The error seems to be related to the entrypoint script (docker-entrypoint-initdb.d/init.sh) failing with the following error: "/usr/bin/env: ‘bash\r’: No such file or directory".

@n4ze3m n4ze3m added the bug Something isn't working label Jun 7, 2023
@jmanhype
Copy link

jmanhype commented Jun 7, 2023

Environment variables loaded from .env
Prisma schema loaded from schema.prisma
Datasource "db": PostgreSQL database "dialoqbase", schema "public" at "postgres:5432"

Error: P1001: Can't reach database server at postgres:5432

Please make sure your database server is running at postgres:5432.
PS C:\Users\strau\dialoqbase\server\prisma>

@jmanhype
Copy link

jmanhype commented Jun 7, 2023

thank you for being up and working ive been tryin to get to work all night nothing is working right now I even tried to run my own postgres server but it wont allow me to run it in the docker file keeps saying is this server running.
when I user your settings I get this Invalid prisma.user.findFirst() invocation: The table public.User does not exist in the current database.

when I did on my own I Tried to The Prisma schema you've shared seems correct and the User model is defined. There could be a few reasons why you're still seeing the error message that the User table does not exist.

Here's a few possible reasons and their solutions:

  1. Database migration hasn't been run yet: Prisma doesn't automatically create tables in your database when you define models in the schema. It requires you to run a migration. If you haven't done that yet, here's how:

    npx prisma migrate dev --name init

    This command will create a new migration, and apply it to your database. The --name init is optional and gives the migration a name ("init" in this case).

  2. Database URL might be incorrect: Please ensure that the DATABASE_URL environment variable is pointing to the correct database. Check the .env file or wherever you're storing your environment variables.

  3. Wrong schema or database: If you're using Postgres and have multiple schemas or databases, ensure that you're using the right one. The default schema for Postgres is public.

If you've already run a migration and the table still isn't appearing, there might be an issue with the database connection or the migration itself. Check the output of the migration command for any error messages or warnings. Also, ensure you're looking at the right database and schema if you're inspecting the database manually.

@n4ze3m
Copy link
Owner Author

n4ze3m commented Jun 7, 2023

I have created a custom PostgreSQL image with an "init.sh" script that resolves the Windows installation bash error. I recommend pulling the latest repository and giving it another try. I apologize for not testing Docker on Windows myself.

@jmanhype
Copy link

jmanhype commented Jun 7, 2023

thank you very much its working 👯

@n4ze3m n4ze3m closed this as completed Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants