summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkhilman <khilman@users.noreply.github.com>2018-07-27 08:22:10 -0500
committerGitHub <noreply@github.com>2018-07-27 08:22:10 -0500
commit61a473fb56ef7418314385df7b72cd58e40a2ff2 (patch)
tree6502b5650c12f630bb6aada9448ca4238b556148
parentd733f2d4280959fed968d1589580f46460ecba27 (diff)
parentb19b71ab89761e801c27038f093d76655efabfbf (diff)
Merge pull request #36 from montjoie/miscfix_07_2018b
Miscfix 07 2018b
-rw-r--r--README.md10
-rw-r--r--lava-master/Dockerfile2
-rwxr-xr-xlava-master/scripts/setup.sh10
-rw-r--r--lava-slave/Dockerfile2
-rwxr-xr-xlavalab-gen.py18
-rwxr-xr-xlavalab-gen.sh6
6 files changed, 41 insertions, 7 deletions
diff --git a/README.md b/README.md
index 4ef1019..a3364b4 100644
--- a/README.md
+++ b/README.md
@@ -219,10 +219,12 @@ 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)
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:
@@ -338,6 +340,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:
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..426876f 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
@@ -52,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/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
diff --git a/lavalab-gen.py b/lavalab-gen.py
index f7f06f3..2d21fe7 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,12 +138,19 @@ 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()
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)
@@ -153,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)
@@ -166,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:
@@ -278,6 +288,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:
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