Merge "Adds network/cidr mapping into a new service property"
[apex-tripleo-heat-templates.git] / docker / services / mistral-api.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Mistral API service
5
6 parameters:
7   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerMistralApiImage:
12     description: image
13     default: 'centos-binary-mistral-api:latest'
14     type: string
15   DockerMistralConfigImage:
16     description: The container image to use for the mistral config_volume
17     default: 'centos-binary-mistral-api:latest'
18     type: string
19   EndpointMap:
20     default: {}
21     description: Mapping of service endpoint -> protocol. Typically set
22                  via parameter_defaults in the resource registry.
23     type: json
24   ServiceData:
25     default: {}
26     description: Dictionary packing service data
27     type: json
28   ServiceNetMap:
29     default: {}
30     description: Mapping of service_name -> network name. Typically set
31                  via parameter_defaults in the resource registry.  This
32                  mapping overrides those in ServiceNetMapDefaults.
33     type: json
34   DefaultPasswords:
35     default: {}
36     type: json
37   RoleName:
38     default: ''
39     description: Role name on which the service is applied
40     type: string
41   RoleParameters:
42     default: {}
43     description: Parameters specific to the role
44     type: json
45
46 resources:
47
48   ContainersCommon:
49     type: ./containers-common.yaml
50
51   MistralApiBase:
52     type: ../../puppet/services/mistral-api.yaml
53     properties:
54       EndpointMap: {get_param: EndpointMap}
55       ServiceData: {get_param: ServiceData}
56       ServiceNetMap: {get_param: ServiceNetMap}
57       DefaultPasswords: {get_param: DefaultPasswords}
58       RoleName: {get_param: RoleName}
59       RoleParameters: {get_param: RoleParameters}
60
61 outputs:
62   role_data:
63     description: Role data for the Mistral API role.
64     value:
65       service_name: {get_attr: [MistralApiBase, role_data, service_name]}
66       config_settings:
67         map_merge:
68           - get_attr: [MistralApiBase, role_data, config_settings]
69       step_config: &step_config
70         get_attr: [MistralApiBase, role_data, step_config]
71       service_config_settings: {get_attr: [MistralApiBase, role_data, service_config_settings]}
72       # BEGIN DOCKER SETTINGS
73       puppet_config:
74         config_volume: mistral
75         puppet_tags: mistral_config
76         step_config: *step_config
77         config_image:
78           list_join:
79             - '/'
80             - [ {get_param: DockerNamespace}, {get_param: DockerMistralConfigImage} ]
81       kolla_config:
82         /var/lib/kolla/config_files/mistral_api.json:
83           command: /usr/bin/mistral-server --config-file=/etc/mistral/mistral.conf --log-file=/var/log/mistral/api.log --server=api
84           config_files:
85             - source: "/var/lib/kolla/config_files/src/*"
86               dest: "/"
87               merge: true
88               preserve_properties: true
89           permissions:
90             - path: /var/log/mistral
91               owner: mistral:mistral
92               recurse: true
93       docker_config:
94         # db sync runs before permissions set by kolla_config
95         step_2:
96           mistral_init_logs:
97             image: &mistral_api_image
98               list_join:
99                 - '/'
100                 - [ {get_param: DockerNamespace}, {get_param: DockerMistralApiImage} ]
101             privileged: false
102             user: root
103             volumes:
104               - /var/log/containers/mistral:/var/log/mistral
105             command: ['/bin/bash', '-c', 'chown -R mistral:mistral /var/log/mistral']
106         step_3:
107           mistral_db_sync:
108             start_order: 0
109             image: *mistral_api_image
110             net: host
111             privileged: false
112             detach: false
113             user: root
114             volumes:
115               list_concat:
116                 - {get_attr: [ContainersCommon, volumes]}
117                 -
118                   - /var/lib/config-data/mistral/etc/mistral/:/etc/mistral/:ro
119                   - /var/log/containers/mistral:/var/log/mistral
120             command: "/usr/bin/bootstrap_host_exec mistral_api su mistral -s /bin/bash -c 'mistral-db-manage --config-file /etc/mistral/mistral.conf upgrade head'"
121           mistral_db_populate:
122             start_order: 1
123             image: *mistral_api_image
124             net: host
125             privileged: false
126             detach: false
127             user: root
128             volumes:
129               list_concat:
130                 - {get_attr: [ContainersCommon, volumes]}
131                 -
132                   - /var/lib/config-data/mistral/etc/mistral/:/etc/mistral/:ro
133                   - /var/log/containers/mistral:/var/log/mistral
134             # NOTE: dprince this requires that we install openstack-tripleo-common into
135             # the Mistral API image so that we get tripleo* actions
136             command: "/usr/bin/bootstrap_host_exec mistral_api su mistral -s /bin/bash -c 'mistral-db-manage --config-file /etc/mistral/mistral.conf populate'"
137         step_4:
138           mistral_api:
139             start_order: 15
140             image: *mistral_api_image
141             net: host
142             privileged: false
143             restart: always
144             volumes:
145               list_concat:
146                 - {get_attr: [ContainersCommon, volumes]}
147                 -
148                   - /var/lib/kolla/config_files/mistral_api.json:/var/lib/kolla/config_files/config.json:ro
149                   - /var/lib/config-data/puppet-generated/mistral/:/var/lib/kolla/config_files/src:ro
150                   - /var/log/containers/mistral:/var/log/mistral
151             environment:
152               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
153       host_prep_tasks:
154         - name: create persistent logs directory
155           file:
156             path: /var/log/containers/mistral
157             state: directory
158       upgrade_tasks:
159         - name: Stop and disable mistral_api service
160           tags: step2
161           service: name=openstack-mistral-api state=stopped enabled=no