| 1 |
heat_template_version: 2015-10-15 |
| 2 |
|
| 3 |
description: | |
| 4 |
Simplest web-app using netcat reporting only hostname. |
| 5 |
Specifically tailored for minimal Cirros image. |
| 6 |
|
| 7 |
parameters: |
| 8 |
|
| 9 |
app_port: |
| 10 |
type: number |
| 11 |
|
| 12 |
wc_curl_cli: |
| 13 |
type: string |
| 14 |
|
| 15 |
resources: |
| 16 |
|
| 17 |
webapp_nc: |
| 18 |
type: OS::Heat::SoftwareConfig |
| 19 |
properties: |
| 20 |
group: ungrouped |
| 21 |
config: |
| 22 |
str_replace: |
| 23 |
template: | |
| 24 |
#! /bin/sh -v |
| 25 |
Body=$(hostname) |
| 26 |
Response="HTTP/1.1 200 OK\r\nContent-Length: ${#Body}\r\n\r\n$Body" |
| 27 |
while true; do |
| 28 |
wc_notify --data-binary '{"status": "SUCCESS"}' |
| 29 |
if [ $? -eq 0 ]; then |
| 30 |
break |
| 31 |
fi |
| 32 |
sleep 10 |
| 33 |
done |
| 34 |
while true ; do |
| 35 |
echo -e $Response | nc -llp PORT |
| 36 |
done |
| 37 |
params: |
| 38 |
PORT: { get_param: app_port } |
| 39 |
wc_notify: { get_param: wc_curl_cli } |
| 40 |
|
| 41 |
outputs: |
| 42 |
OS::stack_id: |
| 43 |
value: { get_resource: webapp_nc } |