Merge "Introduce common resources for docker templates"
[apex-tripleo-heat-templates.git] / docker / services / gnocchi-api.yaml
1 heat_template_version: ocata
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
30 resources:
31
32   ContainersCommon:
33     type: ./containers-common.yaml
34
35   GnocchiApiPuppetBase:
36       type: ../../puppet/services/gnocchi-api.yaml
37       properties:
38         EndpointMap: {get_param: EndpointMap}
39         ServiceNetMap: {get_param: ServiceNetMap}
40         DefaultPasswords: {get_param: DefaultPasswords}
41
42 outputs:
43   role_data:
44     description: Role data for the gnocchi API role.
45     value:
46       service_name: {get_attr: [GnocchiApiPuppetBase, role_data, service_name]}
47       config_settings:
48         map_merge:
49           - get_attr: [GnocchiApiPuppetBase, role_data, config_settings]
50           - apache::default_vhost: false
51       step_config: &step_config
52         get_attr: [GnocchiApiPuppetBase, role_data, step_config]
53       service_config_settings: {get_attr: [GnocchiApiPuppetBase, role_data, service_config_settings]}
54       # BEGIN DOCKER SETTINGS
55       puppet_config:
56         config_volume: gnocchi
57         puppet_tags: gnocchi_api_paste_ini,gnocchi_config
58         step_config: *step_config
59         config_image: &gnocchi_image
60           list_join:
61             - '/'
62             - [ {get_param: DockerNamespace}, {get_param: DockerGnocchiApiImage} ]
63       kolla_config:
64         /var/lib/kolla/config_files/gnocchi-api.json:
65           command: /usr/sbin/httpd -DFOREGROUND
66       docker_config:
67         step_3:
68           gnocchi_init_log:
69             start_order: 0
70             image: *gnocchi_image
71             user: root
72             command: ['/bin/bash', '-c', 'mkdir -p /var/log/httpd && mkdir -p /var/log/gnocchi && chown gnocchi:gnocchi /var/log/gnocchi']
73             volumes:
74               - logs:/var/log
75           gnocchi_db_sync:
76             start_order: 1
77             image: *gnocchi_image
78             net: host
79             detach: false
80             privileged: false
81             volumes:
82               yaql:
83                 expression: $.data.common.concat($.data.service)
84                 data:
85                   common: {get_attr: [ContainersCommon, volumes]}
86                   service:
87                     - /var/lib/config-data/gnocchi/etc/gnocchi/:/etc/gnocchi/:ro
88                     - logs:/var/log
89             command: ["/usr/bin/gnocchi-upgrade", "--skip-storage"]
90         step_4:
91           gnocchi_api:
92             image: *gnocchi_image
93             net: host
94             privileged: false
95             restart: always
96             volumes:
97               yaql:
98                 expression: $.data.common.concat($.data.service)
99                 data:
100                   common: {get_attr: [ContainersCommon, volumes]}
101                   service:
102                     - /var/lib/kolla/config_files/gnocchi-api.json:/var/lib/kolla/config_files/config.json:ro
103                     - /var/lib/config-data/gnocchi/etc/gnocchi/:/etc/gnocchi/:ro
104                     - /var/lib/config-data/gnocchi/etc/httpd/:/etc/httpd/:ro
105                     - /var/lib/config-data/gnocchi/var/www/:/var/www/:ro
106             environment:
107               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
108       upgrade_tasks:
109         - name: Stop and disable httpd service
110           tags: step2
111           service: name=httpd state=stopped enabled=no