diff --git a/README.md b/README.md index 0b5efcd..fc1a8b8 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ We therefore wrote a python module called *linux* (take a look at [linux.c](linu Have a look at the [module documentation](https://rawgit.com/Fewbytes/rubber-docker/master/docs/linux/index.html) for more info. ## Quickstart +### On AWS There are currently 3 options to start the workshop by yourself: 1. We created a public AMI with the required configuration and utilities already installed: @@ -34,6 +35,30 @@ There are currently 3 options to start the workshop by yourself: 1. We have a [Vagrantfile](https://www.vagrantup.com/) for you to run using your favorite virtual machine hypervisor (NOTE: not yet fully tested). +### On Azure +We have a [packer template](https://www.packer.io/) so you can create your own +VM on Azure with the following procedure: + +1. Build the image with Packer: + ```bash + $ packer build packer/rubber-docker-azure.json + ``` +1. Create the VM based on the new image: + ```bash + az vm create \ + --resource-group PackerImages \ + --name rubber-docker \ + --location westus2 \ + --image rubberDocker \ + --admin-user ubuntu \ + --generate-ssh-keys + ``` +1. Once the VM is built, you can connect to it with SSH with the username `ubuntu` and + newly created private key: + + ```bash + $ ssh ubuntu@ -i ~/.ssh/ubuntu + ``` The workshop material is checked out at `/workshop` on the instance: - `/workshop/rubber-docker` - this repository, where you do all the work - `/workshop/images` - images for containers, already populated with ubuntu and busybox images diff --git a/packer/rubber-docker-azure.json b/packer/rubber-docker-azure.json new file mode 100644 index 0000000..8660134 --- /dev/null +++ b/packer/rubber-docker-azure.json @@ -0,0 +1,52 @@ +{ + "variables": { + "client_id": "{{env `ARM_CLIENT_ID`}}", + "client_secret": "{{env `ARM_CLIENT_SECRET`}}", + "subscription_id": "{{env `ARM_SUBSCRIPTION_ID`}}" + }, + "builders": [{ + "type": "azure-arm", + + "client_id": "{{user `client_id`}}", + "client_secret": "{{user `client_secret`}}", + "subscription_id": "{{user `subscription_id`}}", + + "os_type": "Linux", + "image_publisher": "Canonical", + "image_offer": "UbuntuServer", + "image_sku": "16.04-LTS", + + "managed_image_resource_group_name": "PackerImages", + "managed_image_name": "rubberDuck", + + "location": "West US 2", + "vm_size": "Standard_DS2_v2" + }], + "provisioners": [{ + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'", + "inline": [ + "adduser --disabled-password --gecos \"\" ubuntu" + ], + "inline_shebang": "/bin/sh -x", + "type": "shell" + }, + { + "type": "file", + "source": "vimrc", + "destination": "/tmp/vimrc" + }, + { + "type": "shell", + "script": "bootstrap.sh" + }, + { + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'", + "inline": [ + "apt-get update", + "apt-get upgrade -y", + "/usr/sbin/waagent -force -deprovision && export HISTSIZE=0 && sync" + ], + "inline_shebang": "/bin/sh -x", + "type": "shell" + }] +}