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

macOS - make postgres-on-docker hangs on "Waiting for PostgreSQL to be ready..." #8630

Closed
xjones opened this issue Nov 21, 2024 · 14 comments · Fixed by #8830
Closed

macOS - make postgres-on-docker hangs on "Waiting for PostgreSQL to be ready..." #8630

xjones opened this issue Nov 21, 2024 · 14 comments · Fixed by #8830

Comments

@xjones
Copy link

xjones commented Nov 21, 2024

I'm following the steps to install Twenty locally on an M4 Max MacBook Pro. I have all of the pre-reqs and Docker installed. When I run make postgres-on-docker it hangs. I can see the Docker container in the Docker console but no visibility into what's happening inside.

make postgres-on-docker
docker run -d \
	--name twenty_pg \
	-e PGUSER_SUPERUSER=postgres \
	-e PGPASSWORD_SUPERUSER=twenty \
	-e ALLOW_NOSSL=true \
	-v twenty_db_data:/home/postgres/pgdata \
	-p 5432:5432 \
	twentycrm/twenty-postgres-spilo:latest
5043e9147946a4a75842da8975fc0c8c9045d74d4a394c1142d33c9315e985cf
Waiting for PostgreSQL to be ready...
@FelixMalfait
Copy link
Member

Could you please check your container logs?

E.g. if you use the Docker GUI:
Image

I just removed all images/cache and tried from scratch and it seemed to work for me...

Thanks

@xjones
Copy link
Author

xjones commented Nov 21, 2024

I looked at the logs and didn't see anything. Already deleted the container so will clear all images/cache and try again. will post results.

@xjones
Copy link
Author

xjones commented Nov 21, 2024

getting the same result. here's the log.Image

@FelixMalfait
Copy link
Member

@xjones strange because as you see I had the same logs and it worked for me 🤔. Maybe there's a problem with the port like a conflict if you already have postgres running locally? It seemed Postgres properly started in your case

@xjones
Copy link
Author

xjones commented Nov 21, 2024

I don't have postgres running locally. looking for any debugging advice.

@xjones
Copy link
Author

xjones commented Nov 21, 2024

looks like postgres is on port 5432. I don't see any conflicts.

@xjones
Copy link
Author

xjones commented Nov 21, 2024

I installed postgres locally via brew and followed the remaining local setup instructions. yarn failed with a bunch of errors. not sure what's wrong and if it's my config or not. that said, while I am interested in trying Twenty I don't have time to dive into what's wrong getting things installed. if there's any info you'd like from me to debug on your end, let me know.

@akirayorunoe
Copy link

same issue when using make redis-on-docker

@BOHEUS
Copy link
Contributor

BOHEUS commented Nov 23, 2024

I can reproduce this issue on my Linux machine as I tried to transition from old Postgres bitnami container to new Postgres spilo container, it's stuck on Waiting for PostgreSQL to be ready... but image is pulled, container is created and functioning so I'm not sure why this is happening in first place, about Redis I didn't reproduce it, pulled new image and built container with it without problems

@alexmotoc
Copy link

alexmotoc commented Nov 23, 2024

Image

I have the same issue when trying to run it locally on MacOS using make postgres-on-docker. Redis is fine for me.

@ekakshjanweja
Copy link

weird but i am getting this same issue on my linux machine too

@uripont
Copy link

uripont commented Nov 30, 2024

same issue here on macOS

2024-11-30 20:46:10 RESET
2024-11-30 20:46:10 2024-11-30 19:46:10,909 WARNING: Could not activate Linux watchdog device: Can't open watchdog device: [Errno 2] No such file or directory: '/dev/watchdog'
2024-11-30 20:46:10 2024-11-30 19:46:10,913 INFO: initialized a new cluster
2024-11-30 20:46:20 2024-11-30 19:46:20,933 INFO: no action. I am (562d91ed3b96), the leader with the lock
2024-11-30 20:46:30 2024-11-30 19:46:30,931 INFO: no action. I am (562d91ed3b96), the leader with the lock
2024-11-30 20:46:40 2024-11-30 19:46:40,947 INFO: no action. I am (562d91ed3b96), the leader with the lock
2024-11-30 20:46:50 2024-11-30 19:46:50,927 INFO: no action. I am (562d91ed3b96), the leader with the lock
2024-11-30 20:47:00 2024-11-30 19:47:00,929 INFO: no action. I am (562d91ed3b96), the leader with the lock
2024-11-30 20:47:08 2024-11-30 19:47:08,378 INFO: establishing a new patroni restapi connection to postgres
2024-11-30 20:47:08 2024-11-30 19:47:08.398 UTC [34] LOG Starting pgqd 3.5
2024-11-30 20:47:08 2024-11-30 19:47:08.399 UTC [34] LOG auto-detecting dbs ...
2024-11-30 20:47:10 2024-11-30 19:47:10,929 INFO: no action. I am (562d91ed3b96), the leader with the lock
2024-11-30 20:47:20 2024-11-30 19:47:20,925 INFO: no action. I am (562d91ed3b96), the leader with the lock
2024-11-30 20:47:30 2024-11-30 19:47:30,944 INFO: no action. I am (562d91ed3b96), the leader with the lock
2024-11-30 20:47:38 2024-11-30 19:47:38.403 UTC [34] LOG {ticks: 0, maint: 0, retry: 0}
2024-11-30 20:47:40 2024-11-30 19:47:40,921 INFO: no action. I am (562d91ed3b96), the leader with the lock
2024-11-30 20:47:50 2024-11-30 19:47:50,931 INFO: no action. I am (562d91ed3b96), the leader with the lock
2024-11-30 20:48:00 2024-11-30 19:48:00,926 INFO: no action. I am (562d91ed3b96), the leader with the lock```

@FelixMalfait
Copy link
Member

From all your screnshots/logs it seems that Postgres is properly started (Could not activate Linux watchdog device is not an issue).

So what's not working is the check command

	@until PGPASSWORD=twenty psql -h localhost -p 5432 -U postgres -d postgres \
		-c 'SELECT pg_is_in_recovery();' 2>/dev/null | grep -q 'f'; do \
		sleep 1; \
	done

I think the error might be making the assumption that psql is installed locally (the point of using docker could be not to have it), it would probably make more sense to run those commands from within the container directly... I'll check how to adapt this

@FelixMalfait
Copy link
Member

We should probably update it to:

postgres-on-docker:
	docker run -d \
	--name twenty_pg \
	-e PGUSER_SUPERUSER=postgres \
	-e PGPASSWORD_SUPERUSER=twenty \
	-e ALLOW_NOSSL=true \
	-v twenty_db_data:/home/postgres/pgdata \
	-p 5432:5432 \
	twentycrm/twenty-postgres-spilo:latest
	@echo "Waiting for PostgreSQL to be ready..."
	@until docker exec twenty_pg psql -U postgres -d postgres \
		-c 'SELECT pg_is_in_recovery();' 2>/dev/null | grep -q 'f'; do \
		sleep 1; \
	done
	docker exec twenty_pg psql -U postgres -d postgres \
		-c "CREATE DATABASE \"default\" WITH OWNER postgres;" \
		-c "CREATE DATABASE \"test\" WITH OWNER postgres;"

I'll try it this afternoon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

7 participants