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

Support POSTGRES_INITDB_ARGS env var #327

Open
jvacek opened this issue Nov 22, 2022 · 1 comment
Open

Support POSTGRES_INITDB_ARGS env var #327

jvacek opened this issue Nov 22, 2022 · 1 comment

Comments

@jvacek
Copy link

jvacek commented Nov 22, 2022

I want to init the DB with --nosync as I'm using it in CI for testing, and I do not care for persistence.

Currently I do this in my job to achieve something similar

    - name: Change Postgresql Settings
      run: |
        docker exec -i postgres_test bash << EOF
          sed -i -e 's/fsync = off/fsync = on/' /var/lib/postgresql/data/postgresql.conf
          sed -i -e 's/synchronous_commit = off/synchronous_commit = on/' /var/lib/postgresql/data/postgresql.conf
          sed -i -e 's/full_page_writes = off/full_page_writes = on/' /var/lib/postgresql/data/postgresql.conf
          sed -i -e 's/shared_buffers = 128MB/shared_buffers = 2GB/' /var/lib/postgresql/data/postgresql.conf
        EOF
        docker restart --time 0 postgres_test
        sleep 5

The official postgres has support for passing the env var POSTGRES_INITDB_ARGS, which would be a lot less hacky than this and would allow me to shave off the extra time.

https://github.com/docker-library/postgres/search?q=POSTGRES_INITDB_ARGS

@ImreSamu
Copy link
Member

Hi @jvacek !

The official postgres has support for passing the env var POSTGRES_INITDB_ARGS,
which would be a lot less hacky than this and would allow me to shave off the extra time.

This repo based on the official "upstream" postgres images, so all official "upstream" - "Environment Variables" extensions should work with the postgis/postgis images!

see: https://hub.docker.com/_/postgres/

  • so ALL Environment Variables supported with the postgis images!
    • 'POSTGRES_PASSWORD'
    • 'POSTGRES_USER'
    • 'POSTGRES_DB'
    • 'POSTGRES_INITDB_ARGS' <--- including this ! ✔️
    • 'POSTGRES_INITDB_WALDIR'
    • 'POSTGRES_HOST_AUTH_METHOD'
    • 'PGDATA'

So you can replace the postgres:15-bullseye with postgis/postgis:15-3.3 and everything should work!

  • if not: please report with your test cases!

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

No branches or pull requests

2 participants