[Solved] GitLab CI modify postgres service settings

BretD Asks: GitLab CI modify postgres service settings
I am using the postgres service in GitLab CI, which I have working fine. The execution is very slow, so there are a few configuration options that I want to modify to speed up the execution.

I put the following in the variables section of my .gitlab-ci.yml file:

PGOPTIONS: “-c fsync=off -c synchronous_commit=off -c full_page_writes=off”

Based on the output in the logs, these settings are getting picked up, but the database has a fatal error and goes down. Below is what I believe to be the pertinent part of the logs:

Code:
*** WARNING: Service runner-x8xwaybY-project-xxxx-concurrent-0-postgres-0 probably didn't start properly.
9 Health check error:
10 service "runner-x8xwaybY-project-xxxx-concurrent-0-postgres-0-wait-for-service" timeout
11 Health check container logs:
.
.
.
53 2019-12-31T00:50:53.790047443Z 2019-12-31 00:50:53.789 UTC [46] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
54 2019-12-31T00:50:53.800881648Z 2019-12-31 00:50:53.800 UTC [47] LOG:  database system was shut down at 2019-12-31 00:50:53 UTC
55 2019-12-31T00:50:53.803321714Z 2019-12-31 00:50:53.803 UTC [46] LOG:  database system is ready to accept connections
56 2019-12-31T00:50:53.868375914Z  done
57 2019-12-31T00:50:53.868413294Z server started
58 2019-12-31T00:50:53.949656389Z 2019-12-31 00:50:53.949 UTC [62] FATAL:  parameter "fsync" cannot be changed now
59 2019-12-31T00:50:53.949677222Z psql: error: could not connect to server: FATAL:  parameter "fsync" cannot be changed now

It seems that the issue is with the fsync option, as the database is already up and running at this point, and that setting cannot be changed without a restart.

How can I change these settings using Gitlab’s postgres service?

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.