docker-compose - postgres health check - user does not exist error

13 views
Skip to first unread message

Richard Marshall

unread,
Dec 9, 2025, 4:46:23 AM12/9/25
to Numbas Users
Hi All.

I've just been installing a second Numbas Installation, and have encountered postgres container errors along the lines of user 'postgres' does not exist.

I believe the postgres healthcheck user should be changed from postgres to numbas_lti:

Here is a snippet from the  docker-compose.yml from the numbas git repo.:

<code>
postgres:
......
    healthcheck:
      test: "pg_isready -U postgres"
......
</code>

I believe this should be changed to this?

<code>
healthcheck:
      test: ["CMD-SHELL", "pg_isready -U numbas_lti -d numbas_lti"] 
</code>

Richard Marshall

unread,
Dec 9, 2025, 5:00:36 AM12/9/25
to Numbas Users
The following is in my humble opinion, given learning Docker only recently, and with the benefit of asking around......


In addition:

<code>
numbas-setup:
 ......
    depends_on:
      - postgres
      - redis
.....
  Daphne:
.....
    depends_on:
      - postgres
      - redis
 .....
  huey:
  .....
    depends_on:
      - postgres
      - redis
   </code>

I believe this is slightly better?

<code>
numbas-setup:
.....
    depends_on:
      postgres:                          
        condition: service_healthy       
      redis:                             
        condition: service_started       
   .....
  daphne:
 .....
    depends_on:
      postgres:                          
        condition: service_healthy       
      redis:                             
        condition: service_started       
.....
  huey:
.....
      postgres:
        condition: service_healthy
      redis:
        condition: service_started
.....
</code>

Richard Marshall

unread,
Dec 9, 2025, 10:14:15 AM12/9/25
to Numbas Users
further info - the above was after a fresh install - postgres user not existing in postgres container, just numbas_lti, hence health check failing with that user.   2 hours later, and  after further work and a rebuild of the container I now find postgres user now exists, and numbas_lti doesn't.  So I am thoroughly confused.

Richard Marshall

unread,
Dec 9, 2025, 10:22:45 AM12/9/25
to Numbas Users
I believe I now understand.  postgres is the only linux user in the postgres container, and numbas_lti is the only role within the postgres application.  Hence the healthcheck needs to connect to the postgres app. as numbas_lti as I originally believed.

Christian Lawson-Perfect

unread,
Jan 6, 2026, 10:07:44 AMJan 6
to numbas...@googlegroups.com
Thanks for this. It turns out it wasn't even waiting for the health check anyway, because I have to explicitly say that each service depending on postgres should wait until it's healthy.
I've just pushed an updated docker compose file, which I've checked works from scratch.

--
You received this message because you are subscribed to the Google Groups "Numbas Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numbas-users...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/numbas-users/6c203b7c-b931-4f84-adad-7cce0e1caf47n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages