Merge "Only mount selinux sysfs in nova_libvirt container" into stable/pike
[apex-tripleo-heat-templates.git] / docker / services / gnocchi-api.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized gnocchi service
5
6 parameters:
7   DockerGnocchiApiImage:
8     description: image
9     type: string
10   DockerGnocchiConfigImage:
11     description: The container image to use for the gnocchi 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   NumberOfStorageSacks:
43     default: 128
44     description: Number of storage sacks to create.
45     type: number
46
47 conditions:
48
49   internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
50
51 resources:
52
53   ContainersCommon:
54     type: ./containers-common.yaml
55
56   GnocchiApiPuppetBase:
57       type: ../../puppet/services/gnocchi-api.yaml
58       properties:
59         EndpointMap: {get_param: EndpointMap}
60         ServiceNetMap: {get_param: ServiceNetMap}
61         DefaultPasswords: {get_param: DefaultPasswords}
62         RoleName: {get_param: RoleName}
63         RoleParameters: {get_param: RoleParameters}
64
65 outputs:
66   role_data:
67     description: Role data for the gnocchi API role.
68     value:
69       service_name: {get_attr: [GnocchiApiPuppetBase, role_data, service_name]}
70       config_settings:
71         map_merge:
72           - get_attr: [GnocchiApiPuppetBase, role_data, config_settings]
73           - apache::default_vhost: false
74       logging_source: {get_attr: [GnocchiApiPuppetBase, role_data, logging_source]}
75       logging_groups: {get_attr: [GnocchiApiPuppetBase, role_data, logging_groups]}
76       step_config: &step_config
77         get_attr: [GnocchiApiPuppetBase, role_data, step_config]
78       service_config_settings: {get_attr: [GnocchiApiPuppetBase, role_data, service_config_settings]}
79       # BEGIN DOCKER SETTINGS
80       puppet_config:
81         config_volume: gnocchi
82         puppet_tags: gnocchi_api_paste_ini,gnocchi_config
83         step_config: *step_config
84         config_image: {get_param: DockerGnocchiConfigImage}
85       kolla_config:
86         /var/lib/kolla/config_files/gnocchi_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             - source: "/var/lib/kolla/config_files/src-ceph/"
94               dest: "/etc/ceph/"
95               merge: true
96               preserve_properties: true
97           permissions:
98             - path: /var/log/gnocchi
99               owner: gnocchi:gnocchi
100               recurse: true
101       docker_config:
102         # db sync runs before permissions set by kolla_config
103         step_2:
104           gnocchi_init_log:
105             image: &gnocchi_api_image {get_param: DockerGnocchiApiImage}
106             user: root
107             volumes:
108               - /var/log/containers/gnocchi:/var/log/gnocchi
109               - /var/log/containers/httpd/gnocchi-api:/var/log/httpd
110             command: ['/bin/bash', '-c', 'chown -R gnocchi:gnocchi /var/log/gnocchi']
111         step_4:
112           gnocchi_db_sync:
113             image: *gnocchi_api_image
114             net: host
115             detach: false
116             privileged: false
117             user: root
118             volumes:
119               list_concat:
120                 - {get_attr: [ContainersCommon, volumes]}
121                 -
122                   - /var/lib/config-data/gnocchi/etc/my.cnf.d/tripleo.cnf:/etc/my.cnf.d/tripleo.cnf:ro
123                   - /var/lib/config-data/gnocchi/etc/gnocchi/:/etc/gnocchi/:ro
124                   - /var/log/containers/gnocchi:/var/log/gnocchi
125                   - /var/log/containers/httpd/gnocchi-api:/var/log/httpd
126                   - /etc/ceph:/etc/ceph:ro
127             command:
128               str_replace:
129                 template: /usr/bin/bootstrap_host_exec gnocchi_api su gnocchi -s /bin/bash -c '/usr/bin/gnocchi-upgrade --sacks-number=SACK_NUM'
130                 params:
131                   SACK_NUM: {get_param: NumberOfStorageSacks}
132         step_5:
133           gnocchi_api:
134             image: *gnocchi_api_image
135             net: host
136             privileged: false
137             restart: always
138             volumes:
139               list_concat:
140                 - {get_attr: [ContainersCommon, volumes]}
141                 -
142                   - /var/lib/kolla/config_files/gnocchi_api.json:/var/lib/kolla/config_files/config.json:ro
143                   - /var/lib/config-data/puppet-generated/gnocchi/:/var/lib/kolla/config_files/src:ro
144                   - /var/log/containers/gnocchi:/var/log/gnocchi
145                   - /var/log/containers/httpd/gnocchi-api:/var/log/httpd
146                   - /etc/ceph:/var/lib/kolla/config_files/src-ceph:ro
147                   -
148                     if:
149                       - internal_tls_enabled
150                       - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
151                       - ''
152                   -
153                     if:
154                       - internal_tls_enabled
155                       - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
156                       - ''
157             environment:
158               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
159       host_prep_tasks:
160         - name: create persistent logs directory
161           file:
162             path: "{{ item }}"
163             state: directory
164           with_items:
165             - /var/log/containers/gnocchi
166             - /var/log/containers/httpd/gnocchi-api
167         - name: ensure ceph configurations exist
168           file:
169             path: /etc/ceph
170             state: directory
171       upgrade_tasks:
172         - name: Stop and disable httpd service
173           tags: step2
174           service: name=httpd state=stopped enabled=no
175       metadata_settings:
176         get_attr: [GnocchiApiPuppetBase, role_data, metadata_settings]