May 13, 2022

Gitlab Upgrade Restart ERROR!

Error Message:
Error executing action run on resource 'bash[migrate gitlab-rails database]'
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Command execution failed. STDOUT/STDERR suppressed for sensitive resource

Error executing action run on resource 'rails_migration[gitlab-rails]'
bash[migrate gitlab-rails database] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/resources/rails_migration.rb line 16) had an error:
Mixlib::ShellOut::ShellCommandFailed: Command execution failed. STDOUT/STDERR suppressed for sensitive resource

進入Docker Container: docker exec -it [container] /bin/bash

step1.> gitlab-rake db:migrate
step2.> gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']
step3.> gitlab-rake db:migrate
step4.> gitlab-ctl reconfigure
step5.> gitlab-ctl restart
done!

Docker Version Gitlab Remove all 2FA authentication

gitlab-rails runner 'User.update_all(otp_required_for_login: false, encrypted_otp_secret: "")'

Docker Version Gitlab Backup

Default location of backups is /var/opt/gitlab/backups.

> docker exec -t <name of container> gitlab-rake gitlab:backup:create

Get your backup.

> docker cp <name of container>:/var/opt/gitlab/backups/<name of backup> .

Docker Version Gitlab Restore

The backup tarball has to be available in the backup location (default location is /var/opt/gitlab/backups).

> docker cp <name of backup> <name of container>:/var/opt/gitlab/backups

The git user has to be owner of the tarball.

> docker exec -it <name of container> chown git:git /var/opt/gitlab/backups/<name of backup>

Run the restore task.

> docker exec -it <name of container> gitlab-rake gitlab:backup:restore