harbor 1.7 升级到1.8.3
注:为什么选择1.8.3
答: 因为1.8.0-1.8.2 有bug,直到1.8.3 才修复。 同时修复tag 超过100个以上,无法浏览的问题
Known Issues:
- After upgrade from v1.6.x, the scheduled of "Scan All" will be reset to "None", the admin will need to update the schedule again.
- The label filter in replication policies will be lost after upgrade to version 1.8 (#7762)
- When the internal redis is down, the health check API may return 502: (#7691)
- Manifest list isn't supported. When replicating the manifest list, the image whose architecture is amd64 and OS is linux(if found) or the first one will be replicated: (#6522)
- Note:
- After update to v1.8.0, the cron schedule cannot be modified/deleted. For more details, please refer to #7868.
备份harbor1.7
cd /data/harbor
docker-compose down
mv harbor /data/harbor-1.7.6
解压harbor1.8到/data/目录下
tar zxvf harbor-offline-installer-v1.8.0.tgz -C /data/harbor
升级harbor.cfg到harbor.yml
docker run -it --rm -v /data/harbor-1.7.6/harbor.cfg:/harbor-migration/harbor-cfg/harbor.cfg -v /data/harbor/harbor.yml:/harbor-migration/harbor-cfg-out/harbor.yml goharbor/harbor-migrator:v1.8.3 --cfg up
由于1.8版本的docker-compse已交由harbor.yml控制,在./install.sh时加载harbor.yml文件生成docker-compose.yml(注:数据目录必须使用绝对路径)故还需要对新的harbor.yml进行修改
修改数据目录和日志目录
data_volume: /data/harbor/
location: /data/harbor/log
将一下内容复制到/data/harbor
ca_download
common
config
database
secretkey
redis
psc
将私有仓软连接
ln -s /data/registry /data/harbor/registry
启动harbor,并开启漏洞扫描
./install.sh --with-clair
harbor 1.6 升级到1.7
关闭harbor
docker-compose down
备份harbor
mv harbor /my_backup_dir/harbor
备份数据库
cp -r /data/database /my_backup_dir/
docker pull goharbor/harbor-migrator:v1.7.1
将旧版本harbor配置文件 升级到1.7, 有些配置可能没修改,还是默认参数。需要手动对比并修改。而且这个文件会覆盖,注意备份
docker run -it --rm -v /data/harbor/harbor.cfg:/harbor-migration/harbor-cfg/harbor.cfg goharbor/harbor-migrator:v1.7.0 --cfg up
开始安装
./install.sh
issue:
发现复制任务在pending的时候,可以用postgresql 删除异常任务
如果复制任务失败,查看 日志job_logs :exit with error: failed to initialize job logger ,就是你的job_logs 目录 权限不对
执行chown -R 10000.10000 job_logs
https://github.com/goharbor/harbor/issues/5952
harbor 1.7 bug, 导致ui 无法删除历史tag
https://github.com/goharbor/harbor/issues/6876
harbor 1.5以前版本升级到1.6
注:为什么先升级到1.6
答:从1.6开始数据库从mysql 换成postgresql
备份数据库
docker run -ti --rm -e DB_USR=root -e DB_PWD=root123 -v /data/harbor/database:/var/lib/mysql -v /data/harbor/harbor.cfg:/harbor-migration/harbor-cfg/harbor.cfg -v /data/harbor/backup:/harbor-migration/backup goharbor/harbor-migrator:v1.6.0 backup
检测数据库迁移是否正常
docker run -ti --rm -e DB_USR=root -e DB_PWD=root123 -v /data/harbor/database:/var/lib/mysql -v /data/harbor/harbor.cfg:/harbor-migration/harbor-cfg/harbor.cfg goharbor/harbor-migrator:v1.6.0 test
数据库从mysql 转到pstgresql
docker run -ti --rm -e DB_USR=root -e DB_PWD=root123 -v /data/harbor/database:/var/lib/mysql -v /data/harbor/harbor.cfg:/harbor-migration/harbor-cfg/harbor.cfg goharbor/harbor-migrator:v1.6.0 up
将旧版本harbor配置文件 升级到1.6
docker run -it --rm -v /data/harbor/harbor.cfg:/harbor-migration/harbor-cfg/harbor.cfg goharbor/harbor-migrator:v1.6.0 --cfg up