ea1fd768c185f91ff836ce3cecd4f245e38be3c1
[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   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerZaqarImage:
12     description: image
13     default: 'centos-binary-zaqar:latest'
14     type: string
15   DockerZaqarConfigImage:
16     description: The container image to use for the zaqar config_volume
17     default: 'centos-binary-zaqar: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   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
42 resources:
43
44   ContainersCommon:
45     type: ./containers-common.yaml
46
47   ZaqarBase:
48     type: ../../puppet/services/zaqar.yaml
49     properties:
50       EndpointMap: {get_param: EndpointMap}
51       ServiceNetMap: {get_param: ServiceNetMap}
52       DefaultPasswords: {get_param: DefaultPasswords}
53       RoleName: {get_param: RoleName}
54       RoleParameters: {get_param: RoleParameters}
55
56 outputs:
57   role_data:
58     description: Role data for the Zaqar API role.
59     value:
60       service_name: {get_attr: [ZaqarBase, role_data, service_name]}
61       config_settings: {get_attr: [ZaqarBase, role_data, config_settings]}
62       step_config: &step_config
63        get_attr: [ZaqarBase, role_data, step_config]
64       service_config_settings: {get_attr: [ZaqarBase, role_data, service_config_settings]}
65       # BEGIN DOCKER SETTINGS
66       puppet_config:
67         config_volume: zaqar
68         puppet_tags: zaqar_config
69         step_config: *step_config
70         config_image:
71           list_join:
72             - '/'
73             - [ {get_param: DockerNamespace}, {get_param: DockerZaqarConfigImage} ]
74       kolla_config:
75         /var/lib/kolla/config_files/zaqar.json:
76           command: /usr/sbin/httpd -DFOREGROUND
77           config_files:
78             - source: "/var/lib/kolla/config_files/src/*"
79               dest: "/"
80               merge: true
81               preserve_properties: true
82         /var/lib/kolla/config_files/zaqar_websocket.json:
83           command: /usr/bin/zaqar-server --config-file /etc/zaqar/zaqar.conf --config-file /etc/zaqar/1.conf
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/zaqar
91               owner: zaqar:zaqar
92               recurse: true
93       docker_config:
94         step_4:
95           zaqar:
96             image: &zaqar_image
97               list_join:
98                 - '/'
99                 - [ {get_param: DockerNamespace}, {get_param: DockerZaqarImage} ]
100             net: host
101             privileged: false
102             restart: always
103             # NOTE(mandre) kolla image changes the user to 'zaqar', we need it
104             # to be root to run httpd
105             user: root
106             volumes:
107               list_concat:
108                 - {get_attr: [ContainersCommon, volumes]}
109                 -
110                   - /var/lib/kolla/config_files/zaqar.json:/var/lib/kolla/config_files/config.json:ro
111                   - /var/lib/config-data/puppet-generated/zaqar/:/var/lib/kolla/config_files/src:ro
112                   - /var/log/containers/zaqar:/var/log/zaqar
113             environment:
114               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
115           zaqar_websocket:
116             image: *zaqar_image
117             net: host
118             privileged: false
119             restart: always
120             volumes:
121               list_concat:
122                 - {get_attr: [ContainersCommon, volumes]}
123                 -
124                   - /var/lib/kolla/config_files/zaqar_websocket.json:/var/lib/kolla/config_files/config.json:ro
125                   - /var/lib/config-data/puppet-generated/zaqar/:/var/lib/kolla/config_files/src:ro
126                   - /var/log/containers/zaqar:/var/log/zaqar
127             environment:
128               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
129       host_prep_tasks:
130         - name: create persistent logs directory
131           file:
132             path: /var/log/containers/zaqar
133             state: directory
134       upgrade_tasks:
135         - name: Stop and disable zaqar service
136           tags: step2
137           service: name=httpd state=stopped enabled=no