Merge "adding --config-dir parameters to neutron containers"
[apex-tripleo-heat-templates.git] / docker / services / horizon.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Horizon service
5
6 parameters:
7   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerHorizonImage:
12     description: image
13     default: 'centos-binary-horizon:latest'
14     type: string
15   DockerHorizonConfigImage:
16     description: The container image to use for the horizon config_volume
17     default: 'centos-binary-horizon:latest'
18     type: string
19   EndpointMap:
20     default: {}
21     description: Mapping of service endpoint -> protocol. Typically set
22                  via parameter_defaults in the resource registry.
23     type: json
24   ServiceNetMap:
25     default: {}
26     description: Mapping of service_name -> network name. Typically set
27                  via parameter_defaults in the resource registry.  This
28                  mapping overrides those in ServiceNetMapDefaults.
29     type: json
30   DefaultPasswords:
31     default: {}
32     type: json
33   RoleName:
34     default: ''
35     description: Role name on which the service is applied
36     type: string
37   RoleParameters:
38     default: {}
39     description: Parameters specific to the role
40     type: json
41
42 resources:
43
44   ContainersCommon:
45     type: ./containers-common.yaml
46
47   HorizonBase:
48     type: ../../puppet/services/horizon.yaml
49     properties:
50       EndpointMap: {get_param: EndpointMap}
51       ServiceNetMap: {get_param: ServiceNetMap}
52       DefaultPasswords: {get_param: DefaultPasswords}
53       RoleName: {get_param: RoleName}
54       RoleParameters: {get_param: RoleParameters}
55
56 outputs:
57   role_data:
58     description: Role data for the Horizon API role.
59     value:
60       service_name: {get_attr: [HorizonBase, role_data, service_name]}
61       config_settings:
62         map_merge:
63           - get_attr: [HorizonBase, role_data, config_settings]
64           - horizon::vhost_extra_params:
65               add_listen: true
66               priority: 10
67               access_log_format: '%a %l %u %t \"%r\" %>s %b \"%%{}{Referer}i\" \"%%{}{User-Agent}i\"'
68               options: ['FollowSymLinks','MultiViews']
69           - horizon::secure_cookies: false
70       step_config: {get_attr: [HorizonBase, role_data, step_config]}
71       service_config_settings: {get_attr: [HorizonBase, role_data, service_config_settings]}
72       # BEGIN DOCKER SETTINGS
73       puppet_config:
74         config_volume: horizon
75         puppet_tags: horizon_config
76         step_config: {get_attr: [HorizonBase, role_data, step_config]}
77         config_image:
78           list_join:
79             - '/'
80             - [ {get_param: DockerNamespace}, {get_param: DockerHorizonConfigImage} ]
81       kolla_config:
82         /var/lib/kolla/config_files/horizon.json:
83           command: /usr/sbin/httpd -DFOREGROUND
84           permissions:
85             - path: /var/log/horizon/
86               owner: apache:apache
87               recurse: true
88             # FIXME Apache tries to write a .lock file there
89             - path: /usr/share/openstack-dashboard/openstack_dashboard/local/
90               owner: apache:apache
91               recurse: false
92       docker_config:
93         step_2:
94           horizon_fix_perms:
95             image: &horizon_image
96               list_join:
97                 - '/'
98                 - [ {get_param: DockerNamespace}, {get_param: DockerHorizonImage} ]
99             user: root
100             # NOTE Set ownership for /var/log/horizon/horizon.log file here,
101             # otherwise it's created by root when generating django cache.
102             # FIXME Apache needs to read files in /etc/openstack-dashboard
103             # Need to set permissions to match the BM case,
104             # http://paste.openstack.org/show/609819/
105             command: ['/bin/bash', '-c', 'touch /var/log/horizon/horizon.log && chown -R apache:apache /var/log/horizon && chmod -R a+rx /etc/openstack-dashboard']
106             volumes:
107               - /var/log/containers/horizon:/var/log/horizon
108               - /var/lib/config-data/horizon/etc/:/etc/
109         step_3:
110           horizon:
111             image: *horizon_image
112             net: host
113             privileged: false
114             restart: always
115             volumes:
116               list_concat:
117                 - {get_attr: [ContainersCommon, volumes]}
118                 -
119                   - /var/lib/kolla/config_files/horizon.json:/var/lib/kolla/config_files/config.json:ro
120                   - /var/lib/config-data/horizon/etc/httpd:/etc/httpd:ro
121                   - /var/lib/config-data/horizon/etc/openstack-dashboard:/etc/openstack-dashboard:ro
122                   - /var/log/containers/horizon:/var/log/horizon
123             environment:
124               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
125       host_prep_tasks:
126         - name: create persistent logs directory
127           file:
128             path: /var/log/containers/horizon
129             state: directory
130       upgrade_tasks:
131         - name: Stop and disable horizon service (running under httpd)
132           tags: step2
133           service: name=httpd state=stopped enabled=no
134       metadata_settings:
135         get_attr: [HorizonBase, role_data, metadata_settings]