Merge "Use a single configuration file for specifying docker containers."
[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   PankoApiPuppetBase:
55     type: ../../puppet/services/panko-api.yaml
56     properties:
57       EndpointMap: {get_param: EndpointMap}
58       ServiceData: {get_param: ServiceData}
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 Panko API role.
67     value:
68       service_name: {get_attr: [PankoApiPuppetBase, role_data, service_name]}
69       config_settings:
70         map_merge:
71           - get_attr: [PankoApiPuppetBase, role_data, config_settings]
72           - apache::default_vhost: false
73       step_config: &step_config
74         get_attr: [PankoApiPuppetBase, role_data, step_config]
75       service_config_settings: {get_attr: [PankoApiPuppetBase, role_data, service_config_settings]}
76       # BEGIN DOCKER SETTINGS #
77       puppet_config:
78         config_volume: panko
79         puppet_tags: panko_api_paste_ini,panko_config
80         step_config: *step_config
81         config_image: {get_param: DockerPankoConfigImage}
82       kolla_config:
83         /var/lib/kolla/config_files/panko_api.json:
84           command: /usr/sbin/httpd -DFOREGROUND
85           config_files:
86             - source: "/var/lib/kolla/config_files/src/*"
87               dest: "/"
88               merge: true
89               preserve_properties: true
90           permissions:
91             - path: /var/log/panko
92               owner: panko:panko
93               recurse: true
94       docker_config:
95         step_2:
96           panko_init_log:
97             image: &panko_api_image {get_param: DockerPankoApiImage}
98             user: root
99             volumes:
100               - /var/log/containers/panko:/var/log/panko
101             command: ['/bin/bash', '-c', 'mkdir -p /var/log/httpd; chown -R panko:panko /var/log/panko']
102         step_3:
103           panko_db_sync:
104             image: *panko_api_image
105             net: host
106             detach: false
107             privileged: false
108             user: root
109             volumes:
110               list_concat:
111                 - {get_attr: [ContainersCommon, volumes]}
112                 -
113                   - /var/lib/config-data/panko/etc/panko:/etc/panko:ro
114                   - /var/log/containers/panko:/var/log/panko
115             command: "/usr/bin/bootstrap_host_exec panko_api su panko -s /bin/bash -c '/usr/bin/panko-dbsync'"
116         step_4:
117           panko_api:
118             start_order: 2
119             image: *panko_api_image
120             net: host
121             privileged: false
122             restart: always
123             volumes:
124               list_concat:
125                 - {get_attr: [ContainersCommon, volumes]}
126                 -
127                   - /var/lib/kolla/config_files/panko_api.json:/var/lib/kolla/config_files/config.json:ro
128                   - /var/lib/config-data/puppet-generated/panko/:/var/lib/kolla/config_files/src:ro
129                   - /var/log/containers/panko:/var/log/panko
130                   -
131                     if:
132                       - internal_tls_enabled
133                       - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
134                       - ''
135                   -
136                     if:
137                       - internal_tls_enabled
138                       - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
139                       - ''
140             environment:
141               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
142       host_prep_tasks:
143         - name: create persistent logs directory
144           file:
145             path: /var/log/containers/panko
146             state: directory
147       metadata_settings:
148         get_attr: [PankoApiPuppetBase, role_data, metadata_settings]