aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorentin LABBE <clabbe@baylibre.com>2019-06-25 09:46:14 +0200
committerCorentin LABBE <clabbe@baylibre.com>2019-06-25 09:48:07 +0200
commit6a670632e15a3f40a05e164bf476b7519d9a166f (patch)
tree1cc0bcab7ab1a69de0f728db324b43e552e68f5b
parent18278de8fb3e613115f21b6f02cedc191e6a791e (diff)
lava-master: move the start.sh from lava-master-base to lava-master
The start.sh will now be stored in lava-master. This will help for migrating to official LAVA docker images
-rw-r--r--lava-master/Dockerfile1
-rwxr-xr-xlava-master/scripts/start.sh40
2 files changed, 41 insertions, 0 deletions
diff --git a/lava-master/Dockerfile b/lava-master/Dockerfile
index b018a2d..6051851 100644
--- a/lava-master/Dockerfile
+++ b/lava-master/Dockerfile
@@ -18,6 +18,7 @@ COPY users/ /root/lava-users/
COPY groups/ /root/lava-groups/
COPY tokens/ /root/lava-callback-tokens/
COPY scripts/setup.sh /
+COPY scripts/start.sh /
COPY settings.conf /etc/lava-server/
diff --git a/lava-master/scripts/start.sh b/lava-master/scripts/start.sh
new file mode 100755
index 0000000..c34fe34
--- /dev/null
+++ b/lava-master/scripts/start.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+postgres-ready () {
+ echo "Waiting for lavaserver database to be active"
+ while (( $(ps -ef | grep -v grep | grep postgres | grep lavaserver | wc -l) == 0 ))
+ do
+ echo -n "."
+ sleep 1
+ done
+ echo
+ echo "[ ok ] LAVA server ready"
+}
+
+start () {
+ echo "Starting $1"
+ if (( $(ps -ef | grep -v grep | grep -v add_device | grep -v dispatcher-config | grep "$1" | wc -l) > 0 ))
+ then
+ echo "$1 appears to be running"
+ else
+ service "$1" start
+ fi
+}
+
+#remove lava-pid files incase the image is stored without first stopping the services
+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 $?
+start lava-coordinator || exit $?
+start lava-slave || exit $?
+start lava-server-gunicorn || exit $?
+start tftpd-hpa || exit $?
+
+postgres-ready
+service apache2 reload #added after the website not running a few times on boot