Replace outdated instruction with link to upstream doc
[apex-tripleo-heat-templates.git] / docker / services / ec2-api.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized EC2 API service
5
6 parameters:
7   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerEc2ApiImage:
12     description: image
13     default: 'centos-binary-ec2-api:latest'
14     type: string
15   DockerEc2ApiConfigImage:
16     description: The container image to use for the ec2_api config_volume
17     default: 'centos-binary-ec2-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   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   Ec2ApiPuppetBase:
48       type: ../../puppet/services/ec2-api.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 EC2 API role.
59     value:
60       service_name: {get_attr: [Ec2ApiPuppetBase, role_data, service_name]}
61       config_settings: {get_attr: [Ec2ApiPuppetBase, role_data, config_settings]}
62       step_config: &step_config
63         get_attr: [Ec2ApiPuppetBase, role_data, step_config]
64       service_config_settings: {get_attr: [Ec2ApiPuppetBase, role_data, service_config_settings]}
65       # BEGIN DOCKER SETTINGS
66       puppet_config:
67         config_volume: ec2_api
68         puppet_tags: ec2api_api_paste_ini,ec2api_config
69         step_config: *step_config
70         config_image:
71           list_join:
72             - '/'
73             - [ {get_param: DockerNamespace}, {get_param: DockerEc2ApiConfigImage} ]
74       kolla_config:
75         /var/lib/kolla/config_files/ec2_api.json:
76           command: /usr/bin/ec2-api
77           permissions:
78             - path: /var/log/ec2api
79               owner: ec2api:ec2api
80               recurse: true
81         /var/lib/kolla/config_files/ec2_api_metadata.json:
82           command: /usr/bin/ec2-api-metadata
83           permissions:
84             - path: /var/log/ec2api # default log dir for metadata service as well
85               owner: ec2api:ec2api
86               recurse: true
87       docker_config:
88         # db sync runs before permissions set by kolla_config
89         step_2:
90           ec2_api_init_logs:
91             image: &ec2_api_image
92               list_join:
93                 - '/'
94                 - [ {get_param: DockerNamespace}, {get_param: DockerEc2ApiImage} ]
95             privileged: false
96             user: root
97             volumes:
98               - /var/log/containers/ec2_api:/var/log/ec2api
99               # mount ec2_api_metadata to "ec2api-metadata" only here to fix
100               # permissions of both directories in one go
101               - /var/log/containers/ec2_api_metadata:/var/log/ec2api-metadata
102             command: ['/bin/bash', '-c', 'chown -R ec2api:ec2api /var/log/ec2api /var/log/ec2api-metadata']
103         step_3:
104           ec2_api_db_sync:
105             image: *ec2_api_image
106             net: host
107             detach: false
108             privileged: false
109             user: root
110             volumes:
111               list_concat:
112                 - {get_attr: [ContainersCommon, volumes]}
113                 -
114                   - /var/lib/config-data/ec2_api/etc/ec2api/:/etc/ec2api/:ro
115                   - /var/log/containers/ec2_api:/var/log/ec2api
116             command: "/usr/bin/bootstrap_host_exec ec2_api su ec2api -s /bin/bash -c '/usr/bin/ec2-api-manage db_sync'"
117         step_4:
118           ec2_api:
119             image: *ec2_api_image
120             net: host
121             privileged: false
122             restart: always
123             volumes:
124               list_concat:
125                 - {get_attr: [ContainersCommon, volumes]}
126                 -
127                   - /var/lib/kolla/config_files/ec2_api.json:/var/lib/kolla/config_files/config.json:ro
128                   - /var/lib/config-data/ec2_api/etc/ec2api/:/etc/ec2api/:ro
129                   - /var/log/containers/ec2_api:/var/log/ec2api
130             environment:
131               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
132           ec2_api_metadata:
133             image: *ec2_api_image
134             net: host
135             privileged: false
136             restart: always
137             volumes:
138               list_concat:
139                 - {get_attr: [ContainersCommon, volumes]}
140                 -
141                   - /var/lib/kolla/config_files/ec2_api_metadata.json:/var/lib/kolla/config_files/config.json:ro
142                   - /var/lib/config-data/ec2_api/etc/ec2api/:/etc/ec2api/:ro
143                   - /var/log/containers/ec2_api_metadata:/var/log/ec2api
144             environment:
145               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
146       host_prep_tasks:
147         - name: create persistent log directories
148           file:
149             path: /var/log/containers/{{ item }}
150             state: directory
151           with_items:
152             - ec2_api
153             - ec2_api_metadata
154       upgrade_tasks:
155         - name: Stop and disable EC2-API services
156           tags: step2
157           service: name={{ item }} state=stopped enabled=no
158           with_items:
159             - openstack-ec2-api
160             - openstack-ec2-api-metadata