heat_template_version: 2013-05-23 description: This template deploys a Flasky single instance server with a SQLite database. parameters: image: type: string label: Image name or ID description: Image to be used for the server. Please use an Ubuntu based image. default: trusty-server-cloudimg-amd64 flavor: type: string label: Flavor description: Type of instance (flavor) to be used on the compute instance. default: m1.small key: type: string label: Key name description: Name of key-pair to be installed on the compute instance. default: my_key public_network: type: string label: Public network name or ID description: Public network with floating IP addresses. default: public-net gmail_username: type: string label: Gmail account username description: Username of the Gmail account to use for notifications. gmail_password: type: string label: Gmail account password description: Password of the Gmail account to use for notifications. hidden: true resources: flask_secret_key: type: OS::Heat::RandomString properties: length: 32 sequence: lettersdigits web_server_security_group: type: OS::Neutron::SecurityGroup properties: name: web_server_security_group rules: - protocol: icmp - protocol: tcp port_range_min: 22 port_range_max: 22 - protocol: tcp port_range_min: 443 port_range_max: 443 - protocol: tcp port_range_min: 80 port_range_max: 80 private_network: type: OS::Neutron::Net private_subnet: type: OS::Neutron::Subnet properties: network_id: { get_resource: private_network } cidr: 10.10.10.0/24 dns_nameservers: - 8.8.8.8 router: type: OS::Neutron::Router properties: external_gateway_info: network: { get_param: public_network } router-interface: type: OS::Neutron::RouterInterface properties: router_id: { get_resource: router } subnet: { get_resource: private_subnet } flasky_port: type: OS::Neutron::Port properties: network: { get_resource: private_network } security_groups: - { get_resource: web_server_security_group } flasky_instance: type: OS::Nova::Server properties: image: { get_param: image } flavor: { get_param: flavor } key_name: { get_param: key } networks: - port: { get_resource: flasky_port } user_data_format: RAW user_data: str_replace: params: __flask_secret_key__: { get_attr: [flask_secret_key, value] } __gmail_username__: { get_param: gmail_username } __gmail_password__: { get_param: gmail_password } template: | #!/bin/bash -ex # install dependencies apt-get update apt-get -y install build-essential python python-dev python-virtualenv nginx supervisor git # create a flasky user to run the server process adduser --disabled-password --gecos "" flasky # clone flasky from github cd /home/flasky git clone https://github.com/miguelgrinberg/flasky.git cd flasky # Write configuration file cat >.env </etc/supervisor/conf.d/flasky.conf </etc/nginx/sites-available/flasky <