Problem to solve
Restoring backup does not restore the db, even though it is included in the backup archive. It seems it doesn’t even attempt to restore it.
I would expect to see the backup restore is actually restoring the db and the db would be acctually restored:
Restoring database...
Steps to reproduce
On the source instance (I had to install postgresql-client-15 and link the binaries to /opt/gitlab/embedded/bin
):
docker exec -ti gitlab-gitlab-1 gitlab-backup create SKIP=lfs,uploads,registry,builds,artifacts
The output shows the DB has been stored:
2025-03-21 13:06:24 +0100 -- Dumping database ...
2025-03-21 13:06:24 +0100 -- Dumping PostgreSQL database gitlabhq_production ...
2025-03-21 13:10:05 +0100 -- [DONE]
2025-03-21 13:10:05 +0100 -- Dumping database ... done
2025-03-21 13:10:05 +0100 -- Dumping repositories ...
And in the fresh new instance, after stopping puma and sidekiq as the documentation says, restore of the backup does not even attempt to restore the DB:
# gitlab-backup restore BACKUP=1742558784_2025_03_21_17.9.2 --trace
** Invoke gitlab:backup:restore (first_time)
** Invoke gitlab_environment (first_time)
** Execute gitlab_environment
** Invoke environment (first_time)
** Execute environment
[WARNING] Object storage for ci_secure_files must have a bucket specified
** Execute gitlab:backup:restore
2025-03-21 17:04:23 +0100 -- Unpacking backup ...
2025-03-21 17:05:07 +0100 -- Unpacking backup ... done
2025-03-21 17:05:07 +0100 -- Restoring repositories ...
2025-03-21 17:05:07 +0100 -- Restoring repositories ... done
2025-03-21 17:05:07 +0100 -- Restoring pages ...
2025-03-21 17:05:07 +0100 -- Restoring pages ... done
2025-03-21 17:05:07 +0100 -- Restoring terraform states ...
2025-03-21 17:05:07 +0100 -- Restoring terraform states ... done
2025-03-21 17:05:07 +0100 -- Restoring packages ...
2025-03-21 17:05:07 +0100 -- Restoring packages ... done
2025-03-21 17:05:07 +0100 -- Restoring ci secure files ...
2025-03-21 17:05:07 +0100 -- Restoring ci secure files ... done
2025-03-21 17:05:07 +0100 -- Restoring external diffs ...
2025-03-21 17:05:07 +0100 -- Restoring external diffs ... done
And the db/
directory is in the archive, there is the sql dump inside and it is also in the backup_information.yml:
:db_version: '20250213231429'
Versions
- Self-managed
Because we use docker compose, the versions on both instances are exactly the same:
Versions
System information
System: Ubuntu 22.04
Current User: git
Using RVM: no
Ruby Version: 3.2.5
Gem Version: 3.6.3
Bundler Version:2.5.11
Rake Version: 13.0.6
Redis Version: 7.0.15
Sidekiq Version:7.2.4
Go Version: unknown
GitLab information
Version: 17.9.2
Revision: 3ddc2ace157
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: PostgreSQL
DB Version: 15.8
…
Using LDAP: no
Using Omniauth: yes
Omniauth Providers:
GitLab Shell
Version: 14.40.0
Repository storages:
- default: unix:/var/opt/gitlab/gitaly/gitaly.socket
GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell
Gitaly
- default Address: unix:/var/opt/gitlab/gitaly/gitaly.socket
- default Version: 17.9.2
- default Git Version: 2.47.2