docker: add logging(source & groups)
[apex-tripleo-heat-templates.git] / docker / services / barbican-api.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Barbican API service
5
6 parameters:
7   DockerBarbicanApiImage:
8     description: image
9     type: string
10   DockerBarbicanConfigImage:
11     description: The container image to use for the barbican 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
43 conditions:
44
45   internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
46
47 resources:
48
49   ContainersCommon:
50     type: ./containers-common.yaml
51
52   MySQLClient:
53     type: ../../puppet/services/database/mysql-client.yaml
54
55   BarbicanApiBase:
56     type: ../../puppet/services/barbican-api.yaml
57     properties:
58       EndpointMap: {get_param: EndpointMap}
59       ServiceData: {get_param: ServiceData}
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 Barbican API role.
68     value:
69       service_name: {get_attr: [BarbicanApiBase, role_data, service_name]}
70       config_settings:
71         map_merge:
72           - get_attr: [BarbicanApiBase, role_data, config_settings]
73           - apache::default_vhost: false
74       logging_source: {get_attr: [BarbicanApiBase, role_data, logging_source]}
75       logging_groups: {get_attr: [BarbicanApiBase, role_data, logging_groups]}
76       step_config: &step_config
77         list_join:
78           - "\n"
79           - - {get_attr: [BarbicanApiBase, role_data, step_config]}
80             - {get_attr: [MySQLClient, role_data, step_config]}
81       service_config_settings: {get_attr: [BarbicanApiBase, role_data, service_config_settings]}
82       # BEGIN DOCKER SETTINGS
83       puppet_config:
84         config_volume: barbican
85         puppet_tags: barbican_api_paste_ini,barbican_config
86         step_config: *step_config
87         config_image: {get_param: DockerBarbicanConfigImage}
88       kolla_config:
89         /var/lib/kolla/config_files/barbican_api.json:
90           command: /usr/sbin/httpd -DFOREGROUND
91           config_files:
92             - source: "/var/lib/kolla/config_files/src/*"
93               dest: "/"
94               merge: true
95               preserve_properties: true
96       docker_config:
97         # db sync runs before permissions set by kolla_config
98         step_2:
99           barbican_init_logs:
100             image: &barbican_api_image {get_param: DockerBarbicanApiImage}
101             privileged: false
102             user: root
103             volumes:
104               - /var/log/containers/barbican:/var/log/barbican
105             command: ['/bin/bash', '-c', 'chown -R barbican:barbican /var/log/barbican']
106         step_3:
107           barbican_api_db_sync:
108             start_order: 0
109             image: *barbican_api_image
110             net: host
111             detach: false
112             user: root
113             volumes: &barbican_api_volumes
114               list_concat:
115                 - {get_attr: [ContainersCommon, volumes]}
116                 -
117                   - /var/lib/config-data/barbican/etc/barbican/:/etc/barbican/:ro
118                   - /var/log/containers/barbican:/var/log/barbican
119             command: "/usr/bin/bootstrap_host_exec barbican_api su barbican -s /bin/bash -c '/usr/bin/barbican-manage db upgrade'"
120         step_4:
121           barbican_api:
122             image: *barbican_api_image
123             net: host
124             privileged: false
125             restart: always
126             user: root
127             volumes:
128               list_concat:
129                 - {get_attr: [ContainersCommon, volumes]}
130                 -
131                   - /var/lib/kolla/config_files/barbican_api.json:/var/lib/kolla/config_files/config.json:ro
132                   - /var/log/containers/barbican:/var/log/barbican
133                   - /var/lib/config-data/puppet-generated/barbican/:/var/lib/kolla/config_files/src:ro
134                   -
135                     if:
136                       - internal_tls_enabled
137                       - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
138                       - ''
139                   -
140                     if:
141                       - internal_tls_enabled
142                       - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
143                       - ''
144             environment:
145               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
146       host_prep_tasks:
147         - name: create persistent logs directory
148           file:
149             path: /var/log/containers/barbican
150             state: directory
151       upgrade_tasks:
152         - name: Stop and disable barbican_api service
153           tags: step2
154           service: name=openstack-barbican-api state=stopped enabled=no
155       metadata_settings:
156         get_attr: [BarbicanApiBase, role_data, metadata_settings]