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