开发环境搭建
前端
yum install npm
npm config set registry https://registry.npmmirror.com
npm install -g n
# 查看npm与nodejs的版本,确保匹配。
# 在环境上编译安装ceph
# 切换到如下目录
/usr/share/ceph/mgr/dashboard/frontend
npm install
生成配置文件,启动
root@sims53[/usr/share/ceph/mgr/dashboard/frontend]# nvm use 14
Now using node v14.21.3 (npm v6.14.18)
root@sims53[/usr/share/ceph/mgr/dashboard/frontend]# cat proxy.conf.json # 里面的地址和端口是mgr dashboard服务的地址端口
{
"/api/": {
"target": "http://10.10.136.91:8080",
"secure": false,
"logLevel": "debug"
},
"/ui-api/": {
"target": "http://10.10.136.91:8080",
"secure": false,
"logLevel": "debug"
}
}
root@sims53[/usr/share/ceph/mgr/dashboard/frontend]# npm start
> ceph-dashboard@0.0.0 start /usr/share/ceph/mgr/dashboard/frontend
> npm run env_build && ng serve --host 0.0.0.0 --ssl
> ceph-dashboard@0.0.0 env_build /usr/share/ceph/mgr/dashboard/frontend
> cp src/environments/environment.tpl.ts src/environments/environment.prod.ts && cp src/environments/environment.tpl.ts src/environments/environment.ts && node ./environment.build.js
Environment variables have been set
WARNING: This is a simple server for use in testing or debugging Angular applications
locally. It hasn't been reviewed for security issues.
Binding this server to an open connection can result in compromising your application or
computer. Using a different host than the one passed to the "--host" flag might result in
websocket connection issues. You might need to use "--disableHostCheck" if that's the
case.
** Angular Live Development Server is listening on 0.0.0.0:4200, open your browser on https://localhost:4200/ **
10% building 3/3 modules 0 active[HPM] Proxy created: /api/ -> http://10.10.136.91:8080
[HPM] Subscribed to http-proxy events: [ 'error', 'close' ]
[HPM] Proxy created: /ui-api/ -> http://10.10.136.91:8080
[HPM] Subscribed to http-proxy events: [ 'error', 'close' ]
11% building 12/12 modules 0 activeBrowserslist: caniuse-lite is outdated. Please run next command `npm update`
Date: 2024-04-26T05:50:21.615Z
Hash: 9c183f7dc657d47885bc
Time: 38282ms
chunk {ceph-block-block-module-ngfactory} ceph-block-block-module-ngfactory.js, ceph-block-block-module-ngfactory.js.map (ceph-block-block-module-ngfactory) 513 kB [rendered]
chunk {ceph-pool-pool-module-ngfactory} ceph-pool-pool-module-ngfactory.js, ceph-pool-pool-module-ngfactory.js.map (ceph-pool-pool-module-ngfactory) 460 kB [rendered]
chunk {ceph-rgw-rgw-module-ngfactory} ceph-rgw-rgw-module-ngfactory.js, ceph-rgw-rgw-module-ngfactory.js.map (ceph-rgw-rgw-module-ngfactory) 717 kB [rendered]
chunk {core-auth-auth-module-ngfactory} core-auth-auth-module-ngfactory.js, core-auth-auth-module-ngfactory.js.map (core-auth-auth-module-ngfactory) 197 kB [rendered]
chunk {default~ceph-block-block-module-ngfactory~ceph-pool-pool-module-ngfactory} default~ceph-block-block-module-ngfactory~ceph-pool-pool-module-ngfactory.js, default~ceph-block-block-module-ngfactory~ceph-pool-pool-module-ngfactory.js.map (default~ceph-block-block-module-ngfactory~ceph-pool-pool-module-ngfactory) 765 kB [rendered]
chunk {default~ceph-pool-pool-module-ngfactory~core-auth-auth-module-ngfactory} default~ceph-pool-pool-module-ngfactory~core-auth-auth-module-ngfactory.js, default~ceph-pool-pool-module-ngfactory~core-auth-auth-module-ngfactory.js.map (default~ceph-pool-pool-module-ngfactory~core-auth-auth-module-ngfactory) 20.6 kB [rendered]
chunk {main} main.js, main.js.map (main) 5.23 MB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 416 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 9.3 kB [entry] [rendered]
chunk {scripts} scripts.js, scripts.js.map (scripts) 537 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 1.22 MB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 7.62 MB [initial] [rendered]
ℹ 「wdm」: Compiled successfully.
浏览器访问 https://IP:4200
版本释出
npm run-script build
后端
修改/usr/share/ceph/mgr/dashboard
下的代码
项目目录结构如下:
root@sims53[/usr/share/ceph/mgr/dashboard]# tree -L 3 -I "node_modules|*.pyc|*.pyo"
.
|-- HACKING.rst
|-- README.rst
|-- __init__.py
|-- awsauth.py
|-- cherrypy_backports.py
|-- ci
| `-- check_grafana_uids.py
|-- constraints.txt
|-- controllers
| |-- __init__.py
| |-- auth.py
| |-- cephfs.py
| |-- cluster_configuration.py
| |-- docs.py
| |-- erasure_code_profile.py
| |-- grafana.py
| |-- health.py
| |-- home.py
| |-- host.py
| |-- iscsi.py
| |-- logging.py
| |-- logs.py
| |-- mgr_modules.py
| |-- monitor.py
| |-- nfsganesha.py
| |-- osd.py
| |-- perf_counters.py
| |-- pool.py
| |-- prometheus.py
| |-- rbd.py
| |-- rbd_mirroring.py
| |-- rgw.py
| |-- role.py
| |-- saml2.py
| |-- settings.py
| |-- summary.py
| |-- task.py
| `-- user.py
|-- exceptions.py
|-- frontend
| |-- angular.json
| |-- dist
| | `-- en-US
| |-- e2e
| | |-- block
| | |-- cluster
| | |-- filesystems
| | |-- helper.po.ts
| | |-- nfs
| | |-- pools
| | `-- tsconfig.e2e.json
| |-- environment.build.js
| |-- html-linter.config.json
| |-- i18n.config.json
| |-- package-lock.json
| |-- package.json
| |-- protractor.conf.js
| |-- proxy.conf.json
| |-- src
| | |-- app
| | |-- assets
| | |-- defaults.scss
| | |-- environments
| | |-- favicon.ico
| | |-- index.html
| | |-- jestGlobalMocks.ts
| | |-- locale
| | |-- main.ts
| | |-- polyfills.ts
| | |-- setupJest.ts
| | |-- styles
| | |-- styles.scss
| | |-- testing
| | |-- tsconfig.app.json
| | |-- tsconfig.spec.json
| | |-- typings.d.ts
| | |-- unit-test-configuration.ts.sample
| | |-- vendor.overrides.scss
| | `-- vendor.variables.scss
| |-- tsconfig.json
| `-- tslint.json
|-- grafana.py
|-- module.py
|-- plugins
| |-- __init__.py
| |-- debug.py
| |-- feature_toggles.py
| |-- interfaces.py
| |-- lru_cache.py
| |-- pluggy.py
| |-- plugin.py
| `-- ttl_cache.py
|-- requirements-py27.txt
|-- requirements-py3.txt
|-- requirements.txt
|-- rest_client.py
|-- run-backend-api-request.sh
|-- run-backend-api-tests.sh
|-- run-backend-rook-api-request.sh
|-- run-frontend-e2e-tests.sh
|-- run-frontend-unittests.sh
|-- run-tox.sh
|-- security.py
|-- services
| |-- __init__.py
| |-- access_control.py
| |-- auth.py
| |-- ceph_service.py
| |-- cephfs.py
| |-- cephx.py
| |-- exception.py
| |-- ganesha.py
| |-- iscsi_cli.py
| |-- iscsi_client.py
| |-- iscsi_config.py
| |-- orchestrator.py
| |-- rbd.py
| |-- rgw_client.py
| |-- sso.py
| `-- tcmu_service.py
|-- settings.py
|-- tests
| |-- __init__.py
| |-- helper.py
| |-- test_access_control.py
| |-- test_api_auditing.py
| |-- test_auth.py
| |-- test_ceph_service.py
| |-- test_cephfs.py
| |-- test_controllers.py
| |-- test_docs.py
| |-- test_erasure_code_profile.py
| |-- test_exceptions.py
| |-- test_feature_toggles.py
| |-- test_ganesha.py
| |-- test_grafana.py
| |-- test_home.py
| |-- test_iscsi.py
| |-- test_notification.py
| |-- test_osd.py
| |-- test_plugin_debug.py
| |-- test_pool.py
| |-- test_prometheus.py
| |-- test_rbd.py
| |-- test_rbd_mirroring.py
| |-- test_rbd_service.py
| |-- test_rest_client.py
| |-- test_rest_tasks.py
| |-- test_rgw.py
| |-- test_rgw_client.py
| |-- test_settings.py
| |-- test_sso.py
| |-- test_task.py
| `-- test_tools.py
|-- tools.py
`-- tox.ini
测试修改主机列表内容
修改后