Merge "Add DeployedServerEnvironmentOutput"
[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           config_files:
85             - source: "/var/lib/kolla/config_files/src/*"
86               dest: "/"
87               merge: true
88               preserve_properties: true
89           permissions:
90             - path: /var/log/horizon/
91               owner: apache:apache
92               recurse: true
93             # FIXME Apache tries to write a .lock file there
94             - path: /usr/share/openstack-dashboard/openstack_dashboard/local/
95               owner: apache:apache
96               recurse: false
97       docker_config:
98         step_2:
99           horizon_fix_perms:
100             image: &horizon_image
101               list_join:
102                 - '/'
103                 - [ {get_param: DockerNamespace}, {get_param: DockerHorizonImage} ]
104             user: root
105             # NOTE Set ownership for /var/log/horizon/horizon.log file here,
106             # otherwise it's created by root when generating django cache.
107             # FIXME Apache needs to read files in /etc/openstack-dashboard
108             # Need to set permissions to match the BM case,
109             # http://paste.openstack.org/show/609819/
110             command: ['/bin/bash', '-c', 'touch /var/log/horizon/horizon.log && chown -R apache:apache /var/log/horizon && chmod -R a+rx /etc/openstack-dashboard']
111             volumes:
112               - /var/log/containers/horizon:/var/log/horizon
113               - /var/lib/config-data/horizon/etc/:/etc/
114         step_3:
115           horizon:
116             image: *horizon_image
117             net: host
118             privileged: false
119             restart: always
120             volumes:
121               list_concat:
122                 - {get_attr: [ContainersCommon, volumes]}
123                 -
124                   - /var/lib/kolla/config_files/horizon.json:/var/lib/kolla/config_files/config.json:ro
125                   - /var/lib/config-data/puppet-generated/horizon/:/var/lib/kolla/config_files/src:ro
126                   - /var/log/containers/horizon:/var/log/horizon
127             environment:
128               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
129       host_prep_tasks:
130         - name: create persistent logs directory
131           file:
132             path: /var/log/containers/horizon
133             state: directory
134       upgrade_tasks:
135         - name: Stop and disable horizon service (running under httpd)
136           tags: step2
137           service: name=httpd state=stopped enabled=no
138       metadata_settings:
139         get_attr: [HorizonBase, role_data, metadata_settings]