Open
Description
i am running postgre by WSL2 in ubuntu 24.04, and i am using docker desktop for windows.
when i run wasp start db
, it report below error. but i do not on any process on wsl2 or windows for port 5432.
± |master ?:2 ✗| → wasp start db
✨ Starting a PostgreSQL dev database (based on your Wasp config) ✨
Additional info:
ℹ Connection URL, in case you might want to connect with external tools:
postgresql://postgresWaspDevUser:postgresWaspDevPass@localhost:5432/OpenSaaS-bba774dce6
ℹ Database data is persisted in a docker volume with the following name (useful to know if you will want to delete it at some point):
wasp-dev-db-OpenSaaS-bba774dce6
...
docker: Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:5432 -> 0.0.0.0:0: listen tcp 0.0.0.0:5432: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.
wasp-bin: callCommand: docker run --name wasp-dev-db-OpenSaaS-bba774dce6 --rm --publish 5432:5432 -v wasp-dev-db-OpenSaaS-bba774dce6:/var/lib/postgresql/data --env POSTGRES_PASSWORD=postgresWaspDevPass --env POSTGRES_USER=postgresWaspDevUser --env POSTGRES_DB=OpenSaaS-bba774dce6 postgres (exit 125): failed
i try run bare docker command directly, it works this time.
2024-12-22 03:03:37 ⌚ ming-r7000 in ~/github/feitian124/wearit/app
± |master ?:2 ✗| → sudo docker run --name wasp-dev-db-OpenSaaS-bba774dce6 --rm --publish 5432:5432 -v wasp-dev-db-OpenSaaS-bba774dce6:/var/lib/postgresql/data --env POSTGRES_PASSWORD=postgresWaspDevPass --env POSTGRES_USER=postgresWaspDevUser --env POSTGRES_DB=OpenSaaS-bba774dce6 postgres
PostgreSQL Database directory appears to contain a database; Skipping initialization
2024-12-21 19:03:43.907 UTC [1] LOG: starting PostgreSQL 17.2 (Debian 17.2-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
2024-12-21 19:03:43.911 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2024-12-21 19:03:43.922 UTC [1] LOG: listening on IPv6 address "::", port 5432
2024-12-21 19:03:43.932 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-12-21 19:03:43.943 UTC [29] LOG: database system was shut down at 2024-12-21 18:24:50 UTC
2024-12-21 19:03:43.958 UTC [1] LOG: database system is ready to accept connections
but later steps report error too:
± |master ?:2 ✗| → wasp db migrate-dev
🐝 --- Setting up database... -----------------------------------------------------
[ Db !] Error: P1001
[ Db !]
[ Db !] Can't reach database server at `localhost:5432`
[ Db !]
[ Db !] Please make sure your database server is running at `localhost:5432`.
[ Db !]
[ Db ] Environment variables loaded from .env
[ Db ] Prisma schema loaded from ../db/schema.prisma
[ Db ]
[ Db ] ✔ Generated Prisma Client (v5.19.1) to ./../../../node_modules/@prisma/client in 116ms
❌ --- [Error] Can not connect to database: ---------------------------------------
The database needs to be running in order to execute this command. You can easily start a managed dev database with `wasp start db`.
i run wasp db studio
, i can see my database are runing and can see studio page,
obviously my database is running on 5432, not sure why wasp db migrate-dev
and wasp start
not work.
does anyone met same problem?
and also, does this repo support sqlite?
thank you.
Activity
vincanger commentedon Jan 7, 2025
Maybe @martinovicdev, our resident WSL hacker, or @Martinsos know what to do here?
martinovicdev commentedon Jan 12, 2025
This could have been caused by the incomplete Docker Desktop installation. Here is a step by step guide based on official Docker guide https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user:
Run
sudo groupadd docker
If the group exists, continue with the following steps anyways.
Now add your user to docker group by running
sudo usermod -aG docker $USER
where USER is your username. In my case, it would be
sudo usermod -aG docker martinovicdev
Now log out and log back in to the WSL2 shell. Run
su -s $USER
Now try out the
wasp db start
command and it should work.vincanger commentedon Jan 13, 2025
oh nice thanks for this @martinovicdev!
@feitian124 let us know if this solves your issue!
feitian124 commentedon Jan 19, 2025
sorry for delay, i tried today, it report the same error:
@martinovicdev what the step 3 purpose?
it also report error.
and thank you for help, you can close this issue since i know this is mainly a enviroment issue, not really close related to wasp, i will try use a real linux desktop instead of wsl2.