The GitLab Omnibus setup is special: it ships its own embedded
PostgreSQL server (!), which means the regular `sudo -u postgres psql`
command doesn't work.
We previously had instructions on how to connect to the GitLab Omnibus
PostgreSQL server, with the [upstream instructions](https://docs.gitlab.com/omnibus/maintenance/#starting-a-postgresql-superuser-psql-session) but this is now
deprecated. Normal PostgreSQL procedures should just work, like:
To get access to the PostgreSQL server, you need to [follow the
upstream instructions](https://docs.gitlab.com/omnibus/maintenance/#starting-a-postgresql-superuser-psql-session) which are, at the time of writing:
This installs the [GitLab Omnibus](https://docs.gitlab.com/omnibus/) distribution which duplicates a
lot of resources we would otherwise manage elsewhere in Puppet,
including (but possibly not limited to):
* [howto/prometheus](howto/prometheus) exporters (see [issue 40077](https://gitlab.torproject.org/tpo/tpa/team/-/issues/40077) for example)
* [howto/postgresql](howto/postgresql)
* redis
This therefore leads to a "particular" situation regarding monitoring
and PostgreSQL backups, in particular. See [issue 20](https://gitlab.torproject.org/tpo/tpa/gitlab/-/issues/20) for details.
lot of resources we would otherwise manage elsewhere in Puppet, mostly
Redis now.
The install takes a *long* time to complete. It's going to take a few
minutes to download, unpack, and configure GitLab. There's no precise
timing of this procedure yet, but assume each of those steps takes
about 2 to 5 minutes.
Note that you'll need special steps to configure the database during
the install, see below.
After the install, the administrator account details are stored in
`/etc/gitlab/initial_root_password`. After logging in, you most likely
want to [disable new signups](https://docs.gitlab.com/ee/user/admin_area/settings/sign_up_restrictions.html#disable-new-sign-ups) as recommended, or possibly restore
...
...
@@ -1278,6 +1264,115 @@ here and there, but some effort was done during the 2022 hackweek
(2022-06-28) to clean that up in Puppet at least. See
[tpo/tpa/gitlab#127](https://gitlab.torproject.org/tpo/tpa/gitlab/-/issues/127) for some of that cleanup work.
### PostgreSQL standalone transition
In early 2024, PostgreSQL was migrated to its own setup, outside of
GitLab Omnibus, to ease maintenance and backups (see [issue
41426](https://gitlab.torproject.org/tpo/tpa/team/-/issues/41426)). This is how that was performed.
First, there are two different documents upstream explaining how to do
this, one is [Using a non-packaged PostgreSQL database management
server](https://docs.gitlab.com/omnibus/settings/database.html#using-a-non-packaged-postgresql-database-management-server), and the other is [Configure GitLab using an external
PostgreSQL service](https://docs.gitlab.com/ee/administration/postgresql/external.html). This discrepancy was [filed as a bug](https://gitlab.com/gitlab-org/gitlab/-/issues/439789).
In any case, the `profile::gitlab::db` Puppet class is designed to
create a database capable of hosting the GitLab service. It only
creates the database and doesn't actually populate it, which is
something the Omnibus package normally does.
In our case, we backed up the production "omnibus" cluster and
restored to the managed cluster using the following procedure:
1. deploy the `profile::gitlab::db` profile, make sure the port
doesn't conflict with the omnibus database (e.g. use port `5433`
instead of `5432`), note that the postgres export will fail to
start, that's normal because it conflicts with the omnibus one:
pat
2. backup the GitLab database a first time, note down the time it
That configuration is detailed in [this guide](https://docs.gitlab.com/omnibus/settings/database.html#using-a-non-packaged-postgresql-database-management-server).