From be50f16913d2877a6695c8b25d36313a13b255c0 Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Wed, 18 Jul 2018 14:40:37 +0200 Subject: Permit to choose the FQDN printed in email --- README.md | 1 + lava-master/Dockerfile | 2 ++ lava-master/scripts/setup.sh | 6 ++++++ lavalab-gen.py | 9 ++++++++- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ef1019..20ea25b 100644 --- a/README.md +++ b/README.md @@ -219,6 +219,7 @@ masters: zmq_auth_key: optional path to a public ZMQ key zmq_auth_key_secret: optional path to a private ZMQ key persistent_db: True/False (default False) Is the postgres DB is persistent over reboot + http_fqdn: The FQDN used to access the LAVA web interface users: - name: LAVA username token: The token of this user (optional) diff --git a/lava-master/Dockerfile b/lava-master/Dockerfile index 100b366..1270e32 100644 --- a/lava-master/Dockerfile +++ b/lava-master/Dockerfile @@ -29,6 +29,8 @@ RUN cd /usr/lib/python3/dist-packages && for patch in $(ls /root/lava-patch/*pat COPY zmq_auth/ /etc/lava-dispatcher/certificates.d/ +COPY lava_http_fqdn /root/ + EXPOSE 69/udp 80 3079 5555 5556 CMD /start.sh && while [ true ];do sleep 365d; done diff --git a/lava-master/scripts/setup.sh b/lava-master/scripts/setup.sh index dd0d58f..e217a96 100755 --- a/lava-master/scripts/setup.sh +++ b/lava-master/scripts/setup.sh @@ -21,6 +21,12 @@ if [ -e /db_lavaserver ];then fi chown -R lavaserver:lavaserver /var/lib/lava-server/default/media/job-output/ +# default site is set as example.com +if [ -e /root/lava_http_fqdn ];then + sudo -u postgres psql lavaserver -c "UPDATE django_site SET name = '$(cat /root/lava_http_fqdn)'" || exit $? + sudo -u postgres psql lavaserver -c "UPDATE django_site SET domain = '$(cat /root/lava_http_fqdn)'" || exit $? +fi + if [ -e /root/lava-users ];then for ut in $(ls /root/lava-users) do diff --git a/lavalab-gen.py b/lavalab-gen.py index f7f06f3..4c10109 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -87,7 +87,7 @@ def main(): sys.exit(1) masters = workers["masters"] for master in masters: - keywords_master = [ "name", "type", "host", "users", "tokens", "webadmin_https", "persistent_db", "zmq_auth", "zmq_auth_key", "zmq_auth_key_secret" ] + keywords_master = [ "name", "type", "host", "users", "tokens", "webadmin_https", "persistent_db", "zmq_auth", "zmq_auth_key", "zmq_auth_key_secret", "http_fqdn" ] for keyword in master: if not keyword in keywords_master: print("WARNING: unknown keyword %s" % keyword) @@ -138,6 +138,13 @@ def main(): else: cookie_secure = "false" session_cookie_secure = "false" + if "http_fqdn" in worker: + lava_http_fqdn = worker["http_fqdn"] + else: + lava_http_fqdn = "example.com" + f_fqdn = open("%s/lava_http_fqdn" % workerdir, 'w') + f_fqdn.write(lava_http_fqdn) + f_fqdn.close() fsettings = open("%s/settings.conf" % workerdir, 'w') fsettings.write(template_settings_conf.substitute(cookie_secure=cookie_secure, session_cookie_secure=session_cookie_secure)) fsettings.close() -- cgit 1.2.3-korg From 33b992bcd9ec4b4f7896ba79d626ec563016005c Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Tue, 24 Jul 2018 16:42:12 +0200 Subject: lavalab-gen.py: use zmq_auth value The current script just check for zmq_auth presence and does not check if it is set to false. this patch fix that! --- lavalab-gen.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lavalab-gen.py b/lavalab-gen.py index 4c10109..4c77c2b 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -150,7 +150,7 @@ def main(): fsettings.close() master_use_zmq_auth = False if "zmq_auth" in worker: - master_use_zmq_auth = True + master_use_zmq_auth = worker["zmq_auth"] if master_use_zmq_auth: if "zmq_auth_key" in worker: shutil.copy(worker["zmq_auth_key"], "%s/zmq_auth/" % workerdir) @@ -285,6 +285,8 @@ def main(): if fuser["name"] == remote_user: remote_token = fuser["token"] if "zmq_auth" in fm: + master_use_zmq_auth = fm["zmq_auth"] + if master_use_zmq_auth: if "zmq_auth_key" in fm: shutil.copy(fm["zmq_auth_key"], "%s/zmq_auth/" % workerdir) if "zmq_auth_key" in worker: -- cgit 1.2.3-korg From 80195a67349f8d64e2e42218ae6f2c165b50ecc8 Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Tue, 24 Jul 2018 16:43:44 +0200 Subject: lavalab-gen.sh: use rm -f --- lavalab-gen.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lavalab-gen.sh b/lavalab-gen.sh index 08ab2ad..fd39c15 100755 --- a/lavalab-gen.sh +++ b/lavalab-gen.sh @@ -1,8 +1,8 @@ #!/bin/sh -rm lava-master/scripts/build-lava -rm lava-slave/scripts/build-lava -rm -r output +rm -f lava-master/scripts/build-lava +rm -f lava-slave/scripts/build-lava +rm -rf output if [ "$1" = "mrproper" ];then exit 0 -- cgit 1.2.3-korg From cc8b761a70cffc34b4f0fc586fc960154c6d79ed Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Wed, 25 Jul 2018 15:14:57 +0200 Subject: README: Add an upgrade guide --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 20ea25b..30c2313 100644 --- a/README.md +++ b/README.md @@ -339,6 +339,14 @@ Example: This produce a backup-20180704_1206 directory For restoring this backup, simply cp backup-20180704_1206/* output/local/master/backup/ +## Upgrading from a previous lava-docker +For upgrading between two LAVA version, the only method is: +- backup data with ./backup.sh (See Backups / restore) +- checkout the new lava-docker and a your boards.yaml +- run lavalab-gen.py +- copy your backup data in output/yourhost/master/backup directory +- build and run docker-compose + ## 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: -- cgit 1.2.3-korg From b7b57615f30030fc1a456da1008a0231836fa5ac Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Thu, 26 Jul 2018 09:59:00 +0200 Subject: lava-slave/Dockerfile: Use deb.debian.org instead of local mirror --- lava-slave/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lava-slave/Dockerfile b/lava-slave/Dockerfile index 95c4d83..e07c01e 100644 --- a/lava-slave/Dockerfile +++ b/lava-slave/Dockerfile @@ -14,7 +14,7 @@ RUN find /usr/lib/python3/dist-packages/ -iname constants.py | xargs sed -i 's,X RUN find /usr/lib/python3/dist-packages/ -iname constants.py | xargs sed -i 's,XNBD_PORT_RANGE_MAX.*,XNBD_PORT_RANGE_MAX=62000,' #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 echo "deb http://deb.debian.org/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 -- cgit 1.2.3-korg From b19b71ab89761e801c27038f093d76655efabfbf Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Thu, 26 Jul 2018 16:48:53 +0200 Subject: Permit to configure email for LAVA users --- README.md | 1 + lava-master/scripts/setup.sh | 4 ++++ lavalab-gen.py | 5 ++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 30c2313..a3364b4 100644 --- a/README.md +++ b/README.md @@ -224,6 +224,7 @@ masters: - name: LAVA username token: The token of this user (optional) password: Password the this user (generated if not provided) + email: email of the user (optional) superuser: yes/no (default no) staff: yes/no (default no) tokens: diff --git a/lava-master/scripts/setup.sh b/lava-master/scripts/setup.sh index e217a96..426876f 100755 --- a/lava-master/scripts/setup.sh +++ b/lava-master/scripts/setup.sh @@ -58,6 +58,10 @@ if [ -e /root/lava-users ];then echo "Adding token to user $USER" lava-server manage tokens add --user $USER --secret $TOKEN || exit 1 fi + if [ ! -z "$EMAIL" ];then + echo "Adding email to user $USER" + lava-server manage users update --email $EMAIL $USER || exit 1 + fi fi done fi diff --git a/lavalab-gen.py b/lavalab-gen.py index 4c77c2b..2d21fe7 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -160,7 +160,7 @@ def main(): need_zmq_auth_gen = True if "users" in worker: for user in worker["users"]: - keywords_users = [ "name", "staff", "superuser", "password", "token" ] + keywords_users = [ "name", "staff", "superuser", "password", "token", "email" ] for keyword in user: if not keyword in keywords_users: print("WARNING: unknown keyword %s" % keyword) @@ -173,6 +173,9 @@ def main(): password = user["password"] ftok.write("PASSWORD=" + password + "\n") # libyaml convert yes/no to true/false... + if "email" in user: + email = user["email"] + ftok.write("EMAIL=" + email + "\n") if "staff" in user: value = user["staff"] if value is True: -- cgit 1.2.3-korg