From e3b5a525b50367c761d909cd7749270fd970be04 Mon Sep 17 00:00:00 2001 From: Hongbin Lu Date: Sat, 8 Jun 2019 22:17:56 +0000 Subject: [PATCH] Add example for running Zun container Change-Id: Ic08fa9c2918243296bd72bf05ca43dfade4b24f9 --- hot/zun/webapp.yaml | 61 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 hot/zun/webapp.yaml diff --git a/hot/zun/webapp.yaml b/hot/zun/webapp.yaml new file mode 100644 index 00000000..8d107aa1 --- /dev/null +++ b/hot/zun/webapp.yaml @@ -0,0 +1,61 @@ +heat_template_version: rocky + +parameters: + external_network: + type: string + default: public + tenant_network: + type: string + default: private + +resources: + secgroup: + type: OS::Neutron::SecurityGroup + properties: + name: sg_wordpress + description: wordpress security group + rules: + - protocol: icmp + - protocol: tcp + port_range_min: 80 + port_range_max: 80 + - protocol: tcp + port_range_min: 3306 + port_range_max: 3306 + db: + type: OS::Zun::Container + properties: + image: mysql:5.7 + environment: + MYSQL_ROOT_PASSWORD: rootpass + MYSQL_DATABASE: wordpress + security_groups: + - {get_resource: secgroup} + networks: + - network: {get_param: tenant_network} + wordpress: + type: OS::Zun::Container + properties: + image: "wordpress:latest" + environment: + WORDPRESS_DB_HOST: {get_attr: [db, addresses, {get_param: tenant_network}, 0, addr]} + WORDPRESS_DB_USER: root + WORDPRESS_DB_PASSWORD: rootpass + security_groups: + - {get_resource: secgroup} + networks: + - network: {get_param: tenant_network} + floating_ip: + type: OS::Neutron::FloatingIP + properties: + floating_network: {get_param: external_network} + association: + type: OS::Neutron::FloatingIPAssociation + properties: + floatingip_id: {get_resource: floating_ip} + port_id: {get_attr: [wordpress, addresses, {get_param: tenant_network}, 0, port]} + +outputs: + url: + value: {get_attr: [floating_ip, floating_ip_address]} + description: The web server url