b6b4e4b16c350c71c95f71f686d69e3032ed7c17
[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   EndpointMap:
14     default: {}
15     description: Mapping of service endpoint -> protocol. Typically set
16                  via parameter_defaults in the resource registry.
17     type: json
18   ServiceNetMap:
19     default: {}
20     description: Mapping of service_name -> network name. Typically set
21                  via parameter_defaults in the resource registry.  This
22                  mapping overrides those in ServiceNetMapDefaults.
23     type: json
24   DefaultPasswords:
25     default: {}
26     type: json
27   RoleName:
28     default: ''
29     description: Role name on which the service is applied
30     type: string
31   RoleParameters:
32     default: {}
33     description: Parameters specific to the role
34     type: json
35
36 resources:
37
38   ContainersCommon:
39     type: ./containers-common.yaml
40
41   ZaqarBase:
42     type: ../../puppet/services/zaqar.yaml
43     properties:
44       EndpointMap: {get_param: EndpointMap}
45       ServiceNetMap: {get_param: ServiceNetMap}
46       DefaultPasswords: {get_param: DefaultPasswords}
47       RoleName: {get_param: RoleName}
48       RoleParameters: {get_param: RoleParameters}
49
50 outputs:
51   role_data:
52     description: Role data for the Zaqar API role.
53     value:
54       service_name: {get_attr: [ZaqarBase, role_data, service_name]}
55       config_settings: {get_attr: [ZaqarBase, role_data, config_settings]}
56       step_config: &step_config
57        get_attr: [ZaqarBase, role_data, step_config]
58       service_config_settings: {get_attr: [ZaqarBase, role_data, service_config_settings]}
59       # BEGIN DOCKER SETTINGS
60       puppet_config:
61         config_volume: zaqar
62         puppet_tags: zaqar_config
63         step_config: *step_config
64         config_image: {get_param: DockerZaqarConfigImage}
65       kolla_config:
66         /var/lib/kolla/config_files/zaqar.json:
67           command: /usr/sbin/httpd -DFOREGROUND
68           config_files:
69             - source: "/var/lib/kolla/config_files/src/*"
70               dest: "/"
71               merge: true
72               preserve_properties: true
73         /var/lib/kolla/config_files/zaqar_websocket.json:
74           command: /usr/bin/zaqar-server --config-file /etc/zaqar/zaqar.conf --config-file /etc/zaqar/1.conf
75           config_files:
76             - source: "/var/lib/kolla/config_files/src/*"
77               dest: "/"
78               merge: true
79               preserve_properties: true
80           permissions:
81             - path: /var/log/zaqar
82               owner: zaqar:zaqar
83               recurse: true
84       docker_config:
85         step_4:
86           zaqar:
87             image: &zaqar_image {get_param: DockerZaqarImage}
88             net: host
89             privileged: false
90             restart: always
91             # NOTE(mandre) kolla image changes the user to 'zaqar', we need it
92             # to be root to run httpd
93             user: root
94             volumes:
95               list_concat:
96                 - {get_attr: [ContainersCommon, volumes]}
97                 -
98                   - /var/lib/kolla/config_files/zaqar.json:/var/lib/kolla/config_files/config.json:ro
99                   - /var/lib/config-data/puppet-generated/zaqar/:/var/lib/kolla/config_files/src:ro
100                   - /var/log/containers/zaqar:/var/log/zaqar
101             environment:
102               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
103           zaqar_websocket:
104             image: *zaqar_image
105             net: host
106             privileged: false
107             restart: always
108             volumes:
109               list_concat:
110                 - {get_attr: [ContainersCommon, volumes]}
111                 -
112                   - /var/lib/kolla/config_files/zaqar_websocket.json:/var/lib/kolla/config_files/config.json:ro
113                   - /var/lib/config-data/puppet-generated/zaqar/:/var/lib/kolla/config_files/src:ro
114                   - /var/log/containers/zaqar:/var/log/zaqar
115             environment:
116               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
117       host_prep_tasks:
118         - name: create persistent logs directory
119           file:
120             path: /var/log/containers/zaqar
121             state: directory
122       upgrade_tasks:
123         - name: Stop and disable zaqar service
124           tags: step2
125           service: name=httpd state=stopped enabled=no