setup on server
authorroot <root@brendanfh.com>
Mon, 19 Jul 2021 04:05:20 +0000 (04:05 +0000)
committerroot <root@brendanfh.com>
Mon, 19 Jul 2021 04:05:20 +0000 (04:05 +0000)
config/__init__.py [new file with mode: 0644]
config/__pycache__/__init__.cpython-38.pyc [new file with mode: 0644]
config/__pycache__/default.cpython-38.pyc [new file with mode: 0644]
config/default.py [new file with mode: 0644]
onyx-live.ini [new file with mode: 0644]
serve.py
static/src/index.js
templates/index.html
wsgi.py [new file with mode: 0644]

diff --git a/config/__init__.py b/config/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/config/__pycache__/__init__.cpython-38.pyc b/config/__pycache__/__init__.cpython-38.pyc
new file mode 100644 (file)
index 0000000..fcc7cbd
Binary files /dev/null and b/config/__pycache__/__init__.cpython-38.pyc differ
diff --git a/config/__pycache__/default.cpython-38.pyc b/config/__pycache__/default.cpython-38.pyc
new file mode 100644 (file)
index 0000000..536f02b
Binary files /dev/null and b/config/__pycache__/default.cpython-38.pyc differ
diff --git a/config/default.py b/config/default.py
new file mode 100644 (file)
index 0000000..48ef9ba
--- /dev/null
@@ -0,0 +1 @@
+ENDPOINT="/onyx"
diff --git a/onyx-live.ini b/onyx-live.ini
new file mode 100644 (file)
index 0000000..432f6fe
--- /dev/null
@@ -0,0 +1,13 @@
+[uwsgi]
+module = wsgi:app
+
+master = true
+processes = 2
+
+socket = onyx-live.sock
+chmod-socket = 660
+vacuum = true
+
+plugins=python3
+
+die-on-term = true
index 3cbb365a326441fb3b923be44a492c35f5c3c2db..decca698da7772d29a33b424c18fb775d2f7a366 100644 (file)
--- a/serve.py
+++ b/serve.py
@@ -6,6 +6,8 @@ app = Flask(
     instance_relative_config=True,
 )
 
+app.config.from_object("config.default")
+
 @app.route("/")
 def get_homepage():
     return flask.render_template("index.html")
index 666d702c0191b1c89f752ba84cc29c438636d7fc..ddf652c7c74d2fd8a91ffb9ddae64ef481b182a3 100644 (file)
@@ -34,7 +34,7 @@ async function run_wasm(wasm_bytes) {
     }
     update_running_msg();
 
-    wasm_worker = new Worker('static/src/worker.js');
+    wasm_worker = new Worker(window.ROOT_ENDPOINT + '/static/src/worker.js');
 
     wasm_worker.onmessage = (e) => {
         switch (e.data.type) {
@@ -59,7 +59,7 @@ async function submit_code() {
     clear_output();
     let code = ace.edit('code-editor').getValue();
 
-    let response = await fetch("/compile", {
+    let response = await fetch(window.ROOT_ENDPOINT + "/compile", {
         method: 'POST',
         cache:  'no-cache',
         headers: {
index 5b21914846b5848c6e0e3e928c2cf6630bd13e4c..7a7715a2f03047ae1da5c8357a897c9214467f6c 100644 (file)
@@ -3,11 +3,11 @@
     <head>
         <title>Onyx compiler</title> 
 
-        <link rel="stylesheet" href="{{ url_for('static', filename='css/index.css') }}" />
-        <script src="{{ url_for('static', filename='src/index.js') }}"></script>
-
-        <script src="{{ url_for('static', filename='src/vendor/ace/ace.js') }}"></script>
+        <link rel="stylesheet" href="{{ config['ENDPOINT'] + url_for('static', filename='css/index.css') }}" />
 
+        <script> window.ROOT_ENDPOINT = "{{ config['ENDPOINT']}}" </script>
+        <script src="{{ config['ENDPOINT'] + url_for('static', filename='src/index.js') }}"></script>
+        <script src="{{ config['ENDPOINT'] + url_for('static', filename='src/vendor/ace/ace.js') }}"></script>
     </head>
 
     <body>
diff --git a/wsgi.py b/wsgi.py
new file mode 100644 (file)
index 0000000..52a9ba8
--- /dev/null
+++ b/wsgi.py
@@ -0,0 +1,5 @@
+from serve import app
+
+if __name__ == "__main__":
+    app.run()
+