GitLab:Upgrade
Upgrading GitLab
Upgrade path
현재 까지 버전 업그레이드 버전 경로:
- GitLab 8: 8.11.Z > 8.12.0 > 8.17.7
- GitLab 9: 9.0.13 > 9.5.10
- GitLab 10: 10.0.7 > 10.8.7
- GitLab 11: 11.0.6 > 11.11.8
- GitLab 12: 12.0.12 > 12.1.17 > 12.10.14
- GitLab 13: 13.0.14 > 13.1.11 > 13.8.8 > 13.12.15
- GitLab 14: 14.0.12 > 14.3.6 > 14.9.5 > 14.10.5
- GitLab 15: 15.0.5 > 15.1.6 (for GitLab instances with multiple web nodes) > 15.4.6 >
15.6.x, 15.7.x or 15.8.x > latest 15.Y.Z(우선 이 부분은 보류!)
다음 메이저 버전으로 올라가면 다음 메이저 버전의 첫 번째 버전으로 올리면 된다.
Docker swarm upgrade
위의 #Upgrade path 순서에 맞춰 업그레이드 하면 된다. 만약, 11.1.4
이라면 아래의 순서로 업그레이드 하면 된다.
docker service update --image gitlab/gitlab-ce:11.11.8-ce.0 gitlab_web
docker service update --image gitlab/gitlab-ce:12.0.12-ce.0 gitlab_web
docker service update --image gitlab/gitlab-ce:12.1.17-ce.0 gitlab_web
docker service update --image gitlab/gitlab-ce:12.10.14-ce.0 gitlab_web
docker service update --image gitlab/gitlab-ce:13.0.14-ce.0 gitlab_web
docker service update --image gitlab/gitlab-ce:13.1.11-ce.0 gitlab_web
docker service update --image gitlab/gitlab-ce:13.5.4-ce.0 gitlab_web
## 2023-03-05 진행:
docker service update --image gitlab/gitlab-ce:13.8.8-ce.0 gitlab_web
docker service update --image gitlab/gitlab-ce:13.12.15-ce.0 gitlab_web
docker service update --image gitlab/gitlab-ce:14.0.12-ce.0 gitlab_web
여기에서 중요 !!!!
Background Migrations를 완료 했는지 각 스탭별로 확인하자.
- 상단의 메인 메뉴에서 Admin 버튼 클릭.
- 왼쪽 사이드-바 에서
Monitoring > Background Migrations
를 선택.
작업중인 모든 마이그레이션 작업을 기다리자. (혹시라도 확인하지 못하고 문제가 발생되면 하단의 문제 해결 항목을 참조.)
앞으로 모든 스탭에서 계속 Background Migrations를 확인하자:
docker service update --image gitlab/gitlab-ce:14.9.5-ce.0 gitlab_web
docker service update --image gitlab/gitlab-ce:14.10.5-ce.0 gitlab_web
docker service update --image gitlab/gitlab-ce:15.0.5-ce.0 gitlab_web
이 스탭에서 GitLab 인스턴스가의 웹 노드가 여러 개 인 경우 다음 업데이트를 거쳐야 한다. 아니라면 건너뛰어도 된다.
나머지 업그레이드:
docker service update --image gitlab/gitlab-ce:15.4.6-ce.0 gitlab_web
docker service update --image gitlab/gitlab-ce:15.6.8-ce.0 gitlab_web
WARNING |
이후 업그레이드는 보류하자. |
각 스탭별로 정상적으로 업그레이드 되면 다음과 비슷한 메세지가 출력된다.
gitlab_web
overall progress: 1 out of 1 tasks
1/1: running [==================================================>]
verify: Service converged
참고로 Runner는 별개로 업그레이드 해야 한다.
Troubleshooting
Expected batched background migration for the given configuration to be marked as 'finished', but it is 'active'
- Upgrading GitLab | GitLab # 14.1.0
- Upgrading GitLab | GitLab # 14.2.0
- Upgrading GitLab | GitLab # 14.3.0
- Gitlab - Upgrade Path
14.0.12-ce.0
에서 14.3.6-ce.0
로 업그레이드 하는 와중 다음과 같은 에러가 발생될 수 있다.
$ docker service update --image gitlab/gitlab-ce:14.3.6-ce.0 gitlab_web
gitlab_web
overall progress: 0 out of 1 tasks
1/1: starting [============================================> ]
service update paused: update paused due to failure or early termination of task u2na696ul8f9iips268mcjgif
컨테이너의 로그를 확인하면 아래와 같다:
...
Running handlers:
There was an error running gitlab-ctl reconfigure:
rails_migration[gitlab-rails] (gitlab::database_migrations line 51) had an error: Mixlib::ShellOut::ShellCommandFailed: bash[migrate gitlab-rails database] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/resources/rails_migration.rb line 16) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of "bash" "/tmp/chef-script20230305-29-1bjfrpx" ----
STDOUT: rake aborted!
StandardError: An error has occurred, all later migrations canceled:
Expected batched background migration for the given configuration to be marked as 'finished', but it is 'active': {:job_class_name=>"CopyColumnUsingBackgroundMigrationJob", :table_name=>"events", :column_name=>"id", :job_arguments=>[["id"], ["id_convert_to_bigint"]]}
Finalize it manualy by running
sudo gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,events,id,'[["id"]\, ["id_convert_to_bigint"]]']
For more information, check the documentation
https://docs.gitlab.com/ee/user/admin_area/monitoring/background_migrations.html#database-migrations-failing-because-of-batched-background-migration-not-finished
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:1109:in `ensure_batched_background_migration_is_finished'
/opt/gitlab/embedded/service/gitlab-rails/db/post_migrate/20210622045705_finalize_events_bigint_conversion.rb:11:in `up'
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migrations/lock_retry_mixin.rb:31:in `ddl_transaction'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:61:in `block (3 levels) in <top (required)>'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
Caused by:
Expected batched background migration for the given configuration to be marked as 'finished', but it is 'active': {:job_class_name=>"CopyColumnUsingBackgroundMigrationJob", :table_name=>"events", :column_name=>"id", :job_arguments=>[["id"], ["id_convert_to_bigint"]]}
Finalize it manualy by running
sudo gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,events,id,'[["id"]\, ["id_convert_to_bigint"]]']
For more information, check the documentation
https://docs.gitlab.com/ee/user/admin_area/monitoring/background_migrations.html#database-migrations-failing-because-of-batched-background-migration-not-finished
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:1109:in `ensure_batched_background_migration_is_finished'
/opt/gitlab/embedded/service/gitlab-rails/db/post_migrate/20210622045705_finalize_events_bigint_conversion.rb:11:in `up'
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migrations/lock_retry_mixin.rb:31:in `ddl_transaction'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:61:in `block (3 levels) in <top (required)>'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
== 20210622045705 FinalizeEventsBigintConversion: migrating ===================
STDERR:
---- End output of "bash" "/tmp/chef-script20230305-29-1bjfrpx" ----
Ran "bash" "/tmp/chef-script20230305-29-1bjfrpx" returned 1
Running handlers complete
Chef Infra Client failed. 131 resources updated in 59 seconds
다시 docker service rollback gitlab_web
으로 원복하자.
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b74968f619bf gitlab/gitlab-ce:14.0.12-ce.0 "/assets/wrapper" 37 minutes ago Up 37 minutes (healthy) 22/tcp, 80/tcp, 443/tcp gitlab_web.1.yrce0pprgrinfsrnf381jiu71
...
14.0.12-ce.0
버전으로 돌아가면 갑자기 500 에러 페이지가 출력된다. 에러 해결을 위해 Upgrading GitLab | GitLab # 14.0.0 페이지 확인하자:
14.0.5 또는 이후 14.0 패치 버전으로 업데이트한 후 이후 버전으로 업데이트하기 전에 [https://docs.gitlab.com/ee/update/background_migrations.html#batched-background-migrations 일괄 백그라운드 마이그레이션]을 완료해야 합니다.
마이그레이션이 완료되지 않은 상태에서 최신 버전으로 업데이트하려고 하면 다음과 같은 오류가 표시됩니다.
Expected batched background migration for the given configuration to be marked as 'finished', but it is 'active':
이 오류를 해결하는 방법은 참조하십시오.
먼저 14.2에 대한 버전별 업그레이드 지침을 따랐는지 확인합니다. 가지고 있는 경우 일괄 백그라운드 이전을 수동으로 완료 할 수 있습니다. <- 수동으로 업그레이드 하고싶지 않다. -_- 귀찮어.
그렇지 않은 경우 다음 방법 중 하나를 선택하십시오.
- 14.2 이상으로 업데이트하기 전에 필수 버전 중 하나를 통해 롤백 및 업그레이드하십시오.
- 롤 포워드, 현재 버전을 유지하고 일괄 마이그레이션이 성공적으로 완료되는지 수동으로 확인합니다.
롤백하고 필요한 업그레이드 경로를 따릅니다
- 이전에 설치된 버전 롤백 및 복원 (현재 상태)
-
14.2+
로 업데이트하기 전에14.0.5
또는14.1
로 업데이트 - 일괄 처리된 백그라운드 마이그레이션의 상태를 확인하고 업그레이드를 다시 시도하기 전에 모두 완료된 것으로 표시되어 있는지 확인하십시오.
업그레이드된 버전에서 마이그레이션을 롤포워드하고 완료합니다.
나의 경우
현재 상태는 14.0.12-ce.0
으므로 14.1+
로 업데이트 하면 된다.
[https://hub.docker.com/r/gitlab/gitlab-ce/tags?page=1&name=14.1. Docker 의 14.1.x 버전 상황]을 확인해 보면,
- 14.1.8-ce.0
- 14.1.7-ce.0
- 14.1.6-ce.0
- 14.1.5-ce.0
- 14.1.4-ce.0
- 14.1.3-ce.0
- 14.1.2-ce.0
- 14.1.1-ce.0
- 14.1.0-ce.0
중 하나가 가능하다. (혹시나 또 실수하면 14.1+
조건을 맞춰야 하므로) 14.1.0-ce.0
으로 업그레이드 하자
|
다음과 같이 출력되면 OK.
gitlab_web
overall progress: 1 out of 1 tasks
1/1: running [==================================================>]
verify: Service converged