docker: add logging(source & groups)
[apex-tripleo-heat-templates.git] / docker / services / panko-api.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack Panko service configured with docker.
5   Note, this service is deprecated in Pike release and
6   will be disabled in future releases.
7
8 parameters:
9   DockerPankoApiImage:
10     description: image
11     type: string
12   DockerPankoConfigImage:
13     description: The container image to use for the panko config_volume
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   ServiceData:
21     default: {}
22     description: Dictionary packing service data
23     type: json
24   ServiceNetMap:
25     default: {}
26     description: Mapping of service_name -> network name. Typically set
27                  via parameter_defaults in the resource registry.  This
28                  mapping overrides those in ServiceNetMapDefaults.
29     type: json
30   DefaultPasswords:
31     default: {}
32     type: json
33   RoleName:
34     default: ''
35     description: Role name on which the service is applied
36     type: string
37   RoleParameters:
38     default: {}
39     description: Parameters specific to the role
40     type: json
41   EnableInternalTLS:
42     type: boolean
43     default: false
44
45 conditions:
46
47   internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
48
49 resources:
50
51   ContainersCommon:
52     type: ./containers-common.yaml
53
54   MySQLClient:
55     type: ../../puppet/services/database/mysql-client.yaml
56
57   PankoApiPuppetBase:
58     type: ../../puppet/services/panko-api.yaml
59     properties:
60       EndpointMap: {get_param: EndpointMap}
61       ServiceData: {get_param: ServiceData}
62       ServiceNetMap: {get_param: ServiceNetMap}
63       DefaultPasswords: {get_param: DefaultPasswords}
64       RoleName: {get_param: RoleName}
65       RoleParameters: {get_param: RoleParameters}
66
67 outputs:
68   role_data:
69     description: Role data for the Panko API role.
70     value:
71       service_name: {get_attr: [PankoApiPuppetBase, role_data, service_name]}
72       config_settings:
73         map_merge:
74           - get_attr: [PankoApiPuppetBase, role_data, config_settings]
75           - apache::default_vhost: false
76       logging_source: {get_attr: [PankoApiPuppetBase, role_data, logging_source]}
77       logging_groups: {get_attr: [PankoApiPuppetBase, role_data, logging_groups]}
78       step_config: &step_config
79         list_join:
80           - "\n"
81           - - {get_attr: [PankoApiPuppetBase, role_data, step_config]}
82             - {get_attr: [MySQLClient, role_data, step_config]}
83       service_config_settings: {get_attr: [PankoApiPuppetBase, role_data, service_config_settings]}
84       # BEGIN DOCKER SETTINGS #
85       puppet_config:
86         config_volume: panko
87         puppet_tags: panko_api_paste_ini,panko_config
88         step_config: *step_config
89         config_image: {get_param: DockerPankoConfigImage}
90       kolla_config:
91         /var/lib/kolla/config_files/panko_api.json:
92           command: /usr/sbin/httpd -DFOREGROUND
93           config_files:
94             - source: "/var/lib/kolla/config_files/src/*"
95               dest: "/"
96               merge: true
97               preserve_properties: true
98           permissions:
99             - path: /var/log/panko
100               owner: panko:panko
101               recurse: true
102       docker_config:
103         step_2:
104           panko_init_log:
105             image: &panko_api_image {get_param: DockerPankoApiImage}
106             user: root
107             volumes:
108               - /var/log/containers/panko:/var/log/panko
109               - /var/log/containers/httpd/panko-api:/var/log/httpd
110             command: ['/bin/bash', '-c', 'chown -R panko:panko /var/log/panko']
111         step_3:
112           panko_db_sync:
113             image: *panko_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/panko/etc/my.cnf.d/tripleo.cnf:/etc/my.cnf.d/tripleo.cnf:ro
123                   - /var/lib/config-data/panko/etc/panko:/etc/panko:ro
124                   - /var/log/containers/panko:/var/log/panko
125                   - /var/log/containers/httpd/panko-api:/var/log/httpd
126             command: "/usr/bin/bootstrap_host_exec panko_api su panko -s /bin/bash -c '/usr/bin/panko-dbsync'"
127         step_4:
128           panko_api:
129             start_order: 2
130             image: *panko_api_image
131             net: host
132             privileged: false
133             restart: always
134             volumes:
135               list_concat:
136                 - {get_attr: [ContainersCommon, volumes]}
137                 -
138                   - /var/lib/kolla/config_files/panko_api.json:/var/lib/kolla/config_files/config.json:ro
139                   - /var/lib/config-data/puppet-generated/panko/:/var/lib/kolla/config_files/src:ro
140                   - /var/log/containers/panko:/var/log/panko
141                   - /var/log/containers/httpd/panko-api:/var/log/httpd
142                   -
143                     if:
144                       - internal_tls_enabled
145                       - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
146                       - ''
147                   -
148                     if:
149                       - internal_tls_enabled
150                       - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
151                       - ''
152             environment:
153               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
154       host_prep_tasks:
155         - name: create persistent logs directory
156           file:
157             path: "{{ item }}"
158             state: directory
159           with_items:
160             - /var/log/containers/panko
161             - /var/log/containers/httpd/panko-api
162       metadata_settings:
163         get_attr: [PankoApiPuppetBase, role_data, metadata_settings]