Merge "List all unhealthy containers" into stable/pike
[apex-tripleo-heat-templates.git] / docker / services / aodh-api.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized aodh service
5
6 parameters:
7   DockerAodhApiImage:
8     description: image
9     type: string
10   DockerAodhConfigImage:
11     description: The container image to use for the aodh config_volume
12     type: string
13   EndpointMap:
14     default: {}
15     description: Mapping of service endpoint -> protocol. Typically set
16                  via parameter_defaults in the resource registry.
17     type: json
18   ServiceData:
19     default: {}
20     description: Dictionary packing service data
21     type: json
22   ServiceNetMap:
23     default: {}
24     description: Mapping of service_name -> network name. Typically set
25                  via parameter_defaults in the resource registry.  This
26                  mapping overrides those in ServiceNetMapDefaults.
27     type: json
28   DefaultPasswords:
29     default: {}
30     type: json
31   RoleName:
32     default: ''
33     description: Role name on which the service is applied
34     type: string
35   RoleParameters:
36     default: {}
37     description: Parameters specific to the role
38     type: json
39   EnableInternalTLS:
40     type: boolean
41     default: false
42
43 conditions:
44
45   internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
46
47 resources:
48
49   ContainersCommon:
50     type: ./containers-common.yaml
51
52   MySQLClient:
53     type: ../../puppet/services/database/mysql-client.yaml
54
55   AodhApiPuppetBase:
56       type: ../../puppet/services/aodh-api.yaml
57       properties:
58         EndpointMap: {get_param: EndpointMap}
59         ServiceNetMap: {get_param: ServiceNetMap}
60         DefaultPasswords: {get_param: DefaultPasswords}
61         RoleName: {get_param: RoleName}
62         RoleParameters: {get_param: RoleParameters}
63
64 outputs:
65   role_data:
66     description: Role data for the aodh API role.
67     value:
68       service_name: {get_attr: [AodhApiPuppetBase, role_data, service_name]}
69       config_settings:
70         map_merge:
71           - get_attr: [AodhApiPuppetBase, role_data, config_settings]
72           - apache::default_vhost: false
73       logging_source: {get_attr: [AodhApiPuppetBase, role_data, logging_source]}
74       logging_groups: {get_attr: [AodhApiPuppetBase, role_data, logging_groups]}
75       step_config: &step_config
76         list_join:
77           - "\n"
78           - - {get_attr: [AodhApiPuppetBase, role_data, step_config]}
79             - {get_attr: [MySQLClient, role_data, step_config]}
80       service_config_settings: {get_attr: [AodhApiPuppetBase, role_data, service_config_settings]}
81       # BEGIN DOCKER SETTINGS
82       puppet_config:
83         config_volume: aodh
84         puppet_tags: aodh_api_paste_ini,aodh_config
85         step_config: *step_config
86         config_image: {get_param: DockerAodhConfigImage}
87       kolla_config:
88         /var/lib/kolla/config_files/aodh_api.json:
89           command: /usr/sbin/httpd -DFOREGROUND
90           config_files:
91             - source: "/var/lib/kolla/config_files/src/*"
92               dest: "/"
93               merge: true
94               preserve_properties: true
95           permissions:
96             - path: /var/log/aodh
97               owner: aodh:aodh
98               recurse: true
99       docker_config:
100         # db sync runs before permissions set by kolla_config
101         step_2:
102           aodh_init_log:
103             image: &aodh_api_image {get_param: DockerAodhApiImage}
104             user: root
105             volumes:
106               - /var/log/containers/aodh:/var/log/aodh
107               - /var/log/containers/httpd/aodh-api:/var/log/httpd
108             command: ['/bin/bash', '-c', 'chown -R aodh:aodh /var/log/aodh']
109         step_3:
110           aodh_db_sync:
111             image: *aodh_api_image
112             net: host
113             privileged: false
114             detach: false
115             user: root
116             volumes:
117               list_concat:
118                 - {get_attr: [ContainersCommon, volumes]}
119                 -
120                   - /var/lib/config-data/aodh/etc/my.cnf.d/tripleo.cnf:/etc/my.cnf.d/tripleo.cnf:ro
121                   - /var/lib/config-data/aodh/etc/aodh/:/etc/aodh/:ro
122                   - /var/log/containers/aodh:/var/log/aodh
123                   - /var/log/containers/httpd/aodh-api:/var/log/httpd
124             command: "/usr/bin/bootstrap_host_exec aodh_api su aodh -s /bin/bash -c /usr/bin/aodh-dbsync"
125         step_4:
126           aodh_api:
127             image: *aodh_api_image
128             net: host
129             privileged: false
130             restart: always
131             volumes:
132               list_concat:
133                 - {get_attr: [ContainersCommon, volumes]}
134                 -
135                   - /var/lib/kolla/config_files/aodh_api.json:/var/lib/kolla/config_files/config.json:ro
136                   - /var/lib/config-data/puppet-generated/aodh/:/var/lib/kolla/config_files/src:ro
137                   - /var/log/containers/aodh:/var/log/aodh
138                   - /var/log/containers/httpd/aodh-api:/var/log/httpd
139                   -
140                     if:
141                       - internal_tls_enabled
142                       - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
143                       - ''
144                   -
145                     if:
146                       - internal_tls_enabled
147                       - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
148                       - ''
149             environment:
150               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
151       host_prep_tasks:
152       - name: create persistent logs directory
153         file:
154           path: "{{ item }}"
155           state: directory
156         with_items:
157           - /var/log/containers/aodh
158           - /var/log/containers/httpd/aodh-api
159       upgrade_tasks:
160         - name: Stop and disable aodh service (running under httpd)
161           tags: step2
162           service: name=httpd state=stopped enabled=no
163       metadata_settings:
164         get_attr: [AodhApiPuppetBase, role_data, metadata_settings]