Skip to content
Snippets Groups Projects
Commit 60ed06e6 authored by Hannes Feldt's avatar Hannes Feldt
Browse files

Merge branch 'update-jumppad' into 'master'

L2SS-1822: Update jumppad to latest version

Closes L2SS-1822

See merge request !894
parents 15dc106d dd464c1f
No related branches found
No related tags found
1 merge request!894L2SS-1822: Update jumppad to latest version
......@@ -280,8 +280,7 @@ unit_test:
- apk add git
- apk add jq
- apk add --update make bash
- apk add --update bind-tools
- apk add --update postgresql14-client gzip socat
- apk add --update gzip
- apk add --update python3 py3-pip
- python3 -m venv venv && source venv/bin/activate
- pip install shyaml
......@@ -295,10 +294,6 @@ unit_test:
- unset TANGO_HOST
- export TAG="$tag"
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh pull $tag
# Forward nomad API port to docker host
- socat tcp-listen:4646,reuseaddr,fork tcp:docker:4646 &
# Forward consul dns port to docker host
- socat udp-listen:8600,reuseaddr,fork udp:docker:8600 &
artifacts:
when: always
paths:
......
......@@ -38,8 +38,6 @@ After checking out this repo, be sure to install our git hooks and activate the
source setup.sh
```
The file `/etc/docker/daemon.json` must exist on the host, create the folder and file if necessary.
You will also need:
* docker
......
......@@ -74,9 +74,9 @@ This container can be identified programmatically as follows. Use the additional
``-q`` parameter to obtain just the container ID:
```
$ docker ps --filter 'name=server.station.nomad.nomad-cluster.jumppad.dev'
$ docker ps --filter 'name=server.station.nomad.nomad-cluster.local.jmpd.in'
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b75f633c837e shipyardrun/nomad:1.6.1 "/usr/bin/supervisor…" 2 minutes ago Up 2 minutes [...] server.station.nomad.nomad-cluster.jumppad.dev
b75f633c837e shipyardrun/nomad:1.6.1 "/usr/bin/supervisor…" 2 minutes ago Up 2 minutes [...] server.station.nomad.nomad-cluster.local.jmpd.in
$
```
......@@ -87,7 +87,7 @@ The server allows you to manage the jobs on the client through Nomad. Each *job*
The nomad server spins up on http://localhost:4646, allowing interactive browsing and control. There is also a CLI however, accessed through
```
$ SERVER_CONTAINER_ID=$(docker ps -q --filter 'name=server.station.nomad.nomad-cluster.jumppad.dev')
$ SERVER_CONTAINER_ID=$(docker ps -q --filter 'name=server.station.nomad.nomad-cluster.local.jmpd.in')
$ docker exec "${SERVER_CONTAINER_ID}" nomad
Usage: nomad [-version] [-help] [-autocomplete-(un)install] <command> [args]
[...]
......
......@@ -44,7 +44,7 @@ resource "template" "consul_config" {
resource "container" "consul" {
depends_on = ["resource.template.consul_config"]
network {
id = resource.network.station.id
id = resource.network.station.meta.id
ip_address = "192.168.123.100"
}
......@@ -92,7 +92,7 @@ resource "nomad_cluster" "station" {
datacenter = "stat"
network {
id = resource.network.station.id
id = resource.network.station.meta.id
}
environment = {
NO_PROXY = "astron.nl,control.lofar,10.0.0.0/8"
......@@ -110,10 +110,6 @@ resource "nomad_cluster" "station" {
source = "./config/resolv.conf"
destination = "/etc/resolv.conf"
}
volume {
source = "/etc/docker/daemon.json"
destination = "/etc/docker/daemon.json"
}
copy_image {
name = "git.astron.nl:5000/lofar2.0/tango/ec-sim:${variable.image_tag}"
}
......
......@@ -10,5 +10,8 @@ output "nomad_cluster" {
value = resource.nomad_cluster.station
}
output "network_id" {
value = resource.network.station.id
value = resource.network.station.meta.id
}
output "external_ip" {
value = resource.nomad_cluster.station.external_ip
}
......@@ -5,7 +5,7 @@
#
# Url to the jumppad download location
jumppad_download="https://git.astron.nl/lofar2.0/tango/-/package_files/41902/download"
jumppad_download="https://github.com/jumppad-labs/jumppad/releases/download/0.10.2/jumppad_0.10.2_linux_x86_64.tar.gz"
levant_download="https://releases.hashicorp.com/levant/0.3.3/levant_0.3.3_linux_amd64.zip"
if [ -z "$LOFAR20_DIR" ]; then
......@@ -25,7 +25,7 @@ echo 'Check if jumppad is installed'
if ! [ -x "$(command -v jumppad)" ]; then
echo 'jumppad is not installed, installing'
mkdir -p ./.bin
wget "${jumppad_download}" -O ./.bin/jumppad
wget -qO- "${jumppad_download}" | tar xvfz - -C "$bin_dir"
chmod +x ./.bin/jumppad
fi
......
......@@ -4,9 +4,7 @@
# SPDX-License-Identifier: Apache-2.0
#
export HOSTNAME=192.168.123.1
export DNS=192.168.123.100
export do_cleanup=true
# Usage function explains how parameters are parsed
......@@ -103,7 +101,6 @@ if [ -z "$TAG" ]; then
fi
echo "Using TAG: ${TAG}"
echo "Using DNS: ${DNS}"
# Build dsconfig first, `-z ${y+x}` is the inverse of `-n ${y}`
if [ -z "${no_build+x}" ]; then
......@@ -145,7 +142,7 @@ function cleanup {
mkdir -p log/allocations
# obtain (and save!) the list of tasks, but only those that have actually started.
docker exec server.station.nomad.nomad-cluster.jumppad.dev nomad alloc status -json > log/allocations/alloc-status.json
docker exec server.station.nomad.nomad-cluster.local.jmpd.in nomad alloc status -json > log/allocations/alloc-status.json
<log/allocations/alloc-status.json jq --raw-output '.[] | (.ID + " " + .Name + " " + (.TaskStates | objects | map_values(select(.StartedAt)) | keys[]) + " " + (.CreateTime/1e9 | todate))' | while read -r line
do
read -r -a parts <<< "${line}"
......@@ -155,8 +152,8 @@ function cleanup {
CREATE_TIME="${parts[3]}"
echo "Saving logs for job ${TASK_NAME} allocation ${ALLOC_ID}"
docker exec server.station.nomad.nomad-cluster.jumppad.dev nomad alloc logs -stderr "${ALLOC_ID}" "${TASK_NAME}" > "log/allocations/${ALLOC_NAME}-${TASK_NAME}-${CREATE_TIME}-${ALLOC_ID}.stderr.log" || true
docker exec server.station.nomad.nomad-cluster.jumppad.dev nomad alloc logs -stdout "${ALLOC_ID}" "${TASK_NAME}" > "log/allocations/${ALLOC_NAME}-${TASK_NAME}-${CREATE_TIME}-${ALLOC_ID}.stdout.log" || true
docker exec server.station.nomad.nomad-cluster.local.jmpd.in nomad alloc logs -stderr "${ALLOC_ID}" "${TASK_NAME}" > "log/allocations/${ALLOC_NAME}-${TASK_NAME}-${CREATE_TIME}-${ALLOC_ID}.stderr.log" || true
docker exec server.station.nomad.nomad-cluster.local.jmpd.in nomad alloc logs -stdout "${ALLOC_ID}" "${TASK_NAME}" > "log/allocations/${ALLOC_NAME}-${TASK_NAME}-${CREATE_TIME}-${ALLOC_ID}.stdout.log" || true
done
# clean up empty files (most containers log to either stderr or stdout)
......@@ -190,7 +187,7 @@ function integration_test {
if [ -n "${2+x}" ]; then
# shellcheck disable=SC2145
echo "restart device-servers restart ..."
docker exec -i server.station.nomad.nomad-cluster.jumppad.dev nomad job restart -on-error=fail device-servers
docker exec -i server.station.nomad.nomad-cluster.local.jmpd.in nomad job restart -on-error=fail device-servers
# shellcheck disable=SC2145
echo "await ${restarts[@]} ..."
await "${restarts[@]}"
......@@ -212,7 +209,7 @@ function await {
for i in "$@"; do
start_time="$(date -u +%s)"
echo -n "Wait for service ${i} to become healthy .."
while [ "$(docker exec -i server.station.nomad.nomad-cluster.jumppad.dev nomad job allocs -json device-servers | jq -r ".[] | select(.TaskGroup == \"${awaits}\") | .TaskStates[].State")" != "running" ] ; do
while [ "$(docker exec -i server.station.nomad.nomad-cluster.local.jmpd.in nomad job allocs -json device-servers | jq -r ".[] | select(.TaskGroup == \"${awaits}\") | .TaskStates[].State")" != "running" ] ; do
echo -n '.'
sleep 2
current_time="$(date -u +%s)"
......@@ -241,6 +238,10 @@ if [ -z "$JUMPPAD_HOME" ]; then
JUMPPAD_HOME="$HOME"
fi
if [ -z "$DOCKER_HOST" ]; then
DOCKER_HOST="unix:///var/run/docker.sock"
fi
dsconfig_image="git.astron.nl:5000/lofar2.0/tango/dsconfig:$TAG"
# Update the dsconfig
docker pull -q "$dsconfig_image" || docker pull -q "git.astron.nl:5000/lofar2.0/tango/dsconfig:latest" || true
......@@ -255,7 +256,10 @@ jumppad_options=(
echo "Start module: $module"
jumppad_options+=("infra/dev/$module.hcl")
HOME="$JUMPPAD_HOME" jumppad up "${jumppad_options[@]}"
DOCKER_HOST="$DOCKER_HOST" HOME="$JUMPPAD_HOME" jumppad up "${jumppad_options[@]}"
# shellcheck disable=SC2046
#eval $(HOME="$JUMPPAD_HOME" jumppad env "infra/dev/$module.hcl")
docker run --rm --network="station" --dns="192.168.123.100" busybox \
sh -c "echo -n 'Waiting for tango service to become available ..'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment