From 2e448945269ca28b644f587bf40afd9fe6c38583 Mon Sep 17 00:00:00 2001 From: Tyler Baker Date: Mon, 1 May 2017 10:45:06 -0700 Subject: Dockerfile: shuffle scripts, and add tftp support Signed-off-by: Tyler Baker --- Dockerfile | 7 +++++-- configs/tftpd-hpa | 6 ++++++ scripts/start.sh | 36 ++++++++++++++++++++++++++++++++++++ scripts/stop.sh | 9 +++++++++ start.sh | 36 ------------------------------------ stop.sh | 9 --------- 6 files changed, 56 insertions(+), 47 deletions(-) create mode 100644 configs/tftpd-hpa create mode 100755 scripts/start.sh create mode 100755 scripts/stop.sh delete mode 100755 start.sh delete mode 100755 stop.sh diff --git a/Dockerfile b/Dockerfile index b74261f..b5647f9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ FROM bitnami/minideb:unstable # Add services helper utilities to start and stop LAVA -COPY stop.sh . -COPY start.sh . +COPY scripts/stop.sh . +COPY scripts/start.sh . # Install debian packages used by the container # Configure apache to run the lava server @@ -55,5 +55,8 @@ RUN /start.sh \ && cd /root/lava-server && /root/lava-server/share/debian-dev-build.sh -p lava-server \ && /stop.sh +COPY configs/tftpd-hpa /etc/default/tftpd-hpa + EXPOSE 69 80 5555 5556 + CMD /start.sh && bash diff --git a/configs/tftpd-hpa b/configs/tftpd-hpa new file mode 100644 index 0000000..bb6f079 --- /dev/null +++ b/configs/tftpd-hpa @@ -0,0 +1,6 @@ +# /etc/default/tftpd-hpa + +TFTP_USERNAME="tftp" +TFTP_DIRECTORY="/var/lib/lava/dispatcher/tmp/" +TFTP_ADDRESS="0.0.0.0:69" +TFTP_OPTIONS="--secure" diff --git a/scripts/start.sh b/scripts/start.sh new file mode 100755 index 0000000..54de1f6 --- /dev/null +++ b/scripts/start.sh @@ -0,0 +1,36 @@ +#!/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 + +start postgresql +start apache2 +start lava-server +start lava-master +start lava-slave +start lava-server-gunicorn +start tftpd-hpa + +postgres-ready +service apache2 reload #added after the website not running a few times on boot diff --git a/scripts/stop.sh b/scripts/stop.sh new file mode 100755 index 0000000..8b5feda --- /dev/null +++ b/scripts/stop.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +service lava-master stop +service lava-slave stop +service lava-server stop +service lava-server-gunicorn stop +service apache2 stop +service postgresql stop +service tftpd-hpa stop diff --git a/start.sh b/start.sh deleted file mode 100755 index 54de1f6..0000000 --- a/start.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/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 - -start postgresql -start apache2 -start lava-server -start lava-master -start lava-slave -start lava-server-gunicorn -start tftpd-hpa - -postgres-ready -service apache2 reload #added after the website not running a few times on boot diff --git a/stop.sh b/stop.sh deleted file mode 100755 index 8b5feda..0000000 --- a/stop.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -service lava-master stop -service lava-slave stop -service lava-server stop -service lava-server-gunicorn stop -service apache2 stop -service postgresql stop -service tftpd-hpa stop -- cgit 1.2.3-korg