postgresql dir change does not update run file before database operations occur
Updated Summary
- We stop GitLab by
sudo gitlab-ctl stop
- We change
postgresql['dir']
ingitlab.rb
. - We run
sudo gitlab-ctl reconfigure
.- As part of the reconfigure run, https://gitlab.com/gitlab-org/omnibus-gitlab/-/blob/8b1c40c46b75ccc2fbf078165d19df7307a5b2e7/files/gitlab-cookbooks/postgresql/recipes/enable.rb#L93-97 is executed
- This immediately starts PostgreSQL due to the notifications
- However, the
postgresql::standalone
recipe is called only after this. And it is in that recipe that we update the run file ofpostgresql
. Till then, therun
file will still use the old PG directory as host. - So, because PG is getting restarted before the run file is updated, PG will run with the old directory as host.
- This causes the following commands to fail while connecting to PG.
At present, the workaround is to run sudo gitlab-ctl restart postgresql
when the first reconfigure fails, and run sudo gitlab-ctl reconfigure
again.
Original Summary
The Documentation is not complete for changing the database directory. It says you jsut have to change the postgresql['dir'] stanza but you also have to change the postgresql['home'] stanza. The documentation error is there since minimum 16.6.2 where i tried it the first time.
These is my first contribution here so if i done something wrong please let me know :)
Steps to reproduce
- Have an normal gitlab-ee omnibus installation
- do the steps on https://docs.gitlab.com/16.7/omnibus/settings/database.html#store-postgresql-data-in-a-different-directory
- error message
correct steps are including changing the postgresql['home'] stanza to the same directory
What is the current bug behavior?
What is the expected correct behavior?
It should work :D
Relevant logs
relevant logs are known by gitlab support Ticket # 486795
Details of package version
Omnibus rpm el/8
Environment details
- Operating System:
RedHat 8.2
- Installation Target, remove incorrect values:
- VM
- Installation Type, remove incorrect values:
- Other: At the moment 16.7.2 first installation a few months ago was 16.0.x i guess
- Is there any other software running on the machine:
podman and gitlab runner
- single node
- Resources
- CPU:
4 vCPU
- Memory total:
8GB
- CPU:
Configuration details
```gitlab.rb
#https://docs.gitlab.com/omnibus/settings/database.html#store-postgresql-data-in-a-different-directory
postgresql['dir'] = "/opt/xxxxx/gitlab_postgresql"
postgresql['home'] = "/opt/xxxxx/gitlab_postgresql"
```
Edited by Robert Marshall