From 4d266d21b45fa9178cdf5e57407f181a3b8913d0 Mon Sep 17 00:00:00 2001 From: Hannes Feldt <feldt@astron.nl> Date: Tue, 22 Oct 2024 22:16:10 +0200 Subject: [PATCH] add basics --- dev-env.hcl | 8 ++++++++ setup.sh | 30 ++++++++++++++++++++++++++++++ simple.nomad | 12 ++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 dev-env.hcl create mode 100755 setup.sh create mode 100644 simple.nomad diff --git a/dev-env.hcl b/dev-env.hcl new file mode 100644 index 0000000..51a4dc4 --- /dev/null +++ b/dev-env.hcl @@ -0,0 +1,8 @@ +resource "network" "cloud" { + subnet = "10.10.0.0/16" +} +resource "nomad_cluster" "dev" { + network { + id = resource.network.cloud.meta.id + } +} diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..742a504 --- /dev/null +++ b/setup.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# +# Copyright (C) 2024 ASTRON (Netherlands Institute for Radio Astronomy) +# SPDX-License-Identifier: Apache-2.0 +# + +# Url to the jumppad download location +jumppad_download="https://github.com/jumppad-labs/jumppad/releases/download/0.15.0/jumppad_0.15.0_linux_x86_64.tar.gz" +levant_download="https://releases.hashicorp.com/levant/0.3.3/levant_0.3.3_linux_amd64.zip" + +mkdir -p ./.bin +bin_dir=$(realpath ./.bin) +export PATH="$PATH:$bin_dir" + +echo 'Check if jumppad is installed' +if ! [ -x "$(command -v jumppad)" ]; then + echo 'jumppad is not installed, installing' + mkdir -p ./.bin + wget -qO- "${jumppad_download}" | tar xvfz - -C "$bin_dir" + chmod +x ./.bin/jumppad +fi + +echo 'Check if levant is installed' +if ! [ -x "$(command -v levant)" ]; then + echo 'levant is not installed, installing' + mkdir -p ./.bin + wget -qO- "${levant_download}" | zcat >> ./.bin/levant + chmod +x ./.bin/levant +fi + diff --git a/simple.nomad b/simple.nomad new file mode 100644 index 0000000..342b2af --- /dev/null +++ b/simple.nomad @@ -0,0 +1,12 @@ +job "example" { + group "test" { + task "alpine" { + driver = "docker" + config { + image = "alpine:latest" + command = "sh" + args = ["-c", "while true; do sleep 300; done "] + } + } + } +} -- GitLab