forked from lima-vm/lima
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nomad.yaml
76 lines (73 loc) · 2.94 KB
/
nomad.yaml
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Deploy nomad with containerd
# $ limactl start ./nomad.yaml
# $ limactl shell nomad nomad
#
# See <http://localhost:4646>
#
# More examples can be found at:
# https://github.com/Roblox/nomad-driver-containerd/tree/master/example
# This example requires Lima v0.7.0 or later.
images:
# Try to use release-yyyyMMdd image if available. Note that release-yyyyMMdd will be removed after several months.
- location: "https://cloud-images.ubuntu.com/releases/22.04/release-20230518/ubuntu-22.04-server-cloudimg-amd64.img"
arch: "x86_64"
digest: "sha256:afb820a9260217fd4c5c5aacfbca74aa7cd2418e830dc64ca2e0642b94aab161"
- location: "https://cloud-images.ubuntu.com/releases/22.04/release-20230518/ubuntu-22.04-server-cloudimg-arm64.img"
arch: "aarch64"
digest: "sha256:b47f8be40b5f91c37874817c3324a72cea1982a5fdad031d9b648c9623c3b4e2"
# Fallback to the latest release image.
# Hint: run `limactl prune` to invalidate the cache
- location: "https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-amd64.img"
arch: "x86_64"
- location: "https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-arm64.img"
arch: "aarch64"
# Mounts are disabled in this example, but can be enabled optionally.
mounts: []
containerd:
system: true
user: false
# See https://learn.hashicorp.com/tutorials/nomad/get-started-install
provision:
- mode: system
script: |
#!/bin/sh
command -v nomad >/dev/null 2>&1 && exit 0
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
echo "deb https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
apt-get update
apt-get install -y nomad consul golang-cfssl
sed -e '/^client/a \ \ cni_path = "/usr/local/libexec/cni"\n\ \ cni_config_dir = "/etc/cni/net.d"' -i /etc/nomad.d/nomad.hcl
# install containerd-driver
DRIVER_VERSION=0.9.4
case $(uname -m) in
x86_64)
curl -sSL -o containerd-driver https://github.com/Roblox/nomad-driver-containerd/releases/download/v${DRIVER_VERSION}/containerd-driver
;;
aarch64)
curl -sSL -o containerd-driver https://github.com/Roblox/nomad-driver-containerd/releases/download/v${DRIVER_VERSION}/containerd-driver-arm64
;;
esac
sudo install -D containerd-driver /opt/nomad/data/plugins/containerd-driver
cat <<EOF | sudo tee -a /etc/nomad.d/nomad.hcl
plugin "containerd-driver" {
config {
enabled = true
containerd_runtime = "io.containerd.runc.v2"
stats_interval = "5s"
}
}
EOF
systemctl enable --now nomad consul
- mode: user
script: |
#!/bin/sh
nomad -autocomplete-install
probes:
- script: |
#!/bin/bash
set -eux -o pipefail
if ! timeout 30s bash -c "until command -v nomad >/dev/null 2>&1; do sleep 3; done"; then
echo >&2 "nomad is not installed yet"
exit 1
fi
hint: See "/var/log/cloud-init-output.log". in the guest