Merge pull request #2715 from rn/packet

examples: Update packet.net examples
This commit is contained in:
Justin Cormack 2017-11-13 22:48:05 +01:00 committed by GitHub
commit c6696145b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 9 deletions

View File

@ -29,6 +29,11 @@ device ID on subsequent `linuxkit run` invocations to re-use an
existing machine. These subsequent runs will update the iPXE data so existing machine. These subsequent runs will update the iPXE data so
you can boot alternative kernels on an existing machine. you can boot alternative kernels on an existing machine.
There is an example YAML file for [x86_64](../examples/packet.yml) and
an additional YAML for [arm64](../examples/packet.arm64.yml) servers
which provide both access to the serial console and via ssh and
configures bonding for network devices via metadata (if supported).
**Note**: The update of the iPXE configuration sometimes may take some **Note**: The update of the iPXE configuration sometimes may take some
time and the first boot may fail. Hitting return on the console to time and the first boot may fail. Hitting return on the console to
retry the boot typically fixes this. retry the boot typically fixes this.
@ -46,22 +51,31 @@ If you don't have a public HTTP server at hand, you can use the
be run on another Packet machine or be made accessible with tools be run on another Packet machine or be made accessible with tools
like [ngrok](https://ngrok.com/). like [ngrok](https://ngrok.com/).
For example, to boot the toplevel [linuxkit.yml](../linuxkit.yml) For example, to boot the [example](../examples/packet.net)
example with a local HTTP server: with a local HTTP server:
```sh ```sh
moby build linuxkit.yml moby build packet.yml
# run the web server # run the web server
# run 'ngrok http 8080' in another window # run 'ngrok http 8080' in another window
PACKET_API_KEY=<API key> linuxkit run packet -serve :8080 -base-url http://9b828514.ngrok.io -project-id <Project ID> linuxkit PACKET_API_KEY=<API key> PACKET_PROJECT_ID=<Project ID> \
linuxkit run packet -serve :8080 -base-url <ngrok url> packet
``` ```
To boot a `arm64` kernel on a Type 2a machine (`-machine To boot a `arm64` image for Type 2a machine (`-machine
baremetal_2a`) you currently need to un-compress both the kernel and baremetal_2a`) you currently need build using `moby build packet.yml packet.arm64.yml` and then un-compress both the kernel and
the initrd before booting, e.g: the initrd before booting, e.g:
```sh
mv packet-initrd.img packet-initrd.img.gz && gzip -d packet-initrd.img.gz
mv packet-kernel packet-kernel.gz && gzip -d packet-kernel.gz
``` ```
mv linuxkit-initrd.img linuxkit-initrd.img.gz && gzip -d linuxkit-initrd.img.gz
mv linuxkit-kernel.img linuxkit-kernel.img.gz && gzip -d linuxkit-kernel.img.gz The LinuxKit image can then be booted with:
```sh
PACKET_API_KEY=<API key> PACKET_PROJECT_ID=<Project ID> \
linuxkit run packet -machine baremetal_2a -serve :8080 -base-url -base-url <ngrok url> packet
``` ```
**Note**: It may take several minutes to deploy a new server. If you **Note**: It may take several minutes to deploy a new server. If you

View File

@ -0,0 +1,4 @@
onboot:
- name: modprobe
image: linuxkit/modprobe:2d153653d1111877a8f53704ef85063a44182ade
command: ["modprobe", "nicvf"]

View File

@ -1,6 +1,6 @@
kernel: kernel:
image: linuxkit/kernel:4.9.61 image: linuxkit/kernel:4.9.61
cmdline: "console=ttyS1" cmdline: "console=ttyS1 console=ttyAMA0"
init: init:
- linuxkit/init:42a92119e1ca10380e0d33e26c0cbcf85b9b3558 - linuxkit/init:42a92119e1ca10380e0d33e26c0cbcf85b9b3558
- linuxkit/runc:817fdc592eac6cb7804fa1721a43a7f6e23fb50f - linuxkit/runc:817fdc592eac6cb7804fa1721a43a7f6e23fb50f
@ -21,6 +21,10 @@ onboot:
services: services:
- name: rngd - name: rngd
image: linuxkit/rngd:842e5e8ece7934f0cab9fd0027b595ff3471e5b9 image: linuxkit/rngd:842e5e8ece7934f0cab9fd0027b595ff3471e5b9
- name: getty
image: linuxkit/getty:6af22c32c98536a79230eef000e9abd06b037faa
env:
- INSECURE=true
- name: sshd - name: sshd
image: linuxkit/sshd:b7f21ef1b13300a994e35eac3644e4f84f0ada8a image: linuxkit/sshd:b7f21ef1b13300a994e35eac3644e4f84f0ada8a
trust: trust: