「JumpServer」- 升级 2.8.2 到 2.12.0 版本

  CREATED BY JENKINSBOT

问题描述

该笔记将记录:将 JumpServer 从 2.8.2 升级到 2.12.0 的方法,以及相关问题的解决方案。

解决方案

从 从 2.6 后,统一企业版本与开源版本安装方式,企业版和社区版可以无缝切换。今后只会维护这种安装方式(通过 jmsctl.sh 管理),其他安装方式不再提供技术支持。所以,此次升级不像以往那样复杂,非常简单。

此外,根据官方文档,升级过程会自动进行数据库备份,因此我们无需再单独进行数据备份。

要求说明

jumpserver 版本 >= v2.6.0
jumpserver 版本 < v2.6.0 的请先参考迁移文档迁移到最新版本

升级步骤

# cd /opt
# yum -y install wget
# wget https://github.com/jumpserver/installer/releases/download/v2.12.0/jumpserver-installer-v2.12.0.tar.gz
# tar -xf jumpserver-installer-v2.12.0.tar.gz
# cd jumpserver-installer-v2.12.0

# ./jmsctl.sh upgrade
是否将版本更新至 v2.12.0 ? (y/n)  (默认为 n): y

1. 检查配置变更
配置文件位置: /opt/jumpserver/config
/opt/jumpserver/config/config.txt  [ √ ]
/opt/jumpserver/config/core/config.yml  [ √ ]
/opt/jumpserver/config/koko/config.yml  [ √ ]
/opt/jumpserver/config/mariadb/mariadb.cnf  [ √ ]
/opt/jumpserver/config/mysql/my.cnf  [ √ ]
/opt/jumpserver/config/nginx/lb_http_server.conf  [ √ ]
/opt/jumpserver/config/nginx/lb_rdp_server.conf  [ √ ]
/opt/jumpserver/config/nginx/lb_ssh_server.conf  [ √ ]
/opt/jumpserver/config/redis/redis.conf  [ √ ]
/opt/jumpserver/config/nginx/cert/server.crt  [ √ ]
/opt/jumpserver/config/nginx/cert/server.key  [ √ ]
完成

2. 检查程序文件变更
完成

3. 升级镜像文件
Docker: Pulling from jumpserver/core:v2.12.0        [ OK ]
Docker: Pulling from jumpserver/koko:v2.12.0        [ OK ]
Docker: Pulling from jumpserver/nginx:v2.12.0       [ OK ]
Docker: Pulling from jumpserver/redis:6-alpine      [ OK ]
Docker: Pulling from jumpserver/mysql:5             [ OK ]
Docker: Pulling from jumpserver/lion:v2.12.0        [ OK ]
完成

4. 备份数据库
正在备份...
mysqldump: [Warning] Using a password on the command line interface can be insecure.
[SUCCESS] 备份成功! 备份文件已存放至: /opt/jumpserver/db_backup/jumpserver-2021-03-19_08:32:39.sql

5. 进行数据库变更
表结构变更可能需要一段时间, 请耐心等待
检测到 JumpServer 正在运行, 是否需要关闭并继续升级? (y/n)  (默认为 n): y

Stopping jms_core ... done
Stopping jms_koko ... done
Stopping jms_lion ... done
Stopping jms_nginx ... done
Stopping jms_celery ... done
Removing jms_core ... done
Removing jms_koko ... done
Removing jms_lion ... done
Removing jms_nginx ... done
Removing jms_celery ... done

2021-03-19 08:32:44 Collect static files
2021-03-19 08:32:44 Collect static files done
2021-03-19 08:32:44 Check database structure change ...
2021-03-19 08:32:44 Migrate model change to database ...

473 static files copied to '/opt/jumpserver/data/static'.
Operations to perform:
  Apply all migrations: acls, admin, applications, assets, audits, auth, authentication, captcha, common, contenttypes, django_cas_ng, django_celery_beat, jms_oidc_rp, ops, orgs, perms, sessions, settings, terminal, tickets, users
Running migrations:
  No migrations to apply.
  # 有时候是下方红色的提示,忽略即可,不需要做处理。
  Your models have changes that are not yet reflected in a migration, and so won't be applied.
  Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
完成

6. 清理镜像
是否需要清理旧版本镜像文件? (y/n)  (默认为 n): y
Untagged: jumpserver/core:v2.11.3
Untagged: jumpserver/luna:v2.11.3
Untagged: jumpserver/lina:v2.11.3
Untagged: jumpserver/koko:v2.11.3
Untagged: jumpserver/lion:v2.11.3
完成

7. 升级成功, 可以重新启动程序了
cd /opt/jumpserver-installer-v2.12.0
./jmsctl.sh start

# ./jmsctl.sh start

参考文献

JumpServer 文档/升级文档