diff --git a/.gitignore b/.gitignore index 6430516993f3cbd8987e44aaa002104e4d830ff7..0694a2d4ec36f44d8d015249cf38915cb469b6fa 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ ubuntu-xenial-16.04-cloudimg-console.log *$py.class **/.pytest_cache/ build/ +reporc diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f8311bce80c074c64f6260e68cf9c5a4f572e1bc..a71be2c187e795cd5a499fcd91b0e6f3f3f7c53c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,10 +28,11 @@ build:tests: only: - schedules script: - - cd src/test - - python setup.py sdist --dist-dir=../../build - - cd ../../src/service - - python setup.py sdist --dist-dir=../../build + - echo $CI_PROJECT_DIR + - cd $CI_PROJECT_DIR/src/test + - python setup.py sdist --dist-dir=$CI_PROJECT_DIR/build + - cd $CI_PROJECT_DIR/src/service + - python setup.py sdist --dist-dir=$CI_PROJECT_DIR/build artifacts: paths: - build/clmctest-SNAPSHOT.tar.gz @@ -44,18 +45,19 @@ test:all: - schedules dependencies: - build:tests - script: -# - echo "REPO_USER=${REPO_USER}" > reporc -# - echo "REPO_PASS=${REPO_PASS}" >> reporc - - vagrant --fixture=scripts -- up - - vagrant --fixture=scripts -- ssh test-runner -- -tt "pip3 install /vagrant/build/clmctest-SNAPSHOT.tar.gz" - - vagrant --fixture=scripts -- ssh test-runner -- -tt "pytest -s --pyargs clmctest.scripts" - - vagrant --fixture=monitoring -- up - - vagrant --fixture=monitoring -- ssh test-runner -- -tt "pip3 install /vagrant/build/clmcservice-SNAPSHOT.tar.gz" - - vagrant --fixture=monitoring -- ssh test-runner -- -tt "pytest -s --pyargs clmctest.monitoring" - - vagrant --fixture=monitoring -- ssh test-runner -- -tt "pytest -s --pyargs clmcservice.tests" - - vagrant --fixture=inputs -- up - - vagrant --fixture=inputs -- ssh test-runner -- -tt "pytest -s --pyargs clmctest.inputs" + script: + - echo "REPO_USER=${REPO_USER}" > $CI_PROJECT_DIR/reporc + - echo "REPO_PASS=${REPO_PASS}" >> $CI_PROJECT_DIR/reporc + - sudo scripts/test/fixture.sh create -f src/test/clmctest/rspec.json -r $CI_PROJECT_DIR + - sudo mkdir /var/lib/lxc/test-runner/rootfs/vagrant/build + - sudo cp build/clmctest-SNAPSHOT.tar.gz /var/lib/lxc/test-runner/rootfs/vagrant/build + - sudo cp build/clmcservice-SNAPSHOT.tar.gz /var/lib/lxc/test-runner/rootfs/vagrant/build + - sudo lxc-attach -n test-runner -- pip3 install /vagrant/build/clmctest-SNAPSHOT.tar.gz + - sudo lxc-attach -n test-runner -- pip3 install /vagrant/build/clmcservice-SNAPSHOT.tar.gz + - sudo lxc-attach -n test-runner -- pytest -s --pyargs clmctest.scripts + - sudo lxc-attach -n test-runner -- pytest -s --pyargs clmcservice.tests + - sudo lxc-attach -n test-runner -- pytest -s --pyargs clmctest.inputs + - sudo lxc-attach -n test-runner -- pytest -s --pyargs clmctest.monitoring when: on_success clean: @@ -63,5 +65,5 @@ clean: only: - schedules script: - - python scripts/test/deleteallvms.py - when: always \ No newline at end of file + - sudo scripts/test/fixture.sh destroy -f src/test/clmctest/rspec.json + when: always diff --git a/README.md b/README.md index 405b567128d1d969c767cc7691953bb93e6448cd..8aa004fc1a9031b66fe20c0944694f41e99e754f 100644 --- a/README.md +++ b/README.md @@ -59,16 +59,30 @@ SSH into the VM `vagrant ssh` -Create the services needed for integration tests +The containers are controlled using a script called /vagrant/scripts/test/fixtures.sh + +``` +Usage: fixturs.sh create|start|stop|destroy [-f config_file] [-r repo_root] [-c service_name]" +``` + +To create all the services needed for integration tests ``` sudo su -/vagrant/scripts/test/conts-create.sh +/vagrant/scripts/test/fixtures.sh create -f /vagrant/src/test/clmctest/rspec.json ``` -All of the containers created are defined in the file `/vagrant/src/test/clmctest/rspec.json` +The containers created are defined an rspec.json file, there's an example here `/vagrant/src/test/clmctest/rspec.json` + +The `fixtures.sh` script defaults to look for a rspec.json in the current directory, you can specify a specific rspec.json file using the -f option -Attach to the test-runner +To create|start|stop|destroy specific services use the -c option e.g. + +``` +/vagrant/scripts/test/fixtures.sh create -f /vagrant/src/test/clmctest/rspec.json -c clmc-service +``` + +Attach to the test-runner to run the tests `lxc-attach -n test-runner` @@ -96,3 +110,25 @@ The following modules are integration tests pytest -s --pyargs clmctest.inputs pytest -s --pyargs clmctest.monitoring ``` + +#### CI Testing + +A vagrant VM is setup on givry in the directory `/home/mjb/flame-clmc` + +The VM is started using a libvirt vagrant file through the following command: + +`VAGRANT_VAGRANTFILE=Vagrantfile.libvirt vagrant up` + +The VM has gitlab-runner installed:: + +``` +VAGRANT_VAGRANTFILE=Vagrantfile.libvirt vagrant up +VAGRANT_VAGRANTFILE=Vagrantfile.libvirt vagrant ssh -- -tt "sudo /vagrant/scripts/test/install-git-runner.sh" +``` + +Runners can be installed on developers virtualbox VMs if necessary, in that case you can just use + +``` +vagrant up +vagrant ssh -- -tt "sudo /vagrant/scripts/test/install-git-runner.sh" +``` \ No newline at end of file diff --git a/Vagrantfile.libvirt b/Vagrantfile.libvirt new file mode 100644 index 0000000000000000000000000000000000000000..5a3bae454387d5b737b5f464b48aa4f09d340230 --- /dev/null +++ b/Vagrantfile.libvirt @@ -0,0 +1,24 @@ +$lxc_script = <<-SCRIPT + +apt-get update +apt-get install lxc lxc-templates wget bridge-utils jq -y +lxc-checkconfig + +touch /etc/lxc/dnsmasq.conf +sed -i s/10.0.3/172.40.231/g /etc/default/lxc-net +sed -i s/#LXC_DHCP_CONFILE/LXC_DHCP_CONFILE/g /etc/default/lxc-net +service lxc-net restart + +SCRIPT + +Vagrant.configure("2") do |config| + config.vm.box = "yk0/ubuntu-xenial" + + config.vm.provider :libvirt do |domain| + domain.memory = 8192 + domain.cpus = 4 + end + + # Install lxc + config.vm.provision :shell, inline: $lxc_script +end diff --git a/reporc b/reporc deleted file mode 100644 index 55ddc3e14ff38e011c8f9566e068528be60ac8a8..0000000000000000000000000000000000000000 --- a/reporc +++ /dev/null @@ -1,2 +0,0 @@ -REPO_USER=itinnov.flame.integration -REPO_PASS=1tc3ntr3 \ No newline at end of file diff --git a/scripts/clmc-service/install.sh b/scripts/clmc-service/install.sh index 32c22d4be9da8789eecda35181713d380455f5a6..84039236d71171b6264010ea81575527e887332a 100755 --- a/scripts/clmc-service/install.sh +++ b/scripts/clmc-service/install.sh @@ -95,9 +95,6 @@ systemctl start chronograf ## CLMC-SERVICE ## ---------------------------------------------------------------------------------- - - - echo "----> Configuring virtualenvwrapper" export WORKON_HOME=$HOME/.virtualenvs source /usr/local/bin/virtualenvwrapper.sh @@ -154,15 +151,33 @@ fi echo "----> Creating CLMC web service log directory" sudo mkdir /var/log/clmcservice -# start the service -echo "----> Starting CLMC web service" -nohup pserve production.ini > /dev/null 2>&1 & -if [ $? -ne 0 ] ; then - echo "Failed: starting clmc-webservice" - exit 1 -else - echo "CLMC service started." -fi +# Install minioclmc as systemctl service +# ----------------------------------------------------------------------- +mkdir -p /opt/flame/clmc +start_script_file="/opt/flame/clmc/start.sh" +echo "#!/bin/bash" > $start_script_file +echo "export WORKON_HOME=${HOME}/.virtualenvs" >> $start_script_file +echo "source /usr/local/bin/virtualenvwrapper.sh" >> $start_script_file +echo "workon CLMC" >> $start_script_file +echo "pserve ${REPO_ROOT}/src/service/production.ini > /dev/null 2>&1 &" >> $start_script_file + +chmod 755 $start_script_file + +file="/lib/systemd/system/flameclmc.service" +echo "[Unit]" > $file +echo "Description=flameclmc" >> $file +echo "After=network.target" >> $file +echo "" >> $file +echo "[Service]" >> $file +echo "Type=forking" >> $file +echo "ExecStart=${start_script_file}" >> $file +echo "" >> $file +echo "[Install]" >> $file +echo "WantedBy=multi-user.target" >> $file + +systemctl daemon-reload +systemctl enable flameclmc.service +systemctl start flameclmc.service # wait for the clmc service to start while ! nc -z localhost 9080 diff --git a/scripts/test/conts-create.sh b/scripts/test/conts-create.sh deleted file mode 100755 index 637d8ba519666e16c9681a2d96903fe3914ec1e9..0000000000000000000000000000000000000000 --- a/scripts/test/conts-create.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/bash -set -eu -o pipefail -cd `dirname $0` - -source conts-env.sh - -# iterate through each service required for integration testing -service_names=$(jq -r '.[].name' ${rspec_file}) -for service_name in $service_names; do - if ! lxc-info -n ${service_name}; then - # create a container with a static ip address - echo "Creating container: ${service_name}" - SERVICE=$(jq --arg NAME ${service_name} '.[] | select(.name==$NAME)' ${rspec_file}) - echo $SERVICE - ip=$(echo $SERVICE | jq -r '.ip_address') - echo "dhcp-host=${service_name},${ip}" >> /etc/lxc/dnsmasq.conf - service lxc-net restart - - lxc-create -t download -n ${service_name} -- --dist ubuntu --release xenial --arch amd64 - - # copy flame clmc files into the root container - echo "Copying files to rootfs" - container_dir="/var/lib/lxc/"${service_name}"/rootfs" - container_vagrant_dir=${container_dir}"${repo_root}" - mkdir -p ${container_vagrant_dir} - cp -f ${repo_root}/reporc "${container_vagrant_dir}" - cp -rf ${repo_root}/scripts ${container_vagrant_dir} - cp -rf ${repo_root}/src ${container_vagrant_dir} - - # start the container - echo "Starting: ${service_name}" - lxc-start -n ${service_name} - echo "Waiting for container to start: ${service_name}" - STARTED="0" - while [ "$STARTED" == "0" ]; do STARTED=$(lxc-info -n ${service_name} -i | wc -l); done; - - # provision software into each container - echo "Provisioning: ${service_name}" - if [ ${service_name} == "clmc-service" ] - then - influxdb_url=$(echo $SERVICE | jq -r '.influxdb_url') - database_name=$(echo $SERVICE | jq -r '.database_name') - report_period=$(echo $SERVICE | jq -r '.report_period') - cmd="${repo_root}/scripts/clmc-service/install.sh ${influxdb_url} ${database_name} ${report_period}" - lxc-attach -n ${service_name} -v REPO_ROOT=${repo_root} -- ${cmd} - elif [ ${service_name} == "test-runner" ] - then - cmd=${repo_root}/src/test/clmctest/services/pytest/install.sh - lxc-attach -n ${service_name} -- ${cmd} - else - # get container parameters - location=$(echo $SERVICE | jq -r '.location') - sf_id=$(echo $SERVICE | jq -r '.sf_id') - sf_id_instance=$(echo $SERVICE | jq -r '.sf_id_instance') - sfc_id=$(echo $SERVICE | jq -r '.sfc_id') - sfc_id_instance=$(echo $SERVICE | jq -r '.sfc_id_instance') - sr_id=$(echo $SERVICE | jq -r '.sr_id') - ipendpoint_id=$(echo $SERVICE | jq -r '.ipendpoint_id') - influxdb_url=$(echo $SERVICE | jq -r '.influxdb_url') - database_name=$(echo $SERVICE | jq -r '.database_name') - - # install service function specific software - cmd=${repo_root}/src/test/clmctest/services/${sf_id}/install.sh - lxc-attach -n ${service_name} -v REPO_ROOT=${repo_root} -- ${cmd} - - # install telegraf - cmd=${repo_root}/scripts/clmc-agent/install.sh - lxc-attach -n ${service_name} -v REPO_ROOT=${repo_root} -- ${cmd} - - # copy telegraf configuration templates - cp -f ${repo_root}/scripts/clmc-agent/telegraf.conf ${container_dir}/etc/telegraf/ - cp -f ${repo_root}/scripts/clmc-agent/telegraf_output.conf ${container_dir}/etc/telegraf/telegraf.d/ - cp ${repo_root}/src/test/clmctest/services/${sf_id}/telegraf_${sf_id}.conf ${container_dir}/etc/telegraf/telegraf.d/ - - # replace telegraf template with container parameters - # @todo do we really need both scripts to do this? - cmd=${repo_root}/scripts/clmc-agent/configure_template.sh - lxc-attach -n ${service_name} -- ${cmd} - cmd="${repo_root}/scripts/clmc-agent/configure.sh ${location} ${sfc_id} ${sfc_id_instance} ${sf_id} ${sf_id_instance} ${ipendpoint_id} ${sr_id} ${influxdb_url} ${database_name}" - lxc-attach -n ${service_name} -- ${cmd} - - # start telegraf - lxc-attach -n ${service_name} -- service telegraf restart - fi - fi -done - -#./conts-stop.sh - -#service lxc-net restart - -#./conts-start.sh \ No newline at end of file diff --git a/scripts/test/conts-destroy.sh b/scripts/test/conts-destroy.sh deleted file mode 100755 index 456816dc54ba3bc6960f9dc417a01532cd1100ca..0000000000000000000000000000000000000000 --- a/scripts/test/conts-destroy.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -set -eu -o pipefail -cd `dirname $0` - -source conts-env.sh - -service_names=$(jq -r '.[].name' ${rspec_file}) -for service_name in $service_names; do - if lxc-info -n ${service_name}; then - echo "Stopping container: ${service_name}" - lxc-stop -n ${service_name} - echo "Destroying container: ${service_name}" - lxc-destroy -n ${service_name} - ip=$(jq -r --arg NAME ${service_name} '.[] | select(.name==$NAME) | .ip_address' ${rspec_file}) - sed -i "/dhcp-host=${service_name},/d" /etc/lxc/dnsmasq.conf - fi -done diff --git a/scripts/test/conts-env.sh b/scripts/test/conts-env.sh deleted file mode 100755 index 742d54779cb3a2434cb70b07ef1dff8ceb461f92..0000000000000000000000000000000000000000 --- a/scripts/test/conts-env.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -repo_root="/vagrant" -rspec_file=$repo_root"/src/test/clmctest/rspec.json" \ No newline at end of file diff --git a/scripts/test/conts-start.sh b/scripts/test/conts-start.sh deleted file mode 100755 index 2af56c1a6f3ee7a301bdefd6f9e4fe1ce7487e1e..0000000000000000000000000000000000000000 --- a/scripts/test/conts-start.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -set -eu -o pipefail -cd `dirname $0` - -source conts-env.sh - -service_names=$(jq -r '.[].name' ${rspec_file}) -for service_name in $service_names; do - if lxc-info -n ${service_name}; then - echo "Starting container: ${service_name}" - lxc-start -n ${service_name} - fi -done diff --git a/scripts/test/conts-stop.sh b/scripts/test/conts-stop.sh deleted file mode 100755 index a64786939ffdbfa2a7916da356d69b3a197c749f..0000000000000000000000000000000000000000 --- a/scripts/test/conts-stop.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -set -eu -o pipefail -cd `dirname $0` - -source conts-env.sh - -service_names=$(jq -r '.[].name' ${rspec_file}) -for service_name in $service_names; do - if lxc-info -n ${service_name}; then - echo "Stopping container: ${service_name}" - lxc-stop -n ${service_name} - fi -done \ No newline at end of file diff --git a/scripts/test/fixture.sh b/scripts/test/fixture.sh new file mode 100755 index 0000000000000000000000000000000000000000..f0a5e970cfeb015928a9d26cc8f405bec643a14a --- /dev/null +++ b/scripts/test/fixture.sh @@ -0,0 +1,176 @@ +#!/bin/bash + +usage() { + echo "Usage: $0 create|start|stop|destroy [-f config_file] [-r repo_root] [-c service_name]" 1>&2 + exit 1 +} + +create() { + service_name=$1 + config_file=$2 + repo_root=$3 + if ! lxc-info -n ${service_name}; then + # create a container with a static ip address + echo "Creating container: ${service_name}" + SERVICE=$(jq --arg NAME ${service_name} '.[] | select(.name==$NAME)' ${config_file}) + echo $SERVICE + ip=$(echo $SERVICE | jq -r '.ip_address') + echo "dhcp-host=${service_name},${ip}" >> /etc/lxc/dnsmasq.conf + service lxc-net restart + + lxc-create -t download -n ${service_name} -- --dist ubuntu --release xenial --arch amd64 + + # copy flame clmc files into the root container + echo "Copying files to rootfs" + container_dir="/var/lib/lxc/"${service_name}"/rootfs" + container_vagrant_dir=${container_dir}"/vagrant" + mkdir -p ${container_vagrant_dir} + cp -f ${repo_root}/reporc "${container_vagrant_dir}" + cp -rf ${repo_root}/scripts ${container_vagrant_dir} + cp -rf ${repo_root}/src ${container_vagrant_dir} + + # start the container + echo "Starting: ${service_name}" + lxc-start -n ${service_name} + echo "Waiting for container to start: ${service_name}" + STARTED="0" + while [ "$STARTED" == "0" ]; do STARTED=$(lxc-info -n ${service_name} -i | wc -l); done; + + # provision software into each container + echo "Provisioning: ${service_name}" + if [ ${service_name} == "clmc-service" ] + then + influxdb_url=$(echo $SERVICE | jq -r '.influxdb_url') + database_name=$(echo $SERVICE | jq -r '.database_name') + report_period=$(echo $SERVICE | jq -r '.report_period') + cmd="/vagrant/scripts/clmc-service/install.sh ${influxdb_url} ${database_name} ${report_period}" + lxc-attach -n ${service_name} -v REPO_ROOT="/vagrant" -- ${cmd} + elif [ ${service_name} == "test-runner" ] + then + cmd=/vagrant/src/test/clmctest/services/pytest/install.sh + lxc-attach -n ${service_name} -- ${cmd} + else + # get container parameters + location=$(echo $SERVICE | jq -r '.location') + sf_id=$(echo $SERVICE | jq -r '.sf_id') + sf_id_instance=$(echo $SERVICE | jq -r '.sf_id_instance') + sfc_id=$(echo $SERVICE | jq -r '.sfc_id') + sfc_id_instance=$(echo $SERVICE | jq -r '.sfc_id_instance') + sr_id=$(echo $SERVICE | jq -r '.sr_id') + ipendpoint_id=$(echo $SERVICE | jq -r '.ipendpoint_id') + influxdb_url=$(echo $SERVICE | jq -r '.influxdb_url') + database_name=$(echo $SERVICE | jq -r '.database_name') + + # install service function specific software + cmd=/vagrant/src/test/clmctest/services/${sf_id}/install.sh + lxc-attach -n ${service_name} -v REPO_ROOT="/vagrant" -- ${cmd} + + # install telegraf + cmd=/vagrant/scripts/clmc-agent/install.sh + lxc-attach -n ${service_name} -v REPO_ROOT="/vagrant" -- ${cmd} + + # copy telegraf configuration templates + cp -f ${repo_root}/scripts/clmc-agent/telegraf.conf ${container_dir}/etc/telegraf/ + cp -f ${repo_root}/scripts/clmc-agent/telegraf_output.conf ${container_dir}/etc/telegraf/telegraf.d/ + cp ${repo_root}/src/test/clmctest/services/${sf_id}/telegraf_${sf_id}.conf ${container_dir}/etc/telegraf/telegraf.d/ + + # replace telegraf template with container parameters + # @todo do we really need both scripts to do this? + cmd=/vagrant/scripts/clmc-agent/configure_template.sh + lxc-attach -n ${service_name} -- ${cmd} + cmd="/vagrant/scripts/clmc-agent/configure.sh ${location} ${sfc_id} ${sfc_id_instance} ${sf_id} ${sf_id_instance} ${ipendpoint_id} ${sr_id} ${influxdb_url} ${database_name}" + lxc-attach -n ${service_name} -- ${cmd} + + # start telegraf + lxc-attach -n ${service_name} -- service telegraf restart + fi + fi +} + +start() { + service_name=$1 + if lxc-info -n ${service_name}; then + echo "Starting container: ${service_name}" + lxc-start -n ${service_name} + fi +} + +stop() { + service_name=$1 + if lxc-info -n ${service_name}; then + echo "Stopping container: ${service_name}" + lxc-stop -n ${service_name} + fi +} + +destroy() { + service_name=$1 + config_file=$2 + if lxc-info -n ${service_name}; then + echo "Stopping container: ${service_name}" + lxc-stop -n ${service_name} + echo "Destroying container: ${service_name}" + lxc-destroy -n ${service_name} + ip=$(jq -r --arg NAME ${service_name} '.[] | select(.name==$NAME) | .ip_address' ${config_file}) + sed -i "/dhcp-host=${service_name},/d" /etc/lxc/dnsmasq.conf + fi +} + +# inc option index by 1 as first argument is the command and not parsed by getopts +if [ $# -gt 1 ]; then + OPTIND=$((OPTIND+1)) +fi + +repo_root="/vagrant" +config_file="rspec.json" + +# collect the optional arguments +while getopts "hf:r:c:" opt; do + case $opt in + h) usage; exit ;; + f) config_file=${OPTARG} ;; + r) repo_root=${OPTARG} ;; + c) container=${OPTARG} ;; + \?) usage ;; + esac +done + +# check configuration file exists +if [ ! -f ${config_file} ]; then + echo "Configuration file does not exist: ${config_file}" >&2 + usage + exit 1 +fi + +# check repo root directory exists +if [ ! -d ${repo_root} ]; then + echo "Repo root directory does not exist: ${repo_root}" >&2 + usage + exit 1 +fi + +# iterate of list of services in configuration file +command=$1 +service_names=$(jq -r '.[].name' ${config_file}) +for service_name in $service_names; do + # if all or specific container + if [ -z ${container} ] || [ ${container} == ${service_name} ]; then + case "${command}" in + create) + create ${service_name} ${config_file} ${repo_root} + ;; + start) + start ${service_name} ${config_file} ${repo_root} + ;; + stop) + stop ${service_name} ${config_file} ${repo_root} + ;; + destroy) + destroy ${service_name} ${config_file} ${repo_root} + ;; + *) + usage + ;; + esac + fi +done diff --git a/scripts/test/install-git-runner.sh b/scripts/test/install-git-runner.sh new file mode 100755 index 0000000000000000000000000000000000000000..4b50e4404865b55005239435872aa75d38d6518b --- /dev/null +++ b/scripts/test/install-git-runner.sh @@ -0,0 +1,16 @@ +#!/bin/bash +apt-get update + + +wget -O /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64 +chmod +x /usr/local/bin/gitlab-runner +useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash +echo "gitlab-runner ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers + +gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner +gitlab-runner start + +gitlab-runner register -n --url https://gitlab.it-innovation.soton.ac.uk/ --r sN3wMQp8EiAv7znNwG5s --executor shell --locked true --name ${HOSTNAME} --description ${HOSTNAME} --run-untagged true + +apt-get -y install python3 python3-pip python-influxdb +update-alternatives --install /usr/bin/python python /usr/bin/python3 10