diff --git a/prepare-vms/README.md b/prepare-vms/README.md index 7de3534c..46f364b5 100644 --- a/prepare-vms/README.md +++ b/prepare-vms/README.md @@ -36,6 +36,14 @@ The Docker Compose file here is used to build a image with all the dependencies - `AWS_SECRET_ACCESS_KEY` - `AWS_DEFAULT_REGION` +If you're not using AWS, set these to placeholder values: + +``` +export AWS_ACCESS_KEY_ID="foo" +export AWS_SECRET_ACCESS_KEY="foo" +export AWS_DEFAULT_REGION="foo" +``` + ### Update/copy `settings/example.yaml` Then pass `settings/YOUR_WORKSHOP_NAME-settings.yaml` as an argument to `./workshopctl deploy`, `./workshopctl cards`, etc. @@ -76,7 +84,7 @@ test Run tests (pre-flight checks) on a batch of VMs - During `start` it will add your default local SSH key to all instances under the `ubuntu` user. - During `deploy` it will create the `docker` user with password `training`, which is printing on the cards for students. For now, this is hard coded. -### Example Steps to Launch a Batch of Instances for a Workshop +### Example Steps to Launch a Batch of AWS Instances for a Workshop - Run `./workshopctl start N` Creates `N` EC2 instances - Your local SSH key will be synced to instances under `ubuntu` user @@ -89,6 +97,20 @@ test Run tests (pre-flight checks) on a batch of VMs - *Have a great workshop* - Run `./workshopctl stop TAG` to terminate instances. +### Example Steps to Configure Instances from another source + +- Launch instances from another source. +- Set placeholder values for AWS settings. +- Choose a tag. It could be the event name, datestamp, etc. +- Create a file with the IPs to be configured + - The file should be named `prepare-vms/tags//ips.txt` + - Format is one IP per line, no other info needed. +- Ensure the settings file is current: `prepare-vms/settings/kube101.yaml` +- For a tag called `test`, configure instances: `workshopctl deploy test settings/kube101.yaml` +- Optionally, configure Kubernetes clusters of the size in the settings: `workshopctl kube test` +- Generate `test` cards to print and hand out: `workshopctl cards test settings/kube101.yaml` +- Print the cards file: prepare-vms/tags/test/ips.html + ## Other Tools ### Deploying your SSH key to all the machines @@ -143,6 +165,8 @@ The `postprep.rc` file will be copied via parallel-ssh to all of the VMs and exe $ ./workshopctl cards TAG settings/somefile.yaml +If you want to generate both HTML and PDF cards, install [wkhtmltopdf](https://wkhtmltopdf.org/downloads.html); without that installed, only HTML cards will be generated. + #### List tags $ ./workshopctl list diff --git a/prepare-vms/lib/commands.sh b/prepare-vms/lib/commands.sh index c5dd969e..bcabd102 100644 --- a/prepare-vms/lib/commands.sh +++ b/prepare-vms/lib/commands.sh @@ -39,7 +39,10 @@ _cmd_cards() { need_tag $TAG need_settings $SETTINGS - aws_get_instance_ips_by_tag $TAG >tags/$TAG/ips.txt + # If you're not using AWS, populate the ips.txt file manually + if [ ! -f tags/$TAG/ips.txt ]; then + aws_get_instance_ips_by_tag $TAG >tags/$TAG/ips.txt + fi # Remove symlinks to old cards rm -f ips.html ips.pdf diff --git a/prepare-vms/settings/example.yaml b/prepare-vms/settings/example.yaml new file mode 100644 index 00000000..a71b14bf --- /dev/null +++ b/prepare-vms/settings/example.yaml @@ -0,0 +1,24 @@ +# customize your cluster size, your cards template, and the versions + +# Number of VMs per cluster +clustersize: 5 + +# Jinja2 template to use to generate ready-to-cut cards +cards_template: cards.html + +# Use "Letter" in the US, and "A4" everywhere else +paper_size: Letter + +# Feel free to reduce this if your printer can handle it +paper_margin: 0.2in + +# Note: paper_size and paper_margin only apply to PDF generated with pdfkit. +# If you print (or generate a PDF) using ips.html, they will be ignored. +# (The equivalent parameters must be set from the browser's print dialog.) + +# This can be "test" or "stable" +engine_version: test + +# These correspond to the version numbers visible on their respective GitHub release pages +compose_version: 1.18.0 +machine_version: 0.13.0 diff --git a/prepare-vms/settings/kube101.html b/prepare-vms/settings/kube101.html new file mode 100644 index 00000000..947821b4 --- /dev/null +++ b/prepare-vms/settings/kube101.html @@ -0,0 +1,106 @@ +{# Feel free to customize or override anything in there! #} +{%- set url = "http://container.training/" -%} +{%- set pagesize = 12 -%} +{%- if clustersize == 1 -%} + {%- set workshop_name = "Docker workshop" -%} + {%- set cluster_or_machine = "machine" -%} + {%- set this_or_each = "this" -%} + {%- set machine_is_or_machines_are = "machine is" -%} + {%- set image_src = "https://s3-us-west-2.amazonaws.com/www.breadware.com/integrations/docker.png" -%} +{%- else -%} + {%- set workshop_name = "Kubernetes workshop" -%} + {%- set cluster_or_machine = "cluster" -%} + {%- set this_or_each = "each" -%} + {%- set machine_is_or_machines_are = "machines are" -%} + {%- set image_src_swarm = "https://cdn.wp.nginx.com/wp-content/uploads/2016/07/docker-swarm-hero2.png" -%} + {%- set image_src_kube = "https://avatars1.githubusercontent.com/u/13629408" -%} + {%- set image_src = image_src_kube -%} +{%- endif -%} + + + + +{% for cluster in clusters %} + {% if loop.index0>0 and loop.index0%pagesize==0 %} + + {% endif %} +
+ +

+ Here is the connection information to your very own + {{ cluster_or_machine }} for this {{ workshop_name }}. + You can connect to {{ this_or_each }} VM with any SSH client. +

+

+ + + + + + +
login:
docker
password:
training
+ +

+

+ Your {{ machine_is_or_machines_are }}: + + {% for node in cluster %} + + {% endfor %} +
node{{ loop.index }}:{{ node }}
+

+

You can find the slides at: +

{{ url }}
+

+
+{% endfor %} + + diff --git a/prepare-vms/settings/kube101.yaml b/prepare-vms/settings/kube101.yaml new file mode 100644 index 00000000..06a9413a --- /dev/null +++ b/prepare-vms/settings/kube101.yaml @@ -0,0 +1,24 @@ +# 3 nodes for k8s 101 workshops + +# Number of VMs per cluster +clustersize: 3 + +# Jinja2 template to use to generate ready-to-cut cards +cards_template: settings/kube101.html + +# Use "Letter" in the US, and "A4" everywhere else +paper_size: Letter + +# Feel free to reduce this if your printer can handle it +paper_margin: 0.2in + +# Note: paper_size and paper_margin only apply to PDF generated with pdfkit. +# If you print (or generate a PDF) using ips.html, they will be ignored. +# (The equivalent parameters must be set from the browser's print dialog.) + +# This can be "test" or "stable" +engine_version: test + +# These correspond to the version numbers visible on their respective GitHub release pages +compose_version: 1.18.0 +machine_version: 0.13.0