Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Commit

Permalink
docs update
Browse files Browse the repository at this point in the history
Signed-off-by: David Chung <[email protected]>
  • Loading branch information
David Chung committed May 9, 2017
1 parent a0a6f73 commit 4d4cfc0
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 15 deletions.
5 changes: 4 additions & 1 deletion docs/playbooks/linuxkit/examples/sshd/build-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{{ $defaultKeyDir := cat (env `HOME`) `/.ssh` | nospace }}

{{ $keyDir := flag "ssh-dir" "string" "Directory of ssh keys" | prompt "SSH key dir?" "string" $defaultKeyDir }}
{{ $keyFile := flag "key-name" "string" "Key name" | prompt "Which public key to include?" "string" "id_rsa" }}
{{ $keyFile := flag "key-name" "string" "Key name" | prompt "Which public key to include?" "string" "id_rsa.pub" }}

{{ $output := `sshd.yml` }}

Expand All @@ -23,3 +23,6 @@ EOF
echo "Generated config file. Running moby."

moby build {{$output}}

{{ $bundle := `sshd` }}
echo "Checksum:"{{ file (cat $bundle "-initrd.img" | nospace) | sha256sum }}
6 changes: 6 additions & 0 deletions docs/playbooks/linuxkit/examples/sshd/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ run-instance : provision-instance.ikt

# Manage a group of nodes
scale-group : scale-group.ikt

# List instances
list-instances : list-instances.sh

# Inspect global state
inspect : inspect.sh
3 changes: 3 additions & 0 deletions docs/playbooks/linuxkit/examples/sshd/inspect.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{/* =% sh %= */}}

infrakit manager inspect -y
3 changes: 3 additions & 0 deletions docs/playbooks/linuxkit/examples/sshd/list-instances.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{/* =% sh %= */}}

infrakit instance --name instance-hyperkit describe
5 changes: 4 additions & 1 deletion docs/playbooks/linuxkit/examples/sshd/provision-instance.ikt
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
{{ $memory := flag "memory" "int" "Memory in MB" | prompt "How many mb for memory?" "int" 1024 }}
{{ $disk := flag "disk" "int" "Disk in MB" | prompt "How many mb for disk?" "int" 100 }}

{{ $checksum := file (cat $linuxkitPath "/" $bundle "-initrd.img" | nospace) | sha256sum }}

LogicalID: {{ $privateIP }}
Tags:
infrakit.created: {{ now | htmlDate }}
infrakit.project: {{ $project }}
infrakit.checksum: {{ include (cat $linuxkitPath "/" $bundle "-initrd.img" | nospace) | sha256sum }}
infrakit.checksum: {{ $checksum }}

Properties:
kernel: {{ cat $linuxkitPath "/" $bundle "-kernel" | nospace }}
Expand All @@ -23,3 +25,4 @@ Properties:
memory: {{ $memory }}
disk_size: {{ $disk }}
cmdline: {{ include (cat "file://" $linuxkitPath "/" $bundle "-cmdline" | nospace) }}
checksum: {{ $checksum }}
10 changes: 5 additions & 5 deletions docs/playbooks/linuxkit/examples/sshd/scale-group.ikt
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{{/* Input to create a group using the hyperkit instance plugin and manager */}}
<<<<<<< HEAD
{{/* =% managerCommit true false %= */}}
=======
{{/* =% managerCommit true false %= */}}
>>>>>>> a8e9cb894b8d878d79ab036cda9bb1af9a8cf86f


{{ $groupName := flag "group-name" "string" "Name of group" | prompt "Name of the group?" "string" "mygroup" }}
{{ $size := flag "size" "int" "Size of the group" | prompt "How many nodes?" "int" 2 }}
Expand All @@ -16,6 +13,8 @@
{{ $memory := flag "memory" "int" "Memory in MB" | prompt "How many mb for memory?" "int" 1024 }}
{{ $disk := flag "disk" "int" "Disk in MB" | prompt "How many mb for disk?" "int" 100 }}

{{ $checksum := file (cat $linuxkitPath "/" $bundle "-initrd.img" | nospace) | sha256sum }}

- Plugin: group
Properties:
ID: {{ $groupName }}
Expand All @@ -28,7 +27,7 @@
Tags:
infrakit.created: {{ now | htmlDate }}
infrakit.project: {{ $project }}
infrakit.checksum: {{ include (cat $linuxkitPath "/" $bundle "-initrd.img" | nospace) | sha256sum }}
infrakit.checksum: {{ $checksum }}

Instance:
Plugin: instance-hyperkit
Expand All @@ -39,3 +38,4 @@
memory: {{ $memory }}
disk_size: {{ $disk }}
cmdline: {{ include (cat "file://" $linuxkitPath "/" $bundle "-cmdline" | nospace) }}
checksum: {{ $checksum }}
7 changes: 4 additions & 3 deletions docs/playbooks/linuxkit/examples/sshd/sshd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ files:

outputs:
- format: kernel+initrd
- format: iso-bios
- format: iso-efi
- format: gcp-img

# - format: iso-bios
# - format: iso-efi
# - format: gcp-img
4 changes: 2 additions & 2 deletions docs/playbooks/linuxkit/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ install-moby: install-moby.sh
install-hyperkit : install-hyperkit.sh

# Starts the infrakit daemons using a common data volume for sockets and files
start-infrakit : start-infrakit.sh
start : start-infrakit.sh

# Stops all the infrakit daemons
stop-infrakit : stop-infrakit.sh
stop : stop-infrakit.sh

# Examples
examples : examples/index.yml
23 changes: 20 additions & 3 deletions docs/playbooks/linuxkit/start-infrakit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ docker run -d --name infrakit \
docker run -d --volumes-from infrakit --name time {{ $image }} infrakit-event-time
docker run -d --volumes-from infrakit --name vanilla {{ $image }} infrakit-flavor-vanilla
docker run -d --volumes-from infrakit --name group-stateless {{ $image }} infrakit-group-default \
--name group-stateless --poll-interval 30s
--name group-stateless --poll-interval 10s

# The leader file -- only required for local store
docker run --rm --volumes-from infrakit {{ $image }} /bin/sh -c "echo group > /infrakit/leader"
Expand All @@ -42,7 +42,24 @@ docker run -d --volumes-from infrakit --name manager \
{{ source "start-instance-gcp.sh" }}

echo "Updating hosts file"
{{ $hostsFile := list (env `INFRAKIT_HOME`) `/hosts` | join `` }}
{{ $hosts := include (list `file://` $hostsFile | join ``) | yamlDecode }}
{{ $hostsFile := list (env `INFRAKIT_HOME`) `/hosts` | join `` }}
{{ $hosts := include (list `file://` $hostsFile | join ``) | yamlDecode }}
{{ $_ := set $hosts `localhost` (list `localhost` $port | join `:`) }}
echo "{{ $hosts | yamlEncode }}" > {{ $hostsFile }}

echo "Started hyperkit: {{ var `started-hyperkit` }}"
echo "Started gcp: {{ var `started-gcp` }}"

tracked=``
# Start any tracker of resources
{{ if var `started-hyperkit`}}
tracked="$tracked --instance instance-hyperkit"
{{ end }}
{{ if var `started-gcp`}}
tracked="$tracked --instance instance-gcp"
{{ end }}

if [[ "$tracked" != "" ]]; then
docker run -d --volumes-from infrakit --name tracker \
{{ $image }} infrakit util track --name tracker $tracked
fi
2 changes: 2 additions & 0 deletions docs/playbooks/linuxkit/start-instance-gcp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ docker run -d --volumes-from infrakit --name instance-gcp \
--namespace-tags {{cat "infrakit.scope=" $project | nospace}} \
--zone {{ $zone }} --log 5 --project {{ $project }}

{{ var `started-gcp` true }}

{{ end }}
2 changes: 2 additions & 0 deletions docs/playbooks/linuxkit/start-instance-hyperkit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ echo "This plugin is listening at localhost:24865"

infrakit-instance-hyperkit --log 5 > {{env `INFRAKIT_HOME`}}/logs/instance-hyperkit.log 2>&1 &

{{ var `started-hyperkit` true }}

{{ end }}

0 comments on commit 4d4cfc0

Please sign in to comment.