Merge "Configuration for containerized MySQL clients"
[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   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerGnocchiApiImage:
12     description: image
13     default: 'centos-binary-gnocchi-api: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   EnableInternalTLS:
38     type: boolean
39     default: false
40
41 conditions:
42
43   internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
44
45 resources:
46
47   ContainersCommon:
48     type: ./containers-common.yaml
49
50   GnocchiApiPuppetBase:
51       type: ../../puppet/services/gnocchi-api.yaml
52       properties:
53         EndpointMap: {get_param: EndpointMap}
54         ServiceNetMap: {get_param: ServiceNetMap}
55         DefaultPasswords: {get_param: DefaultPasswords}
56         RoleName: {get_param: RoleName}
57         RoleParameters: {get_param: RoleParameters}
58
59 outputs:
60   role_data:
61     description: Role data for the gnocchi API role.
62     value:
63       service_name: {get_attr: [GnocchiApiPuppetBase, role_data, service_name]}
64       config_settings:
65         map_merge:
66           - get_attr: [GnocchiApiPuppetBase, role_data, config_settings]
67           - apache::default_vhost: false
68       step_config: &step_config
69         get_attr: [GnocchiApiPuppetBase, role_data, step_config]
70       service_config_settings: {get_attr: [GnocchiApiPuppetBase, role_data, service_config_settings]}
71       # BEGIN DOCKER SETTINGS
72       puppet_config:
73         config_volume: gnocchi
74         puppet_tags: gnocchi_api_paste_ini,gnocchi_config
75         step_config: *step_config
76         config_image: &gnocchi_image
77           list_join:
78             - '/'
79             - [ {get_param: DockerNamespace}, {get_param: DockerGnocchiApiImage} ]
80       kolla_config:
81         /var/lib/kolla/config_files/gnocchi_api.json:
82           command: /usr/sbin/httpd -DFOREGROUND
83           permissions:
84             - path: /var/log/gnocchi
85               owner: gnocchi:gnocchi
86               recurse: true
87       docker_config:
88         # db sync runs before permissions set by kolla_config
89         step_2:
90           gnocchi_init_log:
91             image: *gnocchi_image
92             user: root
93             volumes:
94               - /var/log/containers/gnocchi:/var/log/gnocchi
95             command: ['/bin/bash', '-c', 'mkdir -p /var/log/httpd; chown -R gnocchi:gnocchi /var/log/gnocchi']
96         step_3:
97           gnocchi_db_sync:
98             image: *gnocchi_image
99             net: host
100             detach: false
101             privileged: false
102             user: root
103             volumes:
104               list_concat:
105                 - {get_attr: [ContainersCommon, volumes]}
106                 -
107                   - /var/lib/config-data/gnocchi/etc/gnocchi/:/etc/gnocchi/:ro
108                   - /var/log/containers/gnocchi:/var/log/gnocchi
109             command: "/usr/bin/bootstrap_host_exec gnocchi_api su gnocchi -s /bin/bash -c '/usr/bin/gnocchi-upgrade --skip-storage'"
110         step_4:
111           gnocchi_api:
112             image: *gnocchi_image
113             net: host
114             privileged: false
115             restart: always
116             volumes:
117               list_concat:
118                 - {get_attr: [ContainersCommon, volumes]}
119                 -
120                   - /var/lib/kolla/config_files/gnocchi_api.json:/var/lib/kolla/config_files/config.json:ro
121                   - /var/lib/config-data/gnocchi/etc/gnocchi/:/etc/gnocchi/:ro
122                   - /var/lib/config-data/gnocchi/etc/httpd/conf/:/etc/httpd/conf/:ro
123                   - /var/lib/config-data/gnocchi/etc/httpd/conf.d/:/etc/httpd/conf.d/:ro
124                   - /var/lib/config-data/gnocchi/etc/httpd/conf.modules.d/:/etc/httpd/conf.modules.d/:ro
125                   - /var/lib/config-data/gnocchi/var/www/:/var/www/:ro
126                   - /var/log/containers/gnocchi:/var/log/gnocchi
127                   -
128                     if:
129                       - internal_tls_enabled
130                       - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
131                       - ''
132                   -
133                     if:
134                       - internal_tls_enabled
135                       - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
136                       - ''
137             environment:
138               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
139       host_prep_tasks:
140         - name: create persistent logs directory
141           file:
142             path: /var/log/containers/gnocchi
143             state: directory
144       upgrade_tasks:
145         - name: Stop and disable httpd service
146           tags: step2
147           service: name=httpd state=stopped enabled=no
148       metadata_settings:
149         get_attr: [GnocchiApiPuppetBase, role_data, metadata_settings]