Skip to content

Commit

Permalink
Merge pull request #141 from cybozu-go/fix-example
Browse files Browse the repository at this point in the history
Fix example
  • Loading branch information
ysksuzuki authored Mar 18, 2021
2 parents a264625 + b7ef254 commit 89b270f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
10 changes: 5 additions & 5 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ is as follows:
To run the example, launch `placemat` by the following command:

```console
$ sudo placemat cluster.example.yml
$ sudo placemat2 cluster.example.yml
```

The cluster configuration is described in [`cluster.example.yml`](cluster.example.yml).
Expand All @@ -38,15 +38,15 @@ It downloads boot images, and then starts [dnsmasq][] and [nginx][] on Ubuntu
to work as a network boot server.

The worker nodes run Qemu's default BIOS to boot from the network. They load
[iPXE][] provided by the boot node, and then load [CoreOS Container Linux][].
[iPXE][] provided by the boot node, and then load [Flatcar Container Linux][].
They are configured with empty disks, which will be seen as `/dev/vda`.

You can log-in to the `boot` node by `ubuntu`/`ubuntu`. As for the worker
nodes, they are configured to accept auto login from the console.

```console
$ sudo pmctl node enter boot # login with ubuntu/ubuntu
$ sudo pmctl node enter worker-1 # autologin as "core" user
$ sudo pmctl2 node enter boot # login with ubuntu/ubuntu
$ sudo pmctl2 node enter worker-1 # autologin as "core" user

# type Ctrl-q and Ctrl-x to leave from the node console
```
Expand All @@ -56,4 +56,4 @@ $ sudo pmctl node enter worker-1 # autologin as "core" user
[nginx]: https://nginx.org/
[UEFI HTTP Boot]: https://github.com/tianocore/tianocore.github.io/wiki/HTTP-Boot
[iPXE]: https://ipxe.org/
[CoreOS Container Linux]: https://coreos.com/os/docs/latest/
[Flatcar Container Linux]: https://kinvolk.io/docs/flatcar-container-linux/latest/
6 changes: 6 additions & 0 deletions examples/cluster.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ type: external
use-nat: true
address: 172.16.0.1/24
---
kind: Network
name: bmc
type: bmc
use-nat: false
address: 172.16.1.1/24
---
kind: Image
name: ubuntu-image
url: https://cloud-images.ubuntu.com/releases/20.04/release/ubuntu-20.04-server-cloudimg-amd64.img
Expand Down
12 changes: 9 additions & 3 deletions examples/user-data.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,20 @@ write_files:
"networkd": {"units": [{"name": "00-eth0.network", "contents": "[Match]\nName=eth0\n\n[Network]\nAddress=172.16.0.102"}]}
}
- path: /etc/resolv.conf
content: |
nameserver 8.8.8.8
runcmd:
- [ curl, -sSL, -o, /var/lib/dnsmasq/ipxe.efi, "http://boot.ipxe.org/ipxe.efi"]
- [ curl, -sSL, -o, /var/www/html/coreos_production_pxe.vmlinuz, "https://stable.release.core-os.net/amd64-usr/current/coreos_production_pxe.vmlinuz"]
- [ curl, -sSL, -o, /var/www/html/coreos_production_pxe_image.cpio.gz, "https://stable.release.core-os.net/amd64-usr/current/coreos_production_pxe_image.cpio.gz"]
- [ systemctl, stop, systemd-resolved.service ]
- [ systemctl, disable, systemd-resolved.service ]
- [ systemctl, enable, dnsmasq.service ]
- [ systemctl, start, dnsmasq.service ]
- [ systemctl, enable, nginx.service ]
- [ systemctl, start, nginx.service ]
- [ curl, -sSL, -o, /var/lib/dnsmasq/ipxe.efi, "http://boot.ipxe.org/ipxe.efi" ]
- [ curl, -sSL, -o, /var/www/html/coreos_production_pxe.vmlinuz, "https://stable.release.flatcar-linux.net/amd64-usr/2605.12.0/flatcar_production_pxe.vmlinuz" ]
- [ curl, -sSL, -o, /var/www/html/coreos_production_pxe_image.cpio.gz, "https://stable.release.flatcar-linux.net/amd64-usr/2605.12.0/flatcar_production_pxe_image.cpio.gz" ]

packages:
- dnsmasq
Expand Down
2 changes: 1 addition & 1 deletion v2/cmd/placemat2/sub/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func run(yamls []string) error {

if config.cacheDir == "" {
if os.Getenv("SUDO_USER") != "" {
config.cacheDir = "/home/${SUDO_USER}/placemat_data"
config.cacheDir = os.ExpandEnv("/home/${SUDO_USER}/placemat_data")
} else {
config.cacheDir = config.dataDir
}
Expand Down

0 comments on commit 89b270f

Please sign in to comment.