diff --git a/snap/etc/horizon/horizon.conf b/snap/etc/horizon/horizon.conf new file mode 100644 index 0000000..da29406 --- /dev/null +++ b/snap/etc/horizon/horizon.conf @@ -0,0 +1,4 @@ +# The horizon snap may need to override default config files. +# For example if the default horizon.conf file located in +# $SNAP/etc/horizon/horizon.conf needs to be overridden, +# it can be done with this file. diff --git a/snap/snap-openstack.yaml b/snap/snap-openstack.yaml index 33c6c65..5541177 100644 --- a/snap/snap-openstack.yaml +++ b/snap/snap-openstack.yaml @@ -9,7 +9,8 @@ setup: - "{snap_common}/etc/neutron/rootwrap.d" - "{snap_common}/etc/nginx/sites-enabled" - "{snap_common}/etc/nginx/snap/sites-enabled" - - "{snap_common}/etc/glance/glance.conf.d" + - "{snap_common}/etc/glance/glance.conf.d" + - "{snap_common}/etc/horizon/horizon.conf.d" - "{snap_common}/etc/uwsgi/snap" - "{snap_common}/fernet-keys" - "{snap_common}/lib" @@ -27,6 +28,9 @@ setup: glance-snap.conf.j2: "{snap_common}/etc/glance/glance.conf.d/glance-snap.conf" cinder-nginx.conf.j2: "{snap_common}/etc/nginx/snap/sites-enabled/cinder.conf" cinder-snap.conf.j2: "{snap_common}/etc/cinder/cinder.conf.d/cinder-snap.conf" +# TODO add local_settings.py + horizon-snap.conf.j2: "{snap_common}/etc/horizon/horizon.conf.d/horizon-snap.conf" + horizon-nginx.conf.j2: "{snap_common}/etc/nginx/snap/sites-enabled/horizon.conf" entry_points: keystone-manage: binary: "{snap}/bin/keystone-manage" @@ -210,3 +214,17 @@ entry_points: log-file: "{snap_common}/log/cinder-api.log" templates: cinder-api.ini.j2: "{snap_common}/etc/uwsgi/snap/cinder-api.ini" + horizon-uwsgi: + type: uwsgi + uwsgi-dir: "{snap_common}/etc/uwsgi/snap" + uwsgi-dir-override: "{snap_common}/etc/uwsgi" + uwsgi-log: "{snap_common}/log/uwsgi.log" + config-files: + - "{snap}/etc/horizon/horizon.conf" + config-files-override: + - "{snap_common}/etc/horizon/horizon.conf" + config-dirs: + - "{snap_common}/etc/horizon/horizon.conf.d" + log-file: "{snap_common}/log/horizon-api.log" + templates: + horizon-api.ini.j2: "{snap_common}/etc/uwsgi/snap/horizon-api.ini" diff --git a/snap/templates/horizon-api.ini.j2 b/snap/templates/horizon-api.ini.j2 new file mode 100644 index 0000000..04d7aaf --- /dev/null +++ b/snap/templates/horizon-api.ini.j2 @@ -0,0 +1,16 @@ +# If the OpenStack service has an API that runs behind uwsgi+nginx, you'll need +# to define this template. Be sure to update the path for the wsgi-file and +# "api-name" for the socket. You may also want to rename this file according to +# the service it provides, and you may even need to provide multiple uwsgi files +# if there is more than one wsgi application. +[uwsgi] +wsgi-file = {{ snap }}/bin/horizon-wsgi-file-name +uwsgi-socket = {{ snap_common }}/run/api-name.sock +buffer-size = 65535 +master = true +enable-threads = true +processes = 4 +thunder-lock = true +lazy-apps = true +home = {{ snap }}/usr +pyargv = {{ pyargv }} diff --git a/snap/templates/horizon-nginx.conf.j2 b/snap/templates/horizon-nginx.conf.j2 new file mode 100644 index 0000000..a5fa735 --- /dev/null +++ b/snap/templates/horizon-nginx.conf.j2 @@ -0,0 +1,13 @@ +# If the OpenStack service has an API that runs behind uwsgi+nginx, you'll need +# to define this template. Be sure to update "listen" with the port number and +# also update "api-name" for the socket. +server { + listen 1234; + access_log {{ snap_common }}/log/nginx-access.log; + error_log {{ snap_common }}/log/nginx-error.log; + location / { + include {{ snap }}/usr/conf/uwsgi_params; + uwsgi_param SCRIPT_NAME ''; + uwsgi_pass unix://{{ snap_common }}/run/api-name.sock; + } +} diff --git a/snap/templates/horizon-snap.conf.j2 b/snap/templates/horizon-snap.conf.j2 new file mode 100644 index 0000000..f683970 --- /dev/null +++ b/snap/templates/horizon-snap.conf.j2 @@ -0,0 +1,7 @@ +[DEFAULT] +# Set state path to writable directory +state_path = {{ snap_common }}/lib + +[oslo_concurrency] +# Oslo Concurrency lock path +lock_path = {{ snap_common }}/lock diff --git a/snapcraft.yaml b/snapcraft.yaml index 81fc3a4..68f96e6 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -217,6 +217,13 @@ apps: plugs: - network + # Horizon + uwsgi: + command: snap-openstack horizon-uwsgi + daemon: simple + plugs: + - network-bind + parts: # Keystone keystone: @@ -406,7 +413,7 @@ parts: # Openstack Shared Parts templates: - after: [keystone, nova, neutron, openvswitch, cinder] + after: [keystone, nova, neutron, openvswitch, cinder, horizon] plugin: dump source: snap @@ -680,4 +687,32 @@ parts: stage: [$etc] prime: [$etc] - + # Horizon + horizon: + after: [keystone] + plugin: python + python-version: python2 + source: http://tarballs.openstack.org/horizon/horizon-stable-rocky.tar.gz + python-packages: + - uwsgi + - git+https://github.com/openstack/snap.openstack#egg=snap.openstack + constraints: https://raw.githubusercontent.com/openstack/requirements/stable/rocky/upper-constraints.txt + build-packages: + - gcc + - libffi-dev + - libssl-dev + - libxml2-dev + - libxslt1-dev + horizon-config: + after: [horizon] + plugin: dump + source: http://tarballs.openstack.org/horizon/horizon-stable-rocky.tar.gz + organize: + etc/*.conf: etc/horizon/ + filesets: + etc: + - etc/horizon/*.conf + stage: [$etc] + prime: [$etc] + +