aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: 4af503e7ff626a73183523f37293450a27a02aba (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# OpenBSD Packer Template

This repository contains a template for:
- Building OpenBSD boxes for QEMU using Packer (`openbsd-image/`).
- Creating an OpenBSD snapshot in Hetzner for starting up new servers in Hetzner
  using that OpenBSD image you just created (`hcloud-snapshot/`).

## Building an OpenBSD Image 

First, ensure you have QEMU installed:

```sh
brew install qemu
```

Then, you can build the box with the following:

```sh
./build-openbsd-image.sh
```

If you have a custom disk layout you want, you can pass in a disklabel template.
e.g.

```sh
./build-openbsd-image.sh --disklabel-template ./openbsd-image/disk-layouts/cgit.disklabel
```

## Creating a Hetzner Snapshot from your OpenBSD Image

Once you've built your image, you can now create a Hetzner snapshot for that
image. Hetzner doesn't support OpenBSD out of the box, so this allows you to
spin up new servers on demand using your snapshot of this OpenBSD image.

To get started, you'll need to:

1. Create an SSH key within Hetzner's Console
2. Create an API key you can use within Hetzner's Console

Then:

```sh
export HCLOUD_TOKEN="xxxx-xxxx-xxxx"
./build-hcloud-snapshot.sh --ssh-key <your-name-you-gave-your-ssh-key>
```