Make containerized galera use mysql_network everywhere
[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       step_config: &step_config
74         list_join:
75           - "\n"
76           - - {get_attr: [AodhApiPuppetBase, role_data, step_config]}
77             - {get_attr: [MySQLClient, role_data, step_config]}
78       service_config_settings: {get_attr: [AodhApiPuppetBase, role_data, service_config_settings]}
79       # BEGIN DOCKER SETTINGS
80       puppet_config:
81         config_volume: aodh
82         puppet_tags: aodh_api_paste_ini,aodh_config
83         step_config: *step_config
84         config_image: {get_param: DockerAodhConfigImage}
85       kolla_config:
86         /var/lib/kolla/config_files/aodh_api.json:
87           command: /usr/sbin/httpd -DFOREGROUND
88           config_files:
89             - source: "/var/lib/kolla/config_files/src/*"
90               dest: "/"
91               merge: true
92               preserve_properties: true
93           permissions:
94             - path: /var/log/aodh
95               owner: aodh:aodh
96               recurse: true
97       docker_config:
98         # db sync runs before permissions set by kolla_config
99         step_2:
100           aodh_init_log:
101             image: &aodh_api_image {get_param: DockerAodhApiImage}
102             user: root
103             volumes:
104               - /var/log/containers/aodh:/var/log/aodh
105               - /var/log/containers/httpd/aodh-api:/var/log/httpd
106             command: ['/bin/bash', '-c', 'chown -R aodh:aodh /var/log/aodh']
107         step_3:
108           aodh_db_sync:
109             image: *aodh_api_image
110             net: host
111             privileged: false
112             detach: false
113             user: root
114             volumes:
115               list_concat:
116                 - {get_attr: [ContainersCommon, volumes]}
117                 -
118                   - /var/lib/config-data/aodh/etc/my.cnf.d/tripleo.cnf:/etc/my.cnf.d/tripleo.cnf:ro
119                   - /var/lib/config-data/aodh/etc/aodh/:/etc/aodh/:ro
120                   - /var/log/containers/aodh:/var/log/aodh
121                   - /var/log/containers/httpd/aodh-api:/var/log/httpd
122             command: "/usr/bin/bootstrap_host_exec aodh_api su aodh -s /bin/bash -c /usr/bin/aodh-dbsync"
123         step_4:
124           aodh_api:
125             image: *aodh_api_image
126             net: host
127             privileged: false
128             restart: always
129             volumes:
130               list_concat:
131                 - {get_attr: [ContainersCommon, volumes]}
132                 -
133                   - /var/lib/kolla/config_files/aodh_api.json:/var/lib/kolla/config_files/config.json:ro
134                   - /var/lib/config-data/puppet-generated/aodh/:/var/lib/kolla/config_files/src:ro
135                   - /var/log/containers/aodh:/var/log/aodh
136                   - /var/log/containers/httpd/aodh-api:/var/log/httpd
137                   -
138                     if:
139                       - internal_tls_enabled
140                       - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
141                       - ''
142                   -
143                     if:
144                       - internal_tls_enabled
145                       - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
146                       - ''
147             environment:
148               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
149       host_prep_tasks:
150       - name: create persistent logs directory
151         file:
152           path: "{{ item }}"
153           state: directory
154         with_items:
155           - /var/log/containers/aodh
156           - /var/log/containers/httpd/aodh-api
157       upgrade_tasks:
158         - name: Stop and disable aodh service (running under httpd)
159           tags: step2
160           service: name=httpd state=stopped enabled=no
161       metadata_settings:
162         get_attr: [AodhApiPuppetBase, role_data, metadata_settings]