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