From 8089b148751def1a6eef60f79c6ea46902aeb6c4 Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Fri, 29 Jun 2018 10:48:49 +0200 Subject: Do not copy start/stop scripts twice It is unnecessary to copy start/stop twice during build --- lava-master/Dockerfile | 4 ---- 1 file changed, 4 deletions(-) (limited to 'lava-master') diff --git a/lava-master/Dockerfile b/lava-master/Dockerfile index 137a59a..0489858 100644 --- a/lava-master/Dockerfile +++ b/lava-master/Dockerfile @@ -4,10 +4,6 @@ RUN echo "deb http://ftp.fr.debian.org/debian/ stretch-backports main" >> /etc/a RUN apt-get update -# Add services helper utilities to start and stop LAVA -COPY scripts/stop.sh . -COPY scripts/start.sh . - # Install debian packages used by the container # Configure apache to run the lava server # Log the hostname used during install for the slave name -- cgit 1.2.3-korg From a86807eafd93f0f53933929f616ee3a73d807d7c Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Wed, 4 Jul 2018 14:25:35 +0200 Subject: Permit to have backported LAVA patch If backporting LAVA patch is necessary, this patch add an easy way to do it. --- README.md | 3 +++ lava-master/Dockerfile | 3 +++ lava-master/lava-patch/.empty | 0 3 files changed, 6 insertions(+) create mode 100644 lava-master/lava-patch/.empty (limited to 'lava-master') diff --git a/README.md b/README.md index c48f43e..279fe25 100644 --- a/README.md +++ b/README.md @@ -318,6 +318,9 @@ A squid docker is provided for caching all LAVA downloads (image, dtb, rootfs, e You have to uncomment a line in lava-master/Dockerfile to enable it.
For the moment, it is unsupported and unbuilded. +## Backporting LAVA patches +All upstream LAVA patches could be backported by placing them in lava-master/lava-patch/ + ## Security Note that this container provides defaults which are unsecure. If you plan on deploying this in a production enviroment please consider the following items: diff --git a/lava-master/Dockerfile b/lava-master/Dockerfile index 0489858..4407f0b 100644 --- a/lava-master/Dockerfile +++ b/lava-master/Dockerfile @@ -89,6 +89,9 @@ COPY settings.conf /etc/lava-server/ COPY device-types-patch/ /root/device-types-patch/ RUN cd /etc/lava-server/dispatcher-config/device-types/ && for patch in $(ls /root/device-types-patch/*patch) ; do sed -i 's,lava_scheduler_app/tests/device-types/,,' $patch && patch < $patch ; done +COPY lava-patch/ /root/lava-patch +RUN cd /usr/lib/python3/dist-packages && for patch in $(ls /root/lava-patch/*patch) ; do patch -p1 < $patch || exit $?;done + EXPOSE 69/udp 80 3079 5555 5556 CMD /start.sh && while [ true ];do sleep 365d; done diff --git a/lava-master/lava-patch/.empty b/lava-master/lava-patch/.empty new file mode 100644 index 0000000..e69de29 -- cgit 1.2.3-korg From 3e0ed7a2bb5f52ba54fdc1a6fbbe258f42397fbe Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Mon, 2 Jul 2018 15:03:50 +0200 Subject: Add device-types and tokens at startup This patch remove the use of setup.sh during build. So setup.sh is now ran during startup. Since setup.sh could ran multiple times (start -> stop -> start) against the same database, we need to handle already existing objects (user, devices,...) So all "add objects" are done only after a check that this object is not already present. --- lava-master/Dockerfile | 1 - lava-master/scripts/setup.sh | 24 +++++++++++++++++------- lava-master/scripts/start.sh | 3 +++ 3 files changed, 20 insertions(+), 8 deletions(-) (limited to 'lava-master') diff --git a/lava-master/Dockerfile b/lava-master/Dockerfile index 4407f0b..3e64627 100644 --- a/lava-master/Dockerfile +++ b/lava-master/Dockerfile @@ -77,7 +77,6 @@ COPY device-types/ /root/device-types/ COPY users/ /root/lava-users/ COPY tokens/ /root/lava-callback-tokens/ COPY scripts/setup.sh / -RUN /start.sh && /setup.sh && /stop.sh #uncomment if you want to use squid # warning the address used must be network accessible by all slave diff --git a/lava-master/scripts/setup.sh b/lava-master/scripts/setup.sh index 3ab2abd..585499e 100755 --- a/lava-master/scripts/setup.sh +++ b/lava-master/scripts/setup.sh @@ -20,10 +20,15 @@ if [ -e /root/lava-users ];then if [ $SUPERUSER -eq 1 ];then USER_OPTION="$USER_OPTION --superuser" fi - echo "Adding username $USER DEBUG(with $TOKEN / $PASSWORD / $USER_OPTION)" - lava-server manage users add --passwd $PASSWORD $USER_OPTION $USER || exit 1 - if [ ! -z "$TOKEN" ];then - lava-server manage tokens add --user $USER --secret $TOKEN || exit 1 + lava-server manage users list | grep -q "[[:space:]]$USER$" + if [ $? -eq 0 ];then + echo "Skip already existing $USER DEBUG(with $TOKEN / $PASSWORD / $USER_OPTION)" + else + echo "Adding username $USER DEBUG(with $TOKEN / $PASSWORD / $USER_OPTION)" + lava-server manage users add --passwd $PASSWORD $USER_OPTION $USER || exit 1 + if [ ! -z "$TOKEN" ];then + lava-server manage tokens add --user $USER --secret $TOKEN || exit 1 + fi fi done fi @@ -56,9 +61,14 @@ if [ -e /root/device-types ];then do cp $i /etc/lava-server/dispatcher-config/device-types/ devicetype=$(basename $i |sed 's,.jinja2,,') - echo "Adding custom $devicetype" - lava-server manage device-types add $devicetype || exit $? - touch /root/.lavadocker/devicetype-$devicetype + lava-server manage device-types list | grep -q "[[:space:]]$devicetype[[:space:]]" + if [ $? -eq 0 ];then + echo "Skip already known $devicetype" + else + echo "Adding custom $devicetype" + lava-server manage device-types add $devicetype || exit $? + touch /root/.lavadocker/devicetype-$devicetype + fi done fi diff --git a/lava-master/scripts/start.sh b/lava-master/scripts/start.sh index 0e223b5..c34fe34 100755 --- a/lava-master/scripts/start.sh +++ b/lava-master/scripts/start.sh @@ -25,6 +25,9 @@ start () { rm -f /var/run/lava-*.pid 2> /dev/null /etc/init.d/postgresql start + +/setup.sh || exit $? + start apache2 || exit $? start lava-logs || exit $? start lava-master || exit $? -- cgit 1.2.3-korg From 32221a4e8fe36fd5c3c972039932cb53a25b1d5c Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Thu, 12 Jul 2018 14:30:06 +0200 Subject: Exit if device-types patch does not apply --- lava-master/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lava-master') diff --git a/lava-master/Dockerfile b/lava-master/Dockerfile index 3e64627..7d61103 100644 --- a/lava-master/Dockerfile +++ b/lava-master/Dockerfile @@ -86,7 +86,7 @@ COPY scripts/setup.sh / COPY settings.conf /etc/lava-server/ COPY device-types-patch/ /root/device-types-patch/ -RUN cd /etc/lava-server/dispatcher-config/device-types/ && for patch in $(ls /root/device-types-patch/*patch) ; do sed -i 's,lava_scheduler_app/tests/device-types/,,' $patch && patch < $patch ; done +RUN cd /etc/lava-server/dispatcher-config/device-types/ && for patch in $(ls /root/device-types-patch/*patch) ; do sed -i 's,lava_scheduler_app/tests/device-types/,,' $patch && patch < $patch || exit $?; done COPY lava-patch/ /root/lava-patch RUN cd /usr/lib/python3/dist-packages && for patch in $(ls /root/lava-patch/*patch) ; do patch -p1 < $patch || exit $?;done -- cgit 1.2.3-korg