diff --git a/bootstrap/bootstrap.py b/bootstrap/bootstrap.py index fa9c415..6e08fd9 100644 --- a/bootstrap/bootstrap.py +++ b/bootstrap/bootstrap.py @@ -21,6 +21,87 @@ import logging import shutil import urllib.request +html = """ + + + The Littlest Jupyterhub + + + + + + +
+
Please wait while your TLJH is building...
+
Click the button below to see the logs
+
Tip: to update the logs, refresh the page
+ + + + + + + +""" + logger = logging.getLogger(__name__) def get_os_release_variable(key): @@ -99,7 +180,11 @@ class LoaderPageRequestHandler(SimpleHTTPRequestHandler): with open("/opt/tljh/installer.log", "rb") as log_file: content = log_file.read() self.wfile.write(content) - elif self.path == "/index.html" or self.path == "/favicon.ico": + elif self.path == "/index.html": + self.path = "/var/run/index.html" + return SimpleHTTPRequestHandler.do_GET(self) + elif self.path == "/favicon.ico": + self.path = "/var/run/favicon.ico" return SimpleHTTPRequestHandler.do_GET(self) elif self.path == "/": self.send_response(302) @@ -118,10 +203,10 @@ def main(): temp_page_flag = "--temporary-page" if temp_page_flag in sys.argv: # Serve the loading page until TLJH builds - index_url="https://raw.githubusercontent.com/GeorgianaElena/the-littlest-jupyterhub/in-progress-page/bootstrap/index.html" + with open("/var/run/index.html", "w+") as f: + f.write(html) favicon_url="https://raw.githubusercontent.com/jupyterhub/jupyterhub/master/share/jupyterhub/static/favicon.ico" - urllib.request.urlretrieve(index_url, "index.html") - urllib.request.urlretrieve(favicon_url, "favicon.ico") + urllib.request.urlretrieve(favicon_url, "/var/run/favicon.ico") # If the bootstrap is run to upgrade TLJH, then this will raise an "Address already in use" error try: diff --git a/bootstrap/index.html b/bootstrap/index.html deleted file mode 100644 index 3220733..0000000 --- a/bootstrap/index.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - -
-
Please wait while your TLJH is building...
-
Click the button below to see the logs
-
Tip: to update the logs, refresh the page
- - - - -