diff options
author | khilman <khilman@users.noreply.github.com> | 2018-01-24 08:58:57 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-24 08:58:57 -0800 |
commit | f14d69b382978069321acdec9a434ca85ac137da (patch) | |
tree | 90cdd4df15614ffe022778f986d551a63959712e | |
parent | 736fc3248108069d9f7d98fadc436aad3732dfab (diff) | |
parent | c856c35e30f4465f8d14834d672a0dcbf06567fb (diff) |
Merge pull request #13 from montjoie/bugfix
Bugfix
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | docker-compose.template | 16 | ||||
-rw-r--r-- | lava-master/Dockerfile | 5 | ||||
-rwxr-xr-x | lava-master/scripts/setup.sh | 9 | ||||
-rw-r--r-- | lava-master/settings.conf | 16 | ||||
-rw-r--r-- | lava-slave/Dockerfile | 12 | ||||
-rwxr-xr-x | lavalab-gen.py | 3 | ||||
-rwxr-xr-x | lavalab-gen.sh | 13 | ||||
-rw-r--r-- | squid/entrypoint.sh | 5 |
9 files changed, 66 insertions, 15 deletions
@@ -98,4 +98,4 @@ Note that this container provides defaults which are unsecure. If you plan on de * Changing the default admin password * Using HTTPS - + * Re-enable CSRF cookie (disabled in lava-master/Dockerfile) diff --git a/docker-compose.template b/docker-compose.template index d7986ec..d125af8 100644 --- a/docker-compose.template +++ b/docker-compose.template @@ -7,19 +7,21 @@ services: tty: true build: context: lava-master - devices: - - "/dev/kvm:/dev/kvm" +# TODO handle kvm option +# devices: +# - "/dev/kvm:/dev/kvm" ports: - "10080:80" - - "1022:22" - "5555:5555" - "5556:5556" volumes: -# boot and /lib/modules are for libguestfs +# boot and /lib/modules are for libguestfs (TODO set them read_only with docker-compose 3.0) - "/boot:/boot" - "/lib/modules:/lib/modules" lava-slave: hostname: lab-slave-0 +#conmux does not support dns_search + dns_search: "" restart: always build: context: lava-slave @@ -29,7 +31,11 @@ services: ports: - "69:69/udp" - "80:80" - - "55980-56000:55980-56000" + - "61950-62000:61950-62000" + volumes: +# boot and /lib/modules are for libguestfs (TODO set them read_only with docker-compose 3.0) + - "/boot:/boot" + - "/lib/modules:/lib/modules" links: - "lava-master" squid: diff --git a/lava-master/Dockerfile b/lava-master/Dockerfile index 2dd44b0..be8a3b7 100644 --- a/lava-master/Dockerfile +++ b/lava-master/Dockerfile @@ -13,12 +13,14 @@ RUN echo 'lava-server lava-server/instance-name string lava-docker-instance' | && echo 'locales locales/locales_to_be_generated multiselect C.UTF-8 UTF-8, en_US.UTF-8 UTF-8 ' | debconf-set-selections \ && echo 'locales locales/default_environment_locale select en_US.UTF-8' | debconf-set-selections +# e2fsprogs is for libguestfs RUN DEBIAN_FRONTEND=noninteractive apt-get -y install \ locales \ postgresql \ screen \ sudo \ wget \ + e2fsprogs \ gnupg \ vim @@ -78,6 +80,9 @@ RUN /start.sh && /setup.sh && /stop.sh #uncomment if you want to use squid #RUN sed -i 's,^.*http_proxy:.*, http_proxy: http://squid:3128,' /etc/lava-server/env.yaml +#comment this if you do HTTPS (For reenabling CSRF cookie) +COPY settings.conf /etc/lava-server/ + EXPOSE 69/udp 80 3079 5555 5556 CMD /start.sh && bash diff --git a/lava-master/scripts/setup.sh b/lava-master/scripts/setup.sh index 011a9c7..b60c93b 100755 --- a/lava-master/scripts/setup.sh +++ b/lava-master/scripts/setup.sh @@ -43,11 +43,12 @@ fi # This directory is used for storing device-types already added mkdir -p /root/.lavadocker/ if [ -e /root/device-types ];then - for i in $(ls /root/device-types/*yaml) + for i in $(ls /root/device-types/*jinja2) do - cp /root/device-types/$i /etc/lava-server/dispatcher-config/device-types/ - devicetype=$(basename $i) - lava-server manage device-types add $devicetype || exit 1 + 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 done fi diff --git a/lava-master/settings.conf b/lava-master/settings.conf new file mode 100644 index 0000000..c809e2c --- /dev/null +++ b/lava-master/settings.conf @@ -0,0 +1,16 @@ +{ + "DEBUG": false, + "STATICFILES_DIRS": [ + ["lava-server", "/usr/share/pyshared/lava_server/htdocs/"] + ], + "MEDIA_ROOT": "/var/lib/lava-server/default/media", + "ARCHIVE_ROOT": "/var/lib/lava-server/default/archive", + "STATIC_ROOT": "/usr/share/lava-server/static", + "STATIC_URL": "/static/", + "MOUNT_POINT": "/", + "HTTPS_XML_RPC": false, + "LOGIN_URL": "/accounts/login/", + "LOGIN_REDIRECT_URL": "/", + "CSRF_COOKIE_SECURE": false, + "SESSION_COOKIE_SECURE": false +} diff --git a/lava-slave/Dockerfile b/lava-slave/Dockerfile index 5e0f3cb..fcaa0cc 100644 --- a/lava-slave/Dockerfile +++ b/lava-slave/Dockerfile @@ -6,6 +6,7 @@ RUN apt-get update COPY scripts/stop.sh . COPY scripts/start.sh . +# e2fsprogs is for libguestfs RUN \ echo 'lava-server lava-server/instance-name string lava-slave-instance' | debconf-set-selections && \ echo 'locales locales/locales_to_be_generated multiselect C.UTF-8 UTF-8, en_US.UTF-8 UTF-8 ' | debconf-set-selections && \ @@ -60,8 +61,15 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -y install postgresql RUN service postgresql start && DEBIAN_FRONTEND=noninteractive apt-get -y install lavapdu-daemon lavapdu-client && service postgresql stop COPY lavapdu.conf /etc/lavapdu/ -#TODO made this customizable, 1000 ports by default is too much -RUN sed -i 's,XNBD_PORT_RANGE_MIN.*,XNBD_PORT_RANGE_MIN=55950,' /usr/lib/python2.7/dist-packages/lava_dispatcher/pipeline/utils/constants.py +# Caution to not use any port between the Linux dynamic port range: 32768-60999 +RUN sed -i 's,XNBD_PORT_RANGE_MIN.*,XNBD_PORT_RANGE_MIN=61950,' /usr/lib/python2.7/dist-packages/lava_dispatcher/utils/constants.py +RUN sed -i 's,XNBD_PORT_RANGE_MAX.*,XNBD_PORT_RANGE_MAX=62000,' /usr/lib/python2.7/dist-packages/lava_dispatcher/utils/constants.py + +#conmux need cu >= 1.07-24 See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=336996 +RUN echo "deb http://debian.proxad.net/debian/ testing main" >> /etc/apt/sources.list.d/testing.list +RUN apt-get update +RUN DEBIAN_FRONTEND=noninteractive apt-get -y install cu +RUN rm /etc/apt/sources.list.d/testing.list EXPOSE 69/udp 80 diff --git a/lavalab-gen.py b/lavalab-gen.py index a584a1f..64a4b0b 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -78,6 +78,9 @@ def main(args): if not os.path.isdir("lava-slave/conmux/"): os.mkdir("lava-slave/conmux/") + # board specific hacks + if devicetype == "qemu": + device_line += "{% set no_kvm = True %}\n" if not os.path.isdir("lava-master/devices/"): os.mkdir("lava-master/devices/") device_path = "lava-master/devices/%s" % lab_name diff --git a/lavalab-gen.sh b/lavalab-gen.sh index 06df881..26cbc23 100755 --- a/lavalab-gen.sh +++ b/lavalab-gen.sh @@ -13,8 +13,15 @@ fi ./lavalab-gen.py || exit 1 -rm /etc/udev/rules.d/lavalab*rules -cp lavalab*rules /etc/udev/rules.d/ +#check for root +BEROOT="" +if [ $(id -u) -ne 0 ];then + BEROOT="sudo " +fi +$BEROOT rm /etc/udev/rules.d/*lavalab*rules +$BEROOT cp *lavalab*rules /etc/udev/rules.d/ +$BEROOT udevadm control --reload-rules || exit $? +$BEROOT udevadm trigger || exit $? docker-compose build || exit 1 -docker-compose up || exit 1 +docker-compose up -d || exit 1 diff --git a/squid/entrypoint.sh b/squid/entrypoint.sh index 560d206..70bdf6e 100644 --- a/squid/entrypoint.sh +++ b/squid/entrypoint.sh @@ -1,5 +1,10 @@ #!/bin/bash +if [ -e /var/run/squid.pid ];then + #echo "DEBUG: Removed old squid PID" + rm /var/run/squid.pid +fi + # Create cache FS if [ ! -e /var/spool/squid/00 ];then squid -z || exit $? |