mirror of https://github.com/easzlab/kubeasz.git
更新harbor脚本和文档
parent
1c5ef6289c
commit
f3b788a3e9
|
@ -126,7 +126,7 @@ type: kubernetes.io/dockerconfigjson
|
||||||
+ 日志目录 `/var/log/harbor`
|
+ 日志目录 `/var/log/harbor`
|
||||||
+ 数据目录 `/data` ,其中最主要是 `/data/database` 和 `/data/registry` 目录,如果你要彻底重新安装harbor,删除这两个目录即可
|
+ 数据目录 `/data` ,其中最主要是 `/data/database` 和 `/data/registry` 目录,如果你要彻底重新安装harbor,删除这两个目录即可
|
||||||
|
|
||||||
先进入harbor安装目录 `cd /root/local/harbor`,常规操作如下:
|
先进入harbor安装目录 `cd /opt/harbor`,常规操作如下:
|
||||||
|
|
||||||
1. 暂停harbor `docker-compose stop` : docker容器stop,并不删除容器
|
1. 暂停harbor `docker-compose stop` : docker容器stop,并不删除容器
|
||||||
2. 恢复harbor `docker-compose start` : 恢复docker容器运行
|
2. 恢复harbor `docker-compose start` : 恢复docker容器运行
|
||||||
|
@ -151,7 +151,7 @@ type: kubernetes.io/dockerconfigjson
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
# 进入harbor解压缩后的目录,停止harbor
|
# 进入harbor解压缩后的目录,停止harbor
|
||||||
cd /root/local/harbor
|
cd /opt/harbor
|
||||||
docker-compose down
|
docker-compose down
|
||||||
|
|
||||||
# 备份这个目录
|
# 备份这个目录
|
||||||
|
@ -159,7 +159,7 @@ cd ..
|
||||||
mkdir -p /backup && mv harbor /backup/harbor
|
mkdir -p /backup && mv harbor /backup/harbor
|
||||||
|
|
||||||
# 下载更新的离线安装包,并解压
|
# 下载更新的离线安装包,并解压
|
||||||
tar zxvf harbor-offline-installer-v1.2.2.tgz -C /root/local
|
tar zxvf harbor-offline-installer-v1.2.2.tgz -C /opt
|
||||||
|
|
||||||
# 使用官方数据库迁移工具,备份数据库,修改数据库连接用户和密码,创建数据库备份目录
|
# 使用官方数据库迁移工具,备份数据库,修改数据库连接用户和密码,创建数据库备份目录
|
||||||
# 迁移工具使用docker镜像,镜像tag由待升级到目标harbor版本决定,这里由 1.1.2升级到1.2.2,所以使用 tag 1.2
|
# 迁移工具使用docker镜像,镜像tag由待升级到目标harbor版本决定,这里由 1.1.2升级到1.2.2,所以使用 tag 1.2
|
||||||
|
@ -171,7 +171,7 @@ docker run -it --rm -e DB_USR=root -e DB_PWD=xxxx -v /data/database:/var/lib/mys
|
||||||
docker run -it --rm -e DB_USR=root -e DB_PWD=xxxx -v /data/database:/var/lib/mysql vmware/harbor-db-migrator:1.2 up head
|
docker run -it --rm -e DB_USR=root -e DB_PWD=xxxx -v /data/database:/var/lib/mysql vmware/harbor-db-migrator:1.2 up head
|
||||||
|
|
||||||
# 修改新版本 harbor.cfg配置,需要保持与老版本相关配置项保持一致,然后执行安装即可
|
# 修改新版本 harbor.cfg配置,需要保持与老版本相关配置项保持一致,然后执行安装即可
|
||||||
cd /root/local/harbor
|
cd /opt/harbor
|
||||||
vi harbor.cfg
|
vi harbor.cfg
|
||||||
./install.sh
|
./install.sh
|
||||||
|
|
||||||
|
|
|
@ -12,18 +12,18 @@
|
||||||
- name: 解压harbor离线安装包
|
- name: 解压harbor离线安装包
|
||||||
unarchive:
|
unarchive:
|
||||||
src: "{{ base_dir }}/down/harbor-offline-installer-v1.2.2.tgz"
|
src: "{{ base_dir }}/down/harbor-offline-installer-v1.2.2.tgz"
|
||||||
dest: /root/local
|
dest: /opt
|
||||||
copy: yes
|
copy: yes
|
||||||
keep_newer: yes
|
keep_newer: yes
|
||||||
when: result|failed
|
when: result is failed
|
||||||
|
|
||||||
- name: 导入harbor所需 docker images
|
- name: 导入harbor所需 docker images
|
||||||
shell: "{{ bin_dir }}/docker load -i /root/local/harbor/harbor.v1.2.2.tar.gz"
|
shell: "{{ bin_dir }}/docker load -i /opt/harbor/harbor.v1.2.2.tar.gz"
|
||||||
when: result|failed
|
when: result is failed
|
||||||
|
|
||||||
- name: 创建harbor证书请求
|
- name: 创建harbor证书请求
|
||||||
template: src=harbor-csr.json.j2 dest={{ ca_dir }}/harbor-csr.json
|
template: src=harbor-csr.json.j2 dest={{ ca_dir }}/harbor-csr.json
|
||||||
when: result|failed
|
when: result is failed
|
||||||
|
|
||||||
- name: 创建harbor证书和私钥
|
- name: 创建harbor证书和私钥
|
||||||
shell: "cd {{ ca_dir }} && {{ bin_dir }}/cfssl gencert \
|
shell: "cd {{ ca_dir }} && {{ bin_dir }}/cfssl gencert \
|
||||||
|
@ -31,14 +31,14 @@
|
||||||
-ca-key={{ ca_dir }}/ca-key.pem \
|
-ca-key={{ ca_dir }}/ca-key.pem \
|
||||||
-config={{ ca_dir }}/ca-config.json \
|
-config={{ ca_dir }}/ca-config.json \
|
||||||
-profile=kubernetes harbor-csr.json | {{ bin_dir }}/cfssljson -bare harbor"
|
-profile=kubernetes harbor-csr.json | {{ bin_dir }}/cfssljson -bare harbor"
|
||||||
when: result|failed
|
when: result is failed
|
||||||
|
|
||||||
- name: 配置 harbor.cfg 文件
|
- name: 配置 harbor.cfg 文件
|
||||||
template: src=harbor.cfg.j2 dest=/root/local/harbor/harbor.cfg
|
template: src=harbor.cfg.j2 dest=/opt/harbor/harbor.cfg
|
||||||
when: result|failed
|
when: result is failed
|
||||||
|
|
||||||
- name: 安装 harbor
|
- name: 安装 harbor
|
||||||
shell: "cd /root/local/harbor && \
|
shell: "cd /opt/harbor && \
|
||||||
export PATH={{ bin_dir }}:$PATH && \
|
export PATH={{ bin_dir }}:$PATH && \
|
||||||
./install.sh"
|
./install.sh"
|
||||||
when: result|failed
|
when: result is failed
|
||||||
|
|
Loading…
Reference in New Issue