I am currently running Gitlab enterprise edition with all-in-one docker image, (gitlab/gitlab-ee) and enabled Container Registry before the availability of container registry metadata database.
With this image, a postgresql instance is run inside the container.
I am now having trouble migrating to the container registry metadata database. As Container registry metadata database | GitLab mentioned, I need to append something to gitlab.rb (despite I am currently passing configurations by GITLAB_OMNIBUS_CONFIG envvar, it is ok to use gitlab.rb) like below:
registry['database'] = {
'enabled' => false, # Must be false!
'host' => 'localhost',
'port' => 5432,
'user' => 'registry-database-user',
'password' => 'registry-database-password',
'dbname' => 'registry-database-name'
'sslmode' => 'require', # See the PostgreSQL documentation for additional information https://www.postgresql.org/docs/current/libpq-ssl.html.
'sslcert' => '/path/to/cert.pem',
'sslkey' => '/path/to/private.key',
'sslrootcert' => '/path/to/ca.pem'
}
But since I was on the all-in-one docker installation, I have no idea about the database name, db username or password to be filled in.
then in addition
/var/opt/gitlab/postgresql/data/postgresql.conf
/var/opt/gitlab/postgresql/data/server.key
/var/opt/gitlab/postgresql/data/server.crt
/opt/gitlab/embedded/ssl/certs/cacert.pem
But it has been said on tickets that the registry requires a separate database. That could be another Postgres instance or a logical database inside the GitLab main database and i wonder what would happen with updates if you create a logical database against the internal Omnibus Pgsql server
I was able to make it work by combining the official documentation with the snippet linked above:
Before running schema migrations, we need to create the database and user for the metadata database.
This can be done by running the following commands:
gitlab-psql -c "CREATE USER registry WITH PASSWORD 'registrypassword'"
gitlab-psql -c "CREATE DATABASE registry_database WITH OWNER registry"
Now use the created user and database in /etc/gitlab/gitlab.rb: host is a path, since postgres runs in the same container and so the connection can use a unix socket.
Thank you so much! I spent half day trying to troubleshoot this and even opened another thread before stumbling on this. I can’t believe the migration documentation lacks these fundamental preliminary steps. Maybe I overlooked something?