-
Notifications
You must be signed in to change notification settings - Fork 0
/
heat.yaml
136 lines (120 loc) · 4.87 KB
/
heat.yaml
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
heat_template_version: 2016-04-08
description: 'NeCTAR Template for creating a DIT4C containers protected by SSH.'
parameters:
InstanceSize:
type: string
label: Instance Size
description: Size of the instance to be created.
default: m2.small
constraints:
- allowed_values: [m2.xsmall, m2.small, m2.medium]
ImageID:
type: string
label: Image ID
description: ID of the CoreOS image to use for the instance to be created
default: ab138a79-551b-4f27-a298-80b8857d3a2d
AvailabilityZone:
type: string
description: The NeCTAR zone in which the VM is to run
default: melbourne-qh2-uom
constraints:
- allowed_values: [melbourne-qh2-uom, melbourne, monash, sa, qld, NCI, tasmania]
NgrokRegion:
type: string
description: ngrok.com region to connect to
default: au
constraints:
- allowed_values: [ap, au, eu, us]
ContainerImage:
type: string
description: The Docker container image to use
default: "docker://dit4c/dit4c-container-ipython"
constraints:
- allowed_values: ["docker://dit4c/dit4c-container-ipython", "docker://dit4c/dit4c-container-nltk", "docker://dit4c/dit4c-container-rstudio", "docker://dit4c/dit4c-container-zeppelin"]
ContainerPort:
type: number
description: The HTTP port container services run on
default: 8080
PasswordSecret:
type: string
label: Password
description: "Password to access container (warning: plain text!)"
constraints:
- allowed_pattern: "[a-zA-Z0-9]+"
description: Password can only use alphanumeric characters
NotifyUrl:
type: string
label: Notify URL
description: URL to notify with POST (eg. https://dweet.io/dweet/for/my-pet-vm-name)
KeyName:
type: string
label: Key Name
description:
SSH key to use for access
constraints:
- length: { min: 1 }
resources:
ComputeNodeInstance:
type: OS::Nova::Server
properties:
availability_zone: { get_param: AvailabilityZone }
image: { get_param: ImageID }
flavor: { get_param: InstanceSize }
key_name: { get_param: KeyName }
user_data_format: RAW
config_drive: "true"
user_data:
str_replace:
template: |
#cloud-config
coreos:
update:
reboot-strategy: "off"
units:
- name: run-dit4c-container.service
command: start
enable: yes
content: |
[Unit]
Description=Setup DIT4C container
After=docker.service
[Service]
Type=simple
ExecStart=/bin/bash -c 'rkt run --dns 8.8.8.8 --insecure-options image https://github.com/dit4c/ngrok2-relay/releases/download/v0.1.0/ngrok2-relay.linux.amd64.aci --set-env TARGET_HOST=127.54.32.1 --set-env TARGET_PORT=8001 --set-env NGROK_REGION=$ngrokRegion --set-env NOTIFY_URL=$notifyUrl -- --- https://github.com/dit4c/password-reverse-proxy/releases/download/v0.2.1/password-reverse-proxy.linux.amd64.aci --set-env LISTEN_HOST=127.54.32.1 --set-env LISTEN_PORT=8001 --set-env UPSTREAM_HOST=127.0.0.1 --set-env UPSTREAM_PORT=$containerPort --set-env PASSWORD_SECRET=$passwordSecret -- --- $containerImage'
- name: serial-getty@ttyS0.service
command: start
enable: yes
content: |
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Journal to /dev/%I
BindsTo=dev-%i.device
After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service
[Service]
ExecStart=/bin/sh -c "exec /bin/journalctl -af > /dev/%I"
Type=idle
Restart=always
UtmpIdentifier=%I
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
KillMode=process
IgnoreSIGPIPE=no
SendSIGHUP=yes
[Install]
WantedBy=getty.target
params:
$containerImage: { get_param: ContainerImage }
$containerPort: { get_param: ContainerPort }
$ngrokRegion: { get_param: NgrokRegion }
$notifyUrl: { get_param: NotifyUrl }
$passwordSecret: { get_param: PasswordSecret }
outputs:
InstanceIP:
description: IP address of the newly created compute node.
value: { get_attr: [ComputeNodeInstance, first_address] }