-
Notifications
You must be signed in to change notification settings - Fork 18
/
docker-stack.yml
106 lines (93 loc) · 2.77 KB
/
docker-stack.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
heat_template_version: 2013-05-23
description: >
Dockerize a multi-node application with OpenStack Heat.
This template defines two docker containers running
apache with php and mysql database.
parameters:
key:
type: string
description: >
Name of a KeyPair to enable SSH access to the instance. Note that the
default user is ec2-user.
default: key1
flavor:
type: string
description: Instance type for the docker server.
default: m1.medium
image:
type: string
description: >
Name or ID of the image to use for the Docker server. This needs to be
built with os-collect-config tools from a fedora base image.
default: fedora-software-config
public_net:
type: string
description: name of public network for which floating IP addresses will be allocated.
default: nova
resources:
configuration:
type: OS::Heat::SoftwareConfig
properties:
group: script
config: |
#!/bin/bash -v
setenforce 0
yum -y install docker-io
cp /usr/lib/systemd/system/docker.service /etc/systemd/system/
sed -i -e '/ExecStart/ { s,fd://,tcp://0.0.0.0:2375, }' /etc/systemd/system/docker.service
systemctl start docker.service
docker -H :2375 pull marouen/mysql
docker -H :2375 pull marouen/apache
deployment:
type: OS::Heat::SoftwareDeployment
properties:
config: {get_resource: configuration}
server: {get_resource: docker_server}
docker_server:
type: OS::Nova::Server
properties:
key_name: {get_param: key}
image: { get_param: image }
flavor: { get_param: flavor}
user_data_format: SOFTWARE_CONFIG
server_floating_ip:
type: OS::Nova::FloatingIP
properties:
pool: { get_param: public_net}
associate_floating_ip:
type: OS::Nova::FloatingIPAssociation
properties:
floating_ip: { get_resource: server_floating_ip}
server_id: { get_resource: docker_server}
mysql:
type: DockerInc::Docker::Container
depends_on: [deployment]
properties:
image: marouen/mysql
port_specs:
- 3306
docker_endpoint:
str_replace:
template: http://host:2375
params:
host: {get_attr: [docker_server, networks, private, 0]}
apache:
type: DockerInc::Docker::Container
depends_on: [mysql]
properties:
image: marouen/apache
port_specs:
- 80
docker_endpoint:
str_replace:
template: http://host:2375
params:
host: {get_attr: [docker_server, networks, private, 0]}
outputs:
url:
description: Public address of apache
value:
str_replace:
template: http://host
params:
host: {get_attr: [docker_server, networks, private, 0]}