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