Can Postgres config [postgresql.conf] file be changed using circle.yml

I am currently working on a Python-django project and use postgres for database support. I wish to turn off postgres config file variables, fsync and full_pages_writes so as to make migration files run faster for test database. Is there any way to do the same using circle.yml [circle config file]. Or any way to so this thing at all ?

1 Like

Thanks for the question. You can use sed in circle.yml like so:

test:
  pre:
    - sudo sed -i 's/OLD/NEW/' /etc/postgresql/9.5/main/postgresql.conf
    - sudo service postgresql restart
1 Like

Thank you !! This was really helpful :slight_smile:

2 Likes

@tom , is postgres not already optimised for fsync, full_pages_writes and other settings according to https://github.com/circleci/circle-env/blob/master/src/scripts/trusty/postgres.sh#L47 ?
Is not this script run to install postgres ?

How should one edit the postgres.conf file when using a circleci 2.0 config, with a separate container running Postgres?

1 Like

Good question @jasonworden. You can probably pass sets of individual flags to the database binary, see here.

However, if you want to write a full config file, you’d probably need to create a custom image, see here. I’d create a separate repo and build process for that, and then pull in the new image in your current repo.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.