How to restart postgres?

I’m using one of the circleci postgres images

    docker:
      - image: crystallang/crystal:latest
      - image: circleci/postgres:11-alpine-ram

In a script I create and add some ssl certs. I need to restart (not just a sighup) postgres to get it to load those configuration changes.

How can I restart postgres in circle ci? It doesn’t appear in service.

Is there a built-in stored procedure to do it, which can be called via SQL? I don’t believe a restart is possible in CircleCI with a secondary container.

If there is no stored proc/func to do it, you could move Postgres to your primary build container, and then you will have console access to restart it.

Yeah the stored procedure select pg_reload_conf() just does a sighup, and is insufficient for changes to ssl related configuration changes.

It does look like I’ll have to apt install postgres and not use images.

1 Like