Horizon 二次开发-部署

xiaoxiao2021-02-28  87

ubuntu 直接部署

可能很多人认为,horizon需要部署到controller节点上,其实openstack dashboard 在部署时不一定要部署到controller节点上,可以防止任何能连接云平台环境的地方。方法如下:

hosts文件 vi /etc/hosts 10.0.0.11 controller apache2环境 /etc/apache2/apache2.conf ServerName local_ip 安装horizon apt install openstack-dashboard 修改local_setting.py ... OPENSTACK_HOST = "controller" ... ALLOWED_HOSTS = [*,] ... SESSION_ENGINE = 'django.contrib.sessions.backends.cache' CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION': 'controller:11211', } } ... OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST # 这里要注意一下,如果在登录界面一直是登录失败,你要把v3换成v2!!! ... OPENSTACK_API_VERSIONS = { "identity": 3, "image": 2, "volume": 2, } ... OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = "Default" # 如果没有特殊的域可以不加,官方是加了... ... # 巴拉巴拉一堆,按照官网上来就行,特别是要注意一下OPENSTACK_KEYSTONE_URL这个v3和v2的问题

可能遇到的问题是:安装后,http://ip/horizon始终登陆上去,检查日志发现:Timeout when reading response headers from daemon process ‘horizon’: /usr/share/openstack-dashbo…

解决方法:

open the dashboard configuration file: vim /etc/apache2/conf-available/openstack-dashboard.conf

Add the following line to the configturation: WSGIApplicationGroup %{GLOBAL}

Reload the Apache service apache2 reload

开发准备

最好是一个干净的系统(ubuntu16.04.2)

阿里云的源

# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties deb http://mirrors.aliyun.com/ubuntu/ xenial universe deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties deb http://archive.canonical.com/ubuntu xenial partner deb-src http://archive.canonical.com/ubuntu xenial partner deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse pip 准备安装pip 注意:最好别用apt-get 的方法,这个方法功能可能不全(版本老) #: wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate #: python get-pip.py 修改pip源 在主目录下创建.pip文件夹 mkdir ~/.pip 然后在该目录下创建pip.conf文件编写如下内容: [global] trusted-host = pypi.douban.com index-url = http://pypi.douban.com/simple 获取horizon包 git clone https://github.com/openstack/horizon.git 下载依赖文件(下载文件,方便以后使用,避免移植开发环境重复下载) #:cd horizon #:mkdir depends #:cd depends #:pip download -r ../requirements.txt ...

* 有两种方式进行安装依赖,一种是直接安装到python大环境中,一种是装安装到隔离环境中(推荐到隔离环境中)*** 1.直接安装离线包—不推荐

#:pip install -r requirements.txt --no-index --find-links=file:///home/ubuntu/horizon/depends

等待安装完成…安装过程中可能遇到问题: error: command ‘x86_64-linux-gnu-gcc’ failed with exit status 1 解决方法: sudo apt-get install build-essential libssl-dev libffi-dev python-dev

执行命令: python manage.py collectstatic python manage.py compress –force python manage.py runserver 0.0.0.0:8000 试试能不能访问吧~~~

2.安装到隔离环境中(优先选择吧) * 进入到tools目录下 * python install_venv.py * 等到安装结束后,cd .. 执行 source .venv/bin/active * python manage.py runserver 0.0.0.0:8000

转载请注明原文地址: https://www.6miu.com/read-47584.html

最新回复(0)