Gitlab 升級,8.4.4 升到 12.3.0

 

環境 UBUNTU 16.04.6 LTS

原本版本: GitLab Community Edition 8.4.4

重點 : 得一個版本一個版本升

指令 :

列出版本號

apt list -a gitlab-ce

備份

gitlab-rake gitlab:backup:create

升級到某個版本號

apt-get install gitlab-ce={版本號}

 

步驟一、先備份現有的

root@ckone1209:~# gitlab-rake gitlab:backup:create STRATEGY=copy
Dumping database ...
Dumping PostgreSQL database gitlabhq_production ... [DONE]
done
Dumping repositories ...
 * root/node_chatroom ... [DONE]
 * root/node_chatroom.wiki ...  [SKIPPED]
 * root/hotBeauty ... [DONE]
 * root/hotBeauty.wiki ...  [SKIPPED]
 * root/babyMusic ... [SKIPPED]
 * root/babyMusic.wiki ...  [SKIPPED]
 * root/musicforbabies ... [DONE]
 * root/musicforbabies.wiki ...  [SKIPPED]
 * root/g6pdcard ... [DONE]
 * root/g6pdcard.wiki ...  [SKIPPED]
 * root/zac ... [DONE]
 * root/zac.wiki ...  [SKIPPED]
 * root/sd ... [DONE]
 * root/sd.wiki ...  [SKIPPED]
 * ckone1209/articleBot ... [DONE]
 * ckone1209/articleBot.wiki ...  [SKIPPED]
done
Dumping uploads ...
done
Dumping builds ...
done
Dumping artifacts ...
done
Dumping lfs objects ...
done
Creating backup archive: 1568952184_gitlab_backup.tar ... done
Uploading backup archive to remote storage  ... skipped
Deleting tmp directories ... done
done
done
done
done
done
done
Deleting old backups ... skipping
root@ckone1209:~#

 

步驟二、升級最新版本

root@ckone1209:~#  apt-get update && apt-get install gitlab-ce
Hit:1 http://mirrors.linode.com/ubuntu xenial InRelease
Get:2 http://mirrors.linode.com/ubuntu xenial-updates InRelease [109 kB]
Get:3 http://mirrors.linode.com/ubuntu xenial-backports InRelease [107 kB]
Hit:4 https://deb.nodesource.com/node_7.x xenial InRelease
Hit:5 https://apt.datadoghq.com stable InRelease
Get:6 http://mirrors.linode.com/ubuntu xenial-updates/main amd64 Packages [1,033 kB]
Get:7 http://mirrors.linode.com/ubuntu xenial-updates/main i386 Packages [860 kB]
Hit:8 http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease
Get:9 http://mirrors.linode.com/ubuntu xenial-updates/universe amd64 Packages [764 kB]
Get:10 http://mirrors.linode.com/ubuntu xenial-updates/universe i386 Packages [695 kB]
Get:11 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]
Get:12 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu xenial InRelease [23.3 kB]
Get:13 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu xenial/main amd64 Packages [62.5 kB]
Fetched 3,763 kB in 7s (479 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
  gitlab-ce
1 upgraded, 0 newly installed, 0 to remove and 143 not upgraded.
Need to get 664 MB of archives.
After this operation, 1,039 MB of additional disk space will be used.
Get:1 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu xenial/main amd64 gitlab-ce amd64 12.2.5-ce.0 [664 MB]
Fetched 664 MB in 15s (43.2 MB/s)
(Reading database ... 156912 files and directories currently installed.)
Preparing to unpack .../gitlab-ce_12.2.5-ce.0_amd64.deb ...
gitlab preinstall: It seems you are upgrading from 8.x version series
gitlab preinstall: to 12.x series. It is recommended to upgrade
gitlab preinstall: to the last minor version in a major version series first before
gitlab preinstall: jumping to the next major version.
gitlab preinstall: Please follow the upgrade documentation at https://docs.gitlab.com/ee/policy/maintenance.html#upgrade-recommendations
gitlab preinstall: and upgrade to 11.11 first.
dpkg: error processing archive /var/cache/apt/archives/gitlab-ce_12.2.5-ce.0_amd64.deb (--unpack):
 subprocess new pre-installation script returned error exit status 1
gitlab: Thank you for installing GitLab!
gitlab: To configure and start GitLab, RUN THE FOLLOWING COMMAND:

sudo gitlab-ctl reconfigure

gitlab: GitLab should be reachable at http://gitlab.kklife.cc:8081
gitlab: Otherwise configure GitLab for your system by editing /etc/gitlab/gitlab.rb file
gitlab: And running reconfigure again.
gitlab:
gitlab: For a comprehensive list of configuration options please see the Omnibus GitLab readme
gitlab: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
gitlab:
Errors were encountered while processing:
 /var/cache/apt/archives/gitlab-ce_12.2.5-ce.0_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@ckone1209:~#

升級失敗,看到下面這一段說明

gitlab preinstall: It seems you are upgrading from 8.x version series
gitlab preinstall: to 12.x series. It is recommended to upgrade
gitlab preinstall: to the last minor version in a major version series first before
gitlab preinstall: jumping to the next major version.
gitlab preinstall: Please follow the upgrade documentation at https://docs.gitlab.com/ee/policy/maintenance.html#upgrade-recommendations
gitlab preinstall: and upgrade to 11.11 first.

 

原來是建議先升級到下一個 major version

根據他所給的網址

https://docs.gitlab.com/ee/policy/maintenance.html#upgrade-recommendations

看來得一個版本一個版本升了

步驟三、8.4.4-ce.0 得先升到 8.17.8-ce.0

先查看現有所有版本

root@ckone1209:~# apt list -a gitlab-ce
Listing... Done
gitlab-ce/xenial 12.3.0-ce.0 amd64 [upgradable from: 8.4.4-ce.0]
略
gitlab-ce/xenial 12.0.0-ce.0 amd64
gitlab-ce/xenial 11.11.8-ce.0 amd64
略
gitlab-ce/xenial 11.0.0-ce.0 amd64
gitlab-ce/xenial 10.8.7-ce.0 amd64
略
gitlab-ce/xenial 10.0.0-ce.0 amd64
gitlab-ce/xenial 9.5.10-ce.0 amd64
略
gitlab-ce/xenial 9.0.0-ce.0 amd64
gitlab-ce/xenial 8.17.8-ce.0 amd64
略
gitlab-ce/xenial 8.7.1-ce.1 amd64
gitlab-ce/now 8.4.4-ce.0 amd64 [installed,upgradable to: 12.3.0-ce.0]

可看到目前使用的版本是 8.4.4-ce.0

8.4.4-ce.0 得先升到 8.17.8-ce.0

root@ckone1209:~#apt-get install gitlab-ce=8.17.8-ce.0
略

Upgrade complete! If your GitLab server is misbehaving try running

   sudo gitlab-ctl restart

before anything else. If you need to roll back to the previous version you can
use the database backup made during the upgrade (scroll up for the filename).

 

看來是升級成功了,登入 gitLab 的 help 頁,果然已經升到 8.17.8 了

步驟四、接下來 8.17.8-ce.0 升到 9.5.10-ce.0

root@ckone1209:~# apt-get install gitlab-ce=9.5.10-ce.0
略

Upgrade complete! If your GitLab server is misbehaving try running

   sudo gitlab-ctl restart

before anything else. If you need to roll back to the previous version you can
use the database backup made during the upgrade (scroll up for the filename).
root@ckone1209:~#

升級完,打開 gitlab 首頁,竟然出現 502 壞掉了

下 restart 指令看看

root@ckone1209:~# gitlab-ctl restart
ok: run: gitaly: (pid 31836) 0s
ok: run: gitlab-monitor: (pid 31854) 1s
ok: run: gitlab-workhorse: (pid 31857) 0s
ok: run: logrotate: (pid 31864) 1s
ok: run: nginx: (pid 31871) 0s
ok: run: node-exporter: (pid 31876) 0s
ok: run: postgres-exporter: (pid 31880) 0s
ok: run: postgresql: (pid 31913) 1s
ok: run: prometheus: (pid 31922) 0s
ok: run: redis: (pid 31930) 0s
ok: run: redis-exporter: (pid 31935) 0s
ok: run: sidekiq: (pid 31978) 0s
ok: run: unicorn: (pid 31987) 1s
root@ckone1209:~#

 

還是 502 !?!?

看下面這篇提到 nginx restart 看看

https://blog.csdn.net/czy3y/article/details/77983120

重啟 nginx

root@ckone1209:~# service nginx restart

 

再打開 gitlab 首頁,成功了!!

看 help 頁,果然成功升級到 9.5.10

步驟五、升級到 10.8.7-ce.0

先備份

root@ckone1209:~# gitlab-rake gitlab:backup:create
Dumping database ...
Dumping PostgreSQL database gitlabhq_production ... [DONE]
done
Dumping repositories ...
 * root/node_chatroom ... [DONE]
 * root/node_chatroom.wiki ...  [SKIPPED]
 * root/hotBeauty ... [DONE]
 * root/hotBeauty.wiki ...  [SKIPPED]
 * root/babyMusic ... [SKIPPED]
 * root/babyMusic.wiki ...  [SKIPPED]
 * root/musicforbabies ... [DONE]
 * root/musicforbabies.wiki ...  [SKIPPED]
 * root/g6pdcard ... [DONE]
 * root/g6pdcard.wiki ...  [SKIPPED]
 * root/zac ... [DONE]
 * root/zac.wiki ...  [SKIPPED]
 * root/sd ... [DONE]
 * root/sd.wiki ...  [SKIPPED]
 * ckone1209/articleBot ... [DONE]
 * ckone1209/articleBot.wiki ...  [SKIPPED]
done
Dumping uploads ...
done
Dumping builds ...
done
Dumping artifacts ...
done
Dumping pages ...
done
Dumping lfs objects ...
done
Dumping container registry images ...
[DISABLED]
Creating backup archive: 1569210834_2019_09_23_9.5.10_gitlab_backup.tar ... done
Uploading backup archive to remote storage  ... skipped
Deleting tmp directories ... done
done
done
done
done
done
done
done
Deleting old backups ... skipping
root@ckone1209:~#

 

升級

root@ckone1209:~# apt-get install gitlab-ce=10.8.7-ce.0
略
ok: run: sidekiq: (pid 11499) 0s
ok: run: unicorn: (pid 11508) 0s

     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/


Upgrade complete! If your GitLab server is misbehaving try running
  sudo gitlab-ctl restart
before anything else.
If you need to roll back to the previous version you can use the database
backup made during the upgrade (scroll up for the filename).

root@ckone1209:~#

 

打開首頁,成功!!

步驟六、升級到 11.11.8-ce.0

備份

root@ckone1209:~# gitlab-rake gitlab:backup:create

 

升級

root@ckone1209:~# apt-get install gitlab-ce=11.11.8-ce.0
略
Deprecations:
== Prometheus ==
Detected Prometheus version 1.x. Version 1.x has been deprecated and support will be removed in GitLab version 12.0.
To upgrade to Prometheus 2.x, use `gitlab-ctl prometheus-upgrade` command.
Running this command will migrate all your existing data to format supported by Prometheus 2.x.
This can be a time consuming operation. To skip migrating the data, and instead remove and start fresh, run `gitlab-ctl prometheus-upgrade --skip-data-migration`.
Check https://docs.gitlab.com/omnibus/update/gitlab_11_changes.html#114 for details.
---


Warnings:
The version of the running postgresql service is different than what is installed.
Please restart postgresql to start the new version.

sudo gitlab-ctl restart postgresql

gitlab Reconfigured!
Restarting previously running GitLab services
ok: run: alertmanager: (pid 24435) 0s
ok: run: gitaly: (pid 24175) 12s
ok: run: gitlab-monitor: (pid 24226) 12s
ok: run: gitlab-workhorse: (pid 24205) 12s
ok: run: logrotate: (pid 24446) 0s
ok: run: nginx: (pid 24452) 0s
ok: run: node-exporter: (pid 24217) 12s
ok: run: postgres-exporter: (pid 24293) 9s
ok: run: postgresql: (pid 11198) 821s
ok: run: prometheus: (pid 24252) 11s
ok: run: redis: (pid 23823) 80s
ok: run: redis-exporter: (pid 24234) 11s
ok: run: sidekiq: (pid 24464) 0s
ok: run: unicorn: (pid 24470) 0s

     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/


Upgrade complete! If your GitLab server is misbehaving try running
  sudo gitlab-ctl restart
before anything else.
If you need to roll back to the previous version you can use the database
backup made during the upgrade (scroll up for the filename).

root@ckone1209:~#

 

成功,但這次多了一個警告訊息,需要重啟 postgresql,

雖然進入 gitlab 首頁,的確已經變成 11.11.8 版本,但還是執行一下指令好了

Warnings:
The version of the running postgresql service is different than what is installed.
Please restart postgresql to start the new version.

sudo gitlab-ctl restart postgresql
Warnings:
The version of the running postgresql service is different than what is installed.
Please restart postgresql to start the new version.

sudo gitlab-ctl restart postgresql

執行

root@ckone1209:~# gitlab-ctl restart postgresql
ok: run: postgresql: (pid 1098) 1s

 

 

步驟六、升級到 12.3.0-ce.0

備份

root@ckone1209:~# gitlab-rake gitlab:backup:create
2019-09-23 13:40:10 +0800 -- Dumping database ...
Dumping PostgreSQL database gitlabhq_production ... [DONE]
2019-09-23 13:40:11 +0800 -- done
2019-09-23 13:40:11 +0800 -- Dumping repositories ...
 * root/node_chatroom ... [DONE]
[SKIPPED] Wiki
 * root/hotBeauty ... [DONE]
[SKIPPED] Wiki
 * root/babyMusic ... [SKIPPED]
[SKIPPED] Wiki
 * root/musicforbabies ... [DONE]
[SKIPPED] Wiki
 * root/g6pdcard ... [DONE]
[SKIPPED] Wiki
 * root/zac ... [DONE]
[SKIPPED] Wiki
 * root/sd ... [DONE]
[SKIPPED] Wiki
 * ckone1209/articleBot ... [DONE]
[SKIPPED] Wiki
2019-09-23 13:40:32 +0800 -- done
2019-09-23 13:40:32 +0800 -- Dumping uploads ...
2019-09-23 13:40:32 +0800 -- done
2019-09-23 13:40:32 +0800 -- Dumping builds ...
2019-09-23 13:40:32 +0800 -- done
2019-09-23 13:40:32 +0800 -- Dumping artifacts ...
2019-09-23 13:40:32 +0800 -- done
2019-09-23 13:40:32 +0800 -- Dumping pages ...
2019-09-23 13:40:32 +0800 -- done
2019-09-23 13:40:32 +0800 -- Dumping lfs objects ...
2019-09-23 13:40:32 +0800 -- done
2019-09-23 13:40:32 +0800 -- Dumping container registry images ...
2019-09-23 13:40:32 +0800 -- [DISABLED]
Creating backup archive: 1569217232_2019_09_23_11.11.8_gitlab_backup.tar ... done
Uploading backup archive to remote storage  ... skipped
Deleting tmp directories ... done
done
done
done
done
done
done
done
Deleting old backups ... skipping
root@ckone1209:~#

 

升級

apt-get install gitlab-ce=12.3.0-ce.0
Running handlers:
Running handlers complete
Chef Client finished, 4/694 resources updated in 09 seconds
Running reconfigure: OK
Waiting for Database to be running.
Database upgrade is complete, running analyze_new_cluster.sh
Toggling deploy page:rm -f /opt/gitlab/embedded/service/gitlab-rails/public/index.html
Toggling deploy page: OK
Toggling services:ok: run: alertmanager: (pid 15322) 0s
ok: run: gitaly: (pid 15328) 0s
ok: run: gitlab-exporter: (pid 15349) 1s
ok: run: grafana: (pid 15351) 0s
ok: run: logrotate: (pid 15367) 0s
ok: run: node-exporter: (pid 15369) 1s
ok: run: postgres-exporter: (pid 15382) 0s
ok: run: prometheus: (pid 15390) 0s
ok: run: redis-exporter: (pid 15406) 1s
ok: run: sidekiq: (pid 15414) 0s
Toggling services: OK
==== Upgrade has completed ====
Please verify everything is working and run the following if so
sudo rm -rf /var/opt/gitlab/postgresql/data.9.6

Ensuring PostgreSQL is updated: OK
Restarting previously running GitLab services
ok: run: gitaly: (pid 15328) 3s
ok: run: gitlab-workhorse: (pid 14382) 47s
ok: run: logrotate: (pid 15367) 2s
ok: run: nginx: (pid 15423) 1s
ok: run: node-exporter: (pid 15369) 3s
ok: run: postgres-exporter: (pid 15382) 2s
ok: run: postgresql: (pid 14966) 16s
ok: run: prometheus: (pid 15390) 2s
ok: run: redis: (pid 13609) 174s
ok: run: redis-exporter: (pid 15406) 2s
ok: run: sidekiq: (pid 15414) 1s
ok: run: unicorn: (pid 15442) 0s

     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/


Upgrade complete! If your GitLab server is misbehaving try running
  sudo gitlab-ctl restart
before anything else.
If you need to roll back to the previous version you can use the database
backup made during the upgrade (scroll up for the filename).

root@ckone1209:~#

 

很順利的就升級完成!!

up-to-date

 

標籤: ,

About: Kaito


發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料