[ English | English (United Kingdom) | 中文 (简体, 中国) | Indonesia | русский | français | नेपाली | Deutsch | Esperanto | português (Brasil) | español | 한국어 (대한민국) ]

Manuelle Installation

Diese Seite behandelt die grundlegende Installation von Horizon in einer Produktionsumgebung. Wenn Sie eine Entwicklerumgebung suchen, lesen Sie: ref: quickstart.

Für Systemabhängigkeiten siehe System Anforderungen.

Installation

Bemerkung

Ersetzen Sie in den nachfolgenden Kommandos „<release>“ durch Ihre gewählte Version, bspw. „queens“ oder „rocky“.

Falls Sie die Entwicklungsversion nutzen, ersetzen Sie „stable/<release>“ mit „master“.

  1. Horizon duplizieren

    $ git clone https://opendev.org/openstack/horizon -b stable/<release> --depth=1
    $ cd horizon
    
  2. Installieren Sie die Horizon Python Module in Ihr System

    $ sudo pip install -c https://opendev.org/openstack/requirements/raw/branch/stable/<release>/upper-constraints.txt .
    

Konfiguration

Dieser Abschnitt enthält eine kleine Zusammenfassung der kritischen Einstellungen, die für Horizon notwendig sind. Für weitere Details beziehen Sie sich auf Settings Reference.

Einstellungen

Erzeugen Sie openstack_dashboard/local/local_settings.py. Üblicherweise ist es eine gute Idee, openstack_dashboard/local/local_settings.py.example zu kopieren und zu bearbeiten. Mindestens müssen folgende Einstellungen geändert werden:

DEBUG

Auf Falsch setzen

ALLOWED_HOSTS

Domänen-Name setzen

OPENSTACK_HOST

Auf die IP Ihres Keystone Endpunktes setzen. Möglicherweise müssen Sie auch OPENSTACK_KEYSTONE_URL ändern

Bemerkung

Die folgenden Schritte im Abschnitt „Konfiguration“ sind optional, aber in einer Produktiv-Umgebung sehr empfohlen.

Übersetzungen

Compile translation message catalogs for internationalization. This step is not required if you do not need to support languages other than US English. GNU gettext tool is required to compile message catalogs.

$ sudo apt install gettext
$ ./manage.py compilemessages

Static Assets

Compress your static files by adding COMPRESS_OFFLINE = True to your local_settings.py, then run the following commands

$ ./manage.py collectstatic
$ ./manage.py compress

Protokollierung

Horizons uses Django’s logging configuration mechanism, which can be customized by altering the LOGGING dictionary in local_settings.py. By default, Horizon’s logging example sets the log level to INFO.

Horizon nutzt auch eine Reihe von 3rd-party clients, welche gtrennt für sich protokollieren. Die Protokollebene für diese Anwendungen kann weiterhin gesteuert werden über Horizon’s LOGGING Konfiguration. Das Verhalten kann jedoch jenseits der Kontrolle von Horizon variieren.

For more information regarding configuring logging in Horizon, please read the Django logging directive and the Python logging directive documentation. Horizon is built on Python and Django.

Sitzungsspeicher

Horizon uses Django’s sessions framework for handling session data. There are numerous session backends available, which are selected through the SESSION_ENGINE setting in your local_settings.py file.

Memcached

SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
        'LOCATION': 'controller:11211',
    }
}

Externes Caching mit einer Anwendung wie memcached bietet Persistenz und gemeinsamen Speicher und kann für die Bereitstellung und / oder Entwicklung in kleinem Maßstab sehr nützlich sein. Für verteilte und hochverfügbare Szenarien weist memcached jedoch inhärente Probleme auf, die über den Rahmen dieser Dokumentation hinausgehen.

Anforderungen:

  • Der Dienst Memcached wird ausgeführt und ist verfügbar

  • Das Modul Python Memcached ist installiert

Datenbank

SESSION_ENGINE = 'django.core.cache.backends.db.DatabaseCache'
DATABASES = {
    'default': {
        # Database configuration here
    }
}

Datenbankgestützte Sitzungen sind skalierbar (bei Verwendung einer geeigneten Datenbank Strategie), dauerhaft, und kann parallel und hochverfügbar gemacht werden.

The downside to this approach is that database-backed sessions are one of the slower session storages, and incur a high overhead under heavy usage. Proper configuration of your database deployment can also be a substantial undertaking and is far beyond the scope of this documentation.

Zwischengespeicherte Datenbank

To mitigate the performance issues of database queries, you can also consider using Django’s cached_db session backend which utilizes both your database and caching infrastructure to perform write-through caching and efficient retrieval. You can enable this hybrid setting by configuring both your database and cache as discussed above and then using

SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"

Bereitstellung

  1. Setzen Sie einen Web-Server mit WSGI Unterstützung auf. Installieren Sie zum Beispiel Apache Web-Server für Ubuntu

    $ sudo apt install apache2 libapache2-mod-wsgi
    

    You can either use the provided openstack_dashboard/wsgi.py or generate a openstack_dashboard/horizon_wsgi.py file with the following command (which detects if you use a virtual environment or not to automatically build an adapted WSGI file)

    $ ./manage.py make_web_conf --wsgi
    

    Then configure the web server to host OpenStack dashboard via WSGI. For apache2 web server, you may need to create /etc/apache2/sites-available/horizon.conf. The template in DevStack is a good example of the file. https://opendev.org/openstack/devstack/src/branch/master/files/apache-horizon.template. Or you can automatically generate an apache configuration file. If you previously generated an openstack_dashboard/horizon_wsgi.py file it will use that, otherwise will default to using openstack_dashboard/wsgi.py

    $ ./manage.py make_web_conf --apache > /etc/apache2/sites-available/horizon.conf
    

    Das gleiche wie zuvor, nur mit SSL Unterstützung, falls Sie möchten

    $ ./manage.py make_web_conf --apache --ssl --sslkey=/path/to/ssl/key --sslcert=/path/to/ssl/cert > /etc/apache2/sites-available/horizon.conf
    

    By default the apache configuration will launch a number of apache processes equal to the number of CPUs + 1 of the machine on which you launch the make_web_conf command. If the target machine is not the same or if you want to specify the number of processes, add the --processes option

    $ ./manage.py make_web_conf --apache --processes 10 > /etc/apache2/sites-available/horizon.conf
    
  2. Aktivieren Sie die obige Einstellung und Starten den Webserver neu

    $ sudo a2ensite horizon
    $ sudo service apache2 restart
    

Nächste Schritte