openstack - horizon - 14.1.0 安装 部署 源码 开发 测试 环境 centos7

2023-05-16

一、系统环境

CentOS Linux release 7.8.2003 (Core)
Python 2.7.5
pip 20.2 from /usr/lib/python2.7/site-packages/pip (python 2.7)
Python3 3.5.9
pip3 -V
pip 20.2 from /usr/local/python3/lib/python3.5/site-packages/pip (python 3.5)

git version 1.8.3.1

[root@localhost ~]# tox --version
3.18.0 imported from /usr/lib/python2.7/site-packages/tox/__init__.pyc


horizon 14.1.0  (rocky)

二、下载源码、查看

    1、下载


    git clone https://git.openstack.org/openstack/horizon -b stable/rocky  --depth=1  

    2、查看

    cd horizon

    tox -l   #查看horizon项目需要的环境列表

[root@localhost horizon]# tox -l
pep8
py27
py35
py3-dj111
releasenotes
npm

 

三、安装依赖包

因horizon项目需要安装的依赖包较多,国内的朋友强烈建议使用国内pip源

mkdir ~/.pip
vim ~/.pip/pip.conf
[global] 
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = https://pypi.tuna.tsinghua.edu.cn

可能会有包缺失,也可以使用其他几个
 https://pypi.doubanio.com/simple
 http://mirrors.aliyun.com/pypi/simple/ 

可以先运行
tox -e runserver 试一下,多数情况下会失败,因为需要装的包太多了,所以我们要分步安装

1、yum 安装部分依赖包

yum install nss-devel nspr-devel -y
yum install -y libvirt-devel
yum -y install gcc intltool gperf glib2-devel  libcap-devel xz-devel
yum -y install systemd-devel libsystemd-dev

2、源码安装 liberasurecode

git clone https://github.com/openstack/liberasurecode
cd  liberasurecode
./autogen.sh
./configure
make
make test
make install

3 、pip 安装

    cd horizon

    a、安装requirements.txt中所描述包

        pip install -r requirements.txt

     b、安装test-requirements.txt中所描述包


        pip install -r test-requirements.txt

     c、安装upper-constraints.txt


        pip install -r upper-constraints.txt

项目中没有包含upper-constraints.txt文件,而是从
https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/rocky  读取,为提高安装速度将其下载至本地。

*安装过程中有很多无法删除和版本不兼容问题,基本可以用下面的办法解决
a、版本不兼容问题
pip install -I 包名称==所需版本
例如:
Failed to build pyeclib
ERROR: tox 3.18.0 has requirement pluggy>=0.12.0, but you'll have pluggy 0.6.0 which is incompatible.

pip install -I pluggy==0.12.0 -i  https://pypi.doubanio.com/simple

b、无法自动删除问题
用find命令找到无法删除的包文件,用rm命令直接删除,然后继续安装,例如:

ERROR: Cannot uninstall 'subprocess32'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

[root@localhost horizon]# find / -name subprocess32*
/root/.cache/pip/wheels/f8/8f/c3/8c6f9ac94ec272e4936840f14edb2128551136cd0a8dbf49d6/subprocess32-3.5.2-cp27-cp27mu-linux_x86_64.whl
/usr/lib64/python2.7/site-packages/subprocess32-3.2.6-py2.7.egg-info
[root@localhost horizon]# rm /usr/lib64/python2.7/site-packages/subprocess32-3.2.6-py2.7.egg-info
rm:是否删除普通文件 "/usr/lib64/python2.7/site-packages/subprocess32-3.2.6-py2.7.egg-info"?y

 

四、运行测试

1、复制local_setting文件


cp openstack_dashboard/local/local_settings.py.example openstack_dashboard/local/local_settings.py  

2、修改ALLOWED_HOSTS

vim openstack_dashboard/local/local_settings.py
 

# If horizon is running in production (DEBUG is False), set this
# with the list of host/domain names that the application can serve.
# For more information see:
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['*', ]

为方便测试,允许所有主机访问

3、修改URL至已部署成功的openstack集群以通过keyston验证

# For multiple regions uncomment this configuration, and add (endpoint, title).
#AVAILABLE_REGIONS = [
#    ('http://cluster1.example.com:5000/v3', 'cluster1'),
#    ('http://cluster2.example.com:5000/v3', 'cluster2'),
#]

OPENSTACK_HOST = "192.168.44.91"
OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST
OPENSTACK_KEYSTONE_DEFAULT_ROLE = "_member_"

本例已经在本地部署all-in-one集群 IP:192.168.44.91,可参考文章
https://blog.csdn.net/zhujisoft/article/details/106992997
 

4、运行服务

tox -e runserver 0:8002

[root@localhost horizon]# tox -e runserver 0:8002
runserver develop-inst-noop: /root/horizon
runserver installed: You are using pip version 10.0.1, however version 20.2 is available.,You should consider upgrading via the 'pip install --upgrade pip' command.,appdirs==1.4.3,asn1crypto==0.24.0,Babel==2.6.0,bandit==1.6.2,certifi==2018.4.16,cffi==1.11.5,chardet==3.0.4,cliff==2.13.0,cmd2==0.9.3,colorama==0.3.9,contextlib2==0.5.5,coverage==4.5.1,cryptography==2.3,debtcollector==1.20.0,decorator==4.3.0,deprecation==2.0.5,Django==2.0.7,django-appconf==1.0.2,django-babel==0.6.2,django-compressor==2.2,django-pyscss==2.0.2,doc8==0.8.0,docutils==0.14,dogpile.cache==0.6.6,extras==1.0.0,fasteners==0.14.1,fixtures==3.0.0,flake8==2.5.5,flake8-import-order==0.12,futurist==1.7.0,gitdb2==2.0.4,GitPython==2.1.11,hacking==0.12.0,-e git+https://git.openstack.org/openstack/horizon@096d582d60f18f309e7a985ed4e48e22646a4a6c#egg=horizon,idna==2.7,iso8601==0.1.12,jmespath==0.9.3,jsonpatch==1.23,jsonpointer==2.0,jsonschema==2.6.0,keystoneauth1==3.10.1,linecache2==1.0.0,mccabe==0.2.1,mock==2.0.0,monotonic==1.5,mox3==0.26.0,msgpack==0.5.6,munch==2.3.2,netaddr==0.7.19,netifaces==0.10.7,nodeenv==1.3.2,openstacksdk==0.17.3,os-client-config==1.31.2,os-service-types==1.3.0,osc-lib==1.11.1,oslo.concurrency==3.27.0,oslo.config==6.4.2,oslo.context==2.21.0,oslo.i18n==3.21.0,oslo.log==3.39.2,oslo.policy==1.38.1,oslo.serialization==2.27.0,oslo.utils==3.36.5,osprofiler==2.3.1,packaging==17.1,pbr==4.2.0,pep8==1.5.7,Pint==0.8.1,prettytable==0.7.2,pycodestyle==2.6.0,pycparser==2.18,pyflakes==0.8.1,pyinotify==0.9.6,pymongo==3.7.1,pyOpenSSL==18.0.0,pyparsing==2.2.0,pyperclip==1.6.4,pyScss==1.3.6,python-cinderclient==4.0.3,python-dateutil==2.7.3,python-glanceclient==2.13.2,python-keystoneclient==3.17.0,python-mimeparse==1.6.0,python-neutronclient==6.9.1,python-novaclient==11.0.1,python-swiftclient==3.6.1,pytz==2018.5,PyYAML==3.13,rcssmin==1.0.6,requests==2.20.1,requestsexceptions==1.4.0,restructuredtext-lint==1.1.3,rfc3986==1.1.0,rjsmin==1.0.12,selenium==3.13.0,semantic-version==2.6.0,simplejson==3.16.0,six==1.11.0,smmap2==2.0.4,stevedore==1.29.0,testscenarios==0.5.0,testtools==2.3.0,traceback2==1.4.0,unittest2==1.1.0,urllib3==1.23,warlock==1.3.0,wcwidth==0.1.7,WebOb==1.8.2,wrapt==1.10.11,XStatic==1.0.1,XStatic-Angular==1.5.8.0,XStatic-Angular-Bootstrap==2.2.0.0,XStatic-Angular-FileUpload==12.0.4.0,XStatic-Angular-Gettext==2.3.8.0,XStatic-Angular-lrdragndrop==1.0.2.2,XStatic-Angular-Schema-Form==0.8.13.0,XStatic-Bootstrap-Datepicker==1.3.1.0,XStatic-Bootstrap-SCSS==3.3.7.1,XStatic-bootswatch==3.3.7.0,XStatic-D3==3.5.17.0,XStatic-Font-Awesome==4.7.0.0,XStatic-Hogan==2.0.0.2,XStatic-Jasmine==2.4.1.1,XStatic-jQuery==1.10.2.1,XStatic-JQuery-Migrate==1.2.1.1,XStatic-jquery-ui==1.12.0.1,XStatic-JQuery.quicksearch==2.0.3.1,XStatic-JQuery.TableSorter==2.14.5.1,XStatic-JSEncrypt==2.3.1.1,XStatic-mdi==1.4.57.0,XStatic-objectpath==1.2.1.0,XStatic-Rickshaw==1.5.0.0,XStatic-roboto-fontface==0.5.0.0,XStatic-smart-table==1.4.13.2,XStatic-Spin==1.2.5.2,XStatic-term.js==0.0.7.0,XStatic-tv4==1.2.7.0,xvfbwrapper==0.2.9
runserver run-test-pre: PYTHONHASHSEED='4059497005'
runserver run-test: commands[0] | /root/horizon/.tox/runserver/bin/python /root/horizon/manage.py runserver 0:8002
Performing system checks...

System check identified no issues (0 silenced).
August 01, 2020 - 02:53:01
Django version 2.0.7, using settings 'openstack_dashboard.settings'
Starting development server at http://0:8002/
Quit the server with CONTROL-C.

 

登录后,可正常工作

 

五、参考文章

https://docs.openstack.org/horizon/rocky/contributor/quickstart.html#

https://docs.openstack.org/horizon/rocky/contributor/tutorials/dashboard.html 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

openstack - horizon - 14.1.0 安装 部署 源码 开发 测试 环境 centos7 的相关文章

随机推荐