From 5ca81fcd5f1d3347b4d996e16590362637687dcd Mon Sep 17 00:00:00 2001 From: William Harvey Date: Sun, 20 Sep 2020 02:41:46 -0400 Subject: [PATCH 01/24] Clean backend folder && create protobuf script to compile and install python and node plugins from source code. --- .vscode/settings.json | 11 ++- README.md | 8 +- backend/.gitignore | 1 + backend/app.py | 83 ++++++++--------- backend/erreur_test.csv | 97 -------------------- backend/requirements.txt | 17 +--- backend/static/CSS/main.css | 4 - backend/templates/base.html | 12 --- backend/templates/index.html | 9 -- backend/templates/upload_csv.html | 34 ------- mobile/.vscode/launch.json | 14 +++ mobile/pubspec.lock | 4 +- protos/install_grpc_plugins.sh | 7 ++ web/package.json | 1 - web/yarn.lock | 146 ++++++++++++++++++++++++++++-- 15 files changed, 217 insertions(+), 231 deletions(-) create mode 100644 backend/.gitignore delete mode 100644 backend/erreur_test.csv delete mode 100644 backend/static/CSS/main.css delete mode 100644 backend/templates/base.html delete mode 100644 backend/templates/index.html delete mode 100644 backend/templates/upload_csv.html create mode 100644 mobile/.vscode/launch.json create mode 100644 protos/install_grpc_plugins.sh diff --git a/.vscode/settings.json b/.vscode/settings.json index 1701392a..6505efe4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -16,6 +16,15 @@ }, "protoc": { "compile_on_save": true, - "options": ["--proto_path=protos", "--dart_out=mobile/lib/protos", "--python_out=backend/protos", "--js_out=web/src/protos"] + "options": [ + "--proto_path=protos", + "--dart_out=mobile/lib/protos", + "--python_out=backend/protos", + "--grpc_python_out=backend/protos", + "--plugin=protoc-gen-grpc_python=/usr/bin/grpc_python_plugin", + "--js_out=web/src/protos", + "--plugin=protoc-gen-grpc_node=/usr/bin/grpc_node_plugin", + "--grpc_node_out=web/src/protos" + ] } } diff --git a/README.md b/README.md index 3257b86a..23f20e2b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ -# Polydodo: Automatic Sleep Analysis Tool +# Polydodo: Automatic Sleep Analysis Tool -This projects aims to offer a comprehensive guide to **record polysomnographic EEG data from home** with an OpenBCI, a website to **upload sleep data** to our classifier and an **interactive visualisation** tool to observe the classified night of sleep. \ No newline at end of file +This projects aims to offer a comprehensive guide to **record polysomnographic EEG data from home** with an OpenBCI, a website to **upload sleep data** to our classifier and an **interactive visualisation** tool to observe the classified night of sleep. + +### GRPC and proto generation + +In order to be able to proceed to GRPC and proto generation, you need to run `sh ./install_grpc_plugins` under the protos/ folder. diff --git a/backend/.gitignore b/backend/.gitignore new file mode 100644 index 00000000..0cafc1cd --- /dev/null +++ b/backend/.gitignore @@ -0,0 +1 @@ +.venv/ \ No newline at end of file diff --git a/backend/app.py b/backend/app.py index 1ad464e1..626db06c 100644 --- a/backend/app.py +++ b/backend/app.py @@ -1,46 +1,41 @@ -from flask import Flask, render_template, url_for, request, redirect -import os -from resampling import convert_csv_to_raw -from werkzeug.utils import secure_filename - -ALLOWED_EXTENSIONS = {'csv'} - -def allowed_filename(filename): - if not '.' in filename: - print('No extension in filename') - return False - - ext = filename.rsplit('.', 1)[1] - if ext.lower() in ALLOWED_EXTENSIONS: - return True - else: - print('That file extension is not allowed') - return False - - -app = Flask(__name__) - -@app.route('/') -def index(): - return render_template('index.html') - -@app.route('/upload-csv', methods =['GET','POST']) -def upload_csv(): - if request.method == 'POST': - if request.files: - csv = request.files['csv'] - - if csv.filename =='': - print('No filename or no selected file') - return redirect(request.url) - - if allowed_filename(csv.filename): - filename = secure_filename(csv.filename) #useless si on save pas le fichier je crois - print(csv) - convert_csv_to_raw(csv) - return redirect(request.url) - - return render_template('upload_csv.html') +# Copyright 2015 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""The Python implementation of the GRPC helloworld.Greeter server.""" + +from concurrent import futures +import logging + +import grpc + +import backend.protos.helloworld_pb2 +import backend.protos.helloworld_pb2_grpc + + +class Greeter(helloworld_pb2_grpc.GreeterServicer): + + def SayHello(self, request, context): + return helloworld_pb2.HelloReply(message='Hello, %s!' % request.name) + + +def serve(): + server = grpc.server(futures.ThreadPoolExecutor(max_workers=10)) + helloworld_pb2_grpc.add_GreeterServicer_to_server(Greeter(), server) + server.add_insecure_port('[::]:50051') + server.start() + server.wait_for_termination() + if __name__ == '__main__': - app.run(host='0.0.0.0', debug=True) \ No newline at end of file + logging.basicConfig() + serve() \ No newline at end of file diff --git a/backend/erreur_test.csv b/backend/erreur_test.csv deleted file mode 100644 index 7d01c400..00000000 --- a/backend/erreur_test.csv +++ /dev/null @@ -1,97 +0,0 @@ -%OBCI SD Convert - 2020-02-23_12-09-13,,,,,,,,,,, -%,,,,,,,,,,, -%Sample Rate = 250.0 Hz,,,,,,,,,,, -%First Column = SampleIndex,,,,,,,,,,, -%Last Column = Timestamp,,,,,,,,,,, -%Other Columns = EEG data in microvolts followed by Accel Data (in G) interleaved with Aux Data,,,,,,,,,,, -81436,,,,,,,,,,, -0,-11104.548,205.0996,183.9325,1208.6259,0,0,0,0,-0.026,0.28800002,0.358 -1,-11065.186,191.77795,117.45841,1185.9388,0,0,0,0,,, -2,-11017.264,180.24446,157.98212,1174.6064,0,0,0,0,,, -3,-11041.448,194.37076,150.40488,1194.6783,0,0,0,0,,, -4,-11036.777,194.03549,158.80914,1194.1195,0,0,0,0,,, -5,-11030.071,188.69342,190.191,1179.0768,0,0,0,0,,, -6,-11043.885,190.05687,167.39221,1185.0671,0,0,0,0,-0.042000003,0.45200002,0.568 -7,-11042.298,184.91597,169.8956,1178.5181,0,0,0,0,,, -8,-11060.56,186.97234,167.77219,1177.2664,0,0,0,0,,, -9,-11052.803,186.6147,172.80133,1181.759,0,0,0,0,,, -10,-11049.629,187.06174,182.18906,1170.0244,0,0,0,0,,, -11,-11065.32,189.00635,163.5924,1168.4597,0,0,0,0,,, -12,-11058.704,191.08505,169.7168,1174.83,0,0,0,0,,, -13,-11048.221,204.20554,173.1813,1184.9106,0,0,0,0,,, -14,-11061.968,204.80902,162.45247,1184.2401,0,0,0,0,,, -15,-11058.771,201.2104,179.66331,1177.8922,0,0,0,0,,, -16,-11059.777,202.0821,171.1026,1174.2041,0,0,0,0,-0.048,0.52000004,0.708 -17,-11059.777,208.11708,165.08998,1172.796,0,0,0,0,-0.074,0.53000003,0.772 -18,-11031.077,202.97618,169.60503,1175.277,0,0,0,0,,, -19,-11052.356,198.77406,178.61278,1171.8795,0,0,0,0,,, -20,-11073.657,212.45332,170.25323,1175.143,0,0,0,0,,, -21,-11060.917,209.34644,159.94908,1178.0262,0,0,0,0,,, -22,-11040.309,200.36102,186.5253,1170.695,0,0,0,0,,, -23,-11039.012,203.80319,184.04425,1168.1915,0,0,0,0,-0.108,0.51600003,0.76600003 -24,-11040.465,203.80319,183.68663,1164.4587,0,0,0,0,,, -25,-11055.553,208.49707,170.54381,1171.1643,0,0,0,0,,, -26,-11063.465,208.65353,172.91309,1179.4121,0,0,0,0,,, -27,-11054.167,201.03159,173.76245,1178.7416,0,0,0,0,,, -28,-11059.866,199.3552,175.41649,1168.7727,0,0,0,0,,, -29,-11064.046,204.49611,160.10555,1173.3771,0,0,0,0,,, -30,-11059.308,204.49611,166.09581,1170.8514,0,0,0,0,,, -31,-11062.303,200.67395,163.81593,1178.4509,0,0,0,0,,, -32,-11062.303,196.89651,171.81786,1179.7921,0,0,0,0,-0.148,0.56,0.78000003 -33,-11062.705,197.94704,163.48065,1172.9972,0,0,0,0,,, -34,-11066.103,203.1997,171.39317,1169.3986,0,0,0,0,,, -35,-11063.845,204.65256,161.02196,1167.0516,0,0,0,0,,, -36,-11057.497,206.95479,163.81593,1170.3596,0,0,0,0,,, -37,-11055.553,197.96939,165.42525,1173.6677,0,0,0,0,,, -38,-11056.826,197.54471,162.296,1166.9622,0,0,0,0,,, -39,-11057.296,204.27258,161.9831,1168.5715,0,0,0,0,,, -40,-11055.105,201.79153,169.8956,1166.9622,0,0,0,0,,, -41,-11060.805,196.44948,164.68765,1172.6842,0,0,0,0,,, -42,-11065.834,198.30467,152.7071,1178.9427,0,0,0,0,-0.14400001,0.60400003,0.81200004 -43,-11059.174,200.22691,164.41943,1174.6959,0,0,0,0,,, -44,-11060.738,198.41643,169.31445,1171.4996,0,0,0,0,,, -45,-11070.394,202.05977,163.90533,1173.3324,0,0,0,0,,, -46,-11068.069,200.07045,154.98698,1175.7911,0,0,0,0,,, -47,-11060.492,197.34355,154.33879,1169.9573,0,0,0,0,,, -48,-11052.133,192.8732,156.05988,1163.4753,0,0,0,0,,, -49,-11056.871,195.44365,164.28531,1161.4636,0,0,0,0,,, -50,-11058.369,200.6069,165.31349,1167.5657,0,0,0,0,,, -51,-11062.258,202.14917,162.92186,1170.695,0,0,0,0,,, -52,-11067.778,206.70892,149.95786,1171.2313,0,0,0,0,-0.104,0.568,0.8 -53,-11052.759,208.78764,174.09773,1168.795,0,0,0,0,,, -54,-11065.253,210.844,168.44273,1185.4918,0,0,0,0,,, -55,-11062.638,208.00533,144.36992,1183.6143,0,0,0,0,,, -56,-11059.375,209.77112,160.73138,1166.8728,0,0,0,0,,, -57,-11058.994,208.76529,154.51761,1170.0914,0,0,0,0,,, -58,-11052.825,206.82068,155.32227,1173.7347,0,0,0,0,,, -59,-11065.343,212.81096,159.32323,1172.3042,0,0,0,0,,, -60,-11068.047,214.1297,155.88106,1167.7892,0,0,0,0,,, -61,-11060.85,214.75555,159.68086,1167.1857,0,0,0,0,,, -62,-11051.037,217.4154,159.81497,1164.6152,0,0,0,0,-0.106000006,0.578,0.818 -63,-11058.324,217.7954,157.26686,1169.9796,0,0,0,0,,, -64,-11063.867,215.4261,158.60797,1176.3947,0,0,0,0,,, -65,-11065.432,210.8887,160.9102,1180.0826,0,0,0,0,,, -66,-11066.058,215.20259,163.3689,1166.8057,0,0,0,0,,, -67,-11067.913,213.52621,152.97533,1167.2303,0,0,0,0,,, -68,-11073.546,208.40765,153.89175,1177.6016,0,0,0,0,,, -69,-11073.523,214.0403,155.88106,1170.4043,0,0,0,0,,, -70,-11056.715,d,153.1765,1166.3363,0,0,0,0,,, -71,-11060.671,207.42418,147.70032,1168.2139,0,0,0,0,-0.142,0.59000003,0.84400004 -72,-11060.671,211.31339,141.79947,1176.1711,0,0,0,0,,, -73,-11058.458,208.45236,158.98795,1177.1099,0,0,0,0,,, -74,-11065.588,207.89357,148.54968,1178.3616,0,0,0,0,,, -75,-11050.702,209.07822,147.14153,1165.5988,0,0,0,0,,, -76,A,210.08405,152.46124,1162.1118,0,0,0,0,,, -77,-11055.82,203.80319,154.58466,1173.2207,0,0,0,0,,, -78,-11054.368,205.0549,150.20372,1169.5103,0,0,0,0,,, -79,c,207.6477,143.22998,1166.7386,0,0,0,0,,, -80,-11055.91,206.84303,147.4768,1160.6589,0,0,0,0,,, -81,-11054.748,2f,155.70224,1178.4734,0,0,0,0,-0.14400001,0.6,0.84200007 -82,-11056.647,207.84886,141.35243,1177.1545,0,0,0,0,,, -83,-11053.966,210.50873,140.92775,1176.0146,0,0,0,0,,, -84,-11055.038,214.7332,138.93845,1175.6123,0,0,0,0,,, -85,-11054.368,210.53107,146.35922,1169.4656,0,0,0,0,,, -86,-11057.229,209.34644,138.89374,1169.3986,0,0,0,0,,, -87,-11064.091,216.87897,132.90347,1172.416,0,0,0,0,,, -88,-11061.788,220.00821,138.33495,1175.3218,0,0,0,0,,, -89,-11048.221,218.13066,139.8325,1180.6638,0,0,0,0,,, diff --git a/backend/requirements.txt b/backend/requirements.txt index 4bb82bc4..b229498b 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -1,17 +1,2 @@ -click==7.1.1 -Flask==1.1.1 -Flask-SQLAlchemy==2.4.1 -itsdangerous==1.1.0 -Jinja2==2.11.1 -MarkupSafe==1.1.1 -mne==0.19.2 -numpy==1.18.2 -pandas==1.0.3 -pandas-schema==0.3.5 -python-dateutil==2.8.1 -pytz==2019.3 -scipy==1.4.1 -six==1.14.0 -SQLAlchemy==1.3.15 -Werkzeug==1.0.0 +grpcio==1.32.0 protobuf==3.13.0 diff --git a/backend/static/CSS/main.css b/backend/static/CSS/main.css deleted file mode 100644 index 183685b1..00000000 --- a/backend/static/CSS/main.css +++ /dev/null @@ -1,4 +0,0 @@ -body { - margin: 0; - font-family: sans-serif; -} \ No newline at end of file diff --git a/backend/templates/base.html b/backend/templates/base.html deleted file mode 100644 index 1c25ceab..00000000 --- a/backend/templates/base.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - {% block head %}{% endblock %} - - - {% block body %}{% endblock %} - - \ No newline at end of file diff --git a/backend/templates/index.html b/backend/templates/index.html deleted file mode 100644 index 0d2af4c4..00000000 --- a/backend/templates/index.html +++ /dev/null @@ -1,9 +0,0 @@ -{% extends 'base.html' %} - -{% block head %} - -{% endblock %} - -{% block body %} -

Template

-{% endblock %} \ No newline at end of file diff --git a/backend/templates/upload_csv.html b/backend/templates/upload_csv.html deleted file mode 100644 index 737f10ca..00000000 --- a/backend/templates/upload_csv.html +++ /dev/null @@ -1,34 +0,0 @@ -{% extends 'base.html' %} - -{% block head %} -Upload CSV -{% endblock %} - -{% block body %} - -
-
-
- -

Upload CSV

-
- -
- -
- -
- - -
-
- - - -
- -
-
-
- -{% endblock %} \ No newline at end of file diff --git a/mobile/.vscode/launch.json b/mobile/.vscode/launch.json new file mode 100644 index 00000000..c7ced0c2 --- /dev/null +++ b/mobile/.vscode/launch.json @@ -0,0 +1,14 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "mobile", + "program": "lib/main.dart", + "request": "launch", + "type": "dart" + } + ] +} diff --git a/mobile/pubspec.lock b/mobile/pubspec.lock index 03161685..6be43335 100644 --- a/mobile/pubspec.lock +++ b/mobile/pubspec.lock @@ -225,7 +225,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety" + version: "1.8.0-nullsafety.1" stack_trace: dependency: transitive description: @@ -283,5 +283,5 @@ packages: source: hosted version: "2.1.0-nullsafety.2" sdks: - dart: ">=2.10.0-0.0.dev <2.10.0" + dart: ">=2.10.0-137.0 <2.10.0" flutter: ">=1.16.0 <2.0.0" diff --git a/protos/install_grpc_plugins.sh b/protos/install_grpc_plugins.sh new file mode 100644 index 00000000..d53e83f1 --- /dev/null +++ b/protos/install_grpc_plugins.sh @@ -0,0 +1,7 @@ +echo "This script install grpc_python_plugin from source because of this https://github.com/grpc/grpc/issues/15675#issuecomment-397038811" +echo "It also install grpc_node_plugin from source as we can easily get that. We prefer static generation over dynamic one for nodejs." +git clone --recursive https://github.com/grpc/grpc +cd grpc && make grpc_python_plugin -j 4 && make grpc_node_plugin -j 4 +sudo mv bins/opt/grpc_python_plugin /usr/bin +sudo mv bins/opt/grpc_node_plugin /usr/bin +cd .. && sudo rm -r grpc/ \ No newline at end of file diff --git a/web/package.json b/web/package.json index 3018e2c0..8a0fc6a9 100644 --- a/web/package.json +++ b/web/package.json @@ -33,7 +33,6 @@ "node-sass": "4.14.1", "nouislider": "14.1.1", "prop-types": "^15.7.2", - "protobufjs": "^6.10.1", "react": "16.12.0", "react-datetime": "2.16.3", "react-dom": "16.12.0", diff --git a/web/yarn.lock b/web/yarn.lock index 62aeb4e7..203ca29f 100644 --- a/web/yarn.lock +++ b/web/yarn.lock @@ -4160,7 +4160,7 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.9: dependencies: ms "2.0.0" -debug@^3.1.1, debug@^3.2.5: +debug@^3.1.1, debug@^3.2.5, debug@^3.2.6: version "3.2.6" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== @@ -4196,6 +4196,11 @@ deep-equal@^1.0.1, deep-equal@^1.1.1: object-keys "^1.1.1" regexp.prototype.flags "^1.2.0" +deep-extend@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" + integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== + deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" @@ -4296,6 +4301,11 @@ detect-file@^1.0.0: resolved "https://registry.yarnpkg.com/detect-file/-/detect-file-1.0.0.tgz#f0d66d03672a825cb1b73bdb3fe62310c8e552b7" integrity sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc= +detect-libc@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" + integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= + detect-newline@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-2.1.0.tgz#f41f1c10be4b00e87b5f13da680759f2c5bfd3e2" @@ -5465,6 +5475,13 @@ fs-extra@^8.1.0: jsonfile "^4.0.0" universalify "^0.1.0" +fs-minipass@^1.2.5: + version "1.2.7" + resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7" + integrity sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA== + dependencies: + minipass "^2.6.0" + fs-minipass@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-2.1.0.tgz#7f5036fdbf12c63c169190cbe4199c852271f9fb" @@ -5757,6 +5774,13 @@ growly@^1.3.0: resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= +grpc-tools@1.9.1: + version "1.9.1" + resolved "https://registry.yarnpkg.com/grpc-tools/-/grpc-tools-1.9.1.tgz#e43be478860a21781ce9a535647985cd365b1e06" + integrity sha512-t2JFMPLjxcgwVSJwFEauFaoEiO56kijxSwehQDgZNR/hrStJCH0pHGsjqJNuCOvmI9Z31pYOfgj4zeInTQWh5A== + dependencies: + node-pre-gyp "^0.15.0" + gud@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/gud/-/gud-1.0.0.tgz#a489581b17e6a70beca9abe3ae57de7a499852c0" @@ -6134,7 +6158,7 @@ https-browserify@^1.0.0: resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM= -iconv-lite@0.4, iconv-lite@0.4.24, iconv-lite@^0.4.24: +iconv-lite@0.4, iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== @@ -6172,6 +6196,13 @@ iferr@^0.1.5: resolved "https://registry.yarnpkg.com/iferr/-/iferr-0.1.5.tgz#c60eed69e6d8fdb6b3104a1fcbca1c192dc5b501" integrity sha1-xg7taebY/bazEEofy8ocGS3FtQE= +ignore-walk@^3.0.1: + version "3.0.3" + resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.3.tgz#017e2447184bfeade7c238e4aefdd1e8f95b1e37" + integrity sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw== + dependencies: + minimatch "^3.0.4" + ignore@^3.3.5: version "3.3.10" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" @@ -6280,7 +6311,7 @@ inherits@2.0.3: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= -ini@^1.3.4, ini@^1.3.5: +ini@^1.3.4, ini@^1.3.5, ini@~1.3.0: version "1.3.5" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== @@ -7977,6 +8008,14 @@ minipass-pipeline@^1.2.2: dependencies: minipass "^3.0.0" +minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6" + integrity sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg== + dependencies: + safe-buffer "^5.1.2" + yallist "^3.0.0" + minipass@^3.0.0, minipass@^3.1.1: version "3.1.3" resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.1.3.tgz#7d42ff1f39635482e15f9cdb53184deebd5815fd" @@ -7984,6 +8023,13 @@ minipass@^3.0.0, minipass@^3.1.1: dependencies: yallist "^4.0.0" +minizlib@^1.2.1: + version "1.3.3" + resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d" + integrity sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q== + dependencies: + minipass "^2.9.0" + mississippi@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/mississippi/-/mississippi-3.0.0.tgz#ea0a3291f97e0b5e8776b363d5f0a12d94c67022" @@ -8016,7 +8062,7 @@ mixin-object@^2.0.1: for-in "^0.1.3" is-extendable "^0.1.1" -"mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@^0.5.5, mkdirp@~0.5.1: +"mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@^0.5.5, mkdirp@~0.5.1: version "0.5.5" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== @@ -8110,6 +8156,15 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= +needle@^2.5.0: + version "2.5.2" + resolved "https://registry.yarnpkg.com/needle/-/needle-2.5.2.tgz#cf1a8fce382b5a280108bba90a14993c00e4010a" + integrity sha512-LbRIwS9BfkPvNwNHlsA41Q29kL2L/6VaOJ0qisM5lLWsTV3nP15abO5ITL6L81zqFhzjRKDAYjpcBcwM0AVvLQ== + dependencies: + debug "^3.2.6" + iconv-lite "^0.4.4" + sax "^1.2.4" + negotiator@0.6.2: version "0.6.2" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb" @@ -8219,6 +8274,22 @@ node-notifier@^5.4.2: shellwords "^0.1.1" which "^1.3.0" +node-pre-gyp@^0.15.0: + version "0.15.0" + resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.15.0.tgz#c2fc383276b74c7ffa842925241553e8b40f1087" + integrity sha512-7QcZa8/fpaU/BKenjcaeFF9hLz2+7S9AqyXFhlH/rilsQ/hPZKK32RtR5EQHJElgu+q5RfbJ34KriI79UWaorA== + dependencies: + detect-libc "^1.0.2" + mkdirp "^0.5.3" + needle "^2.5.0" + nopt "^4.0.1" + npm-packlist "^1.1.6" + npmlog "^4.0.2" + rc "^1.2.7" + rimraf "^2.6.1" + semver "^5.3.0" + tar "^4.4.2" + node-releases@^1.1.52, node-releases@^1.1.60: version "1.1.60" resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.60.tgz#6948bdfce8286f0b5d0e5a88e8384e954dfe7084" @@ -8277,6 +8348,14 @@ node-sass@4.14.1: dependencies: abbrev "1" +nopt@^4.0.1: + version "4.0.3" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.3.tgz#a375cad9d02fd921278d954c2254d5aa57e15e48" + integrity sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg== + dependencies: + abbrev "1" + osenv "^0.1.4" + normalize-package-data@^2.3.2, normalize-package-data@^2.3.4: version "2.5.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" @@ -8331,6 +8410,27 @@ now-and-later@^2.0.0: dependencies: once "^1.3.2" +npm-bundled@^1.0.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.1.1.tgz#1edd570865a94cdb1bc8220775e29466c9fb234b" + integrity sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA== + dependencies: + npm-normalize-package-bin "^1.0.1" + +npm-normalize-package-bin@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz#6e79a41f23fd235c0623218228da7d9c23b8f6e2" + integrity sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA== + +npm-packlist@^1.1.6: + version "1.4.8" + resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.4.8.tgz#56ee6cc135b9f98ad3d51c1c95da22bbb9b2ef3e" + integrity sha512-5+AZgwru5IevF5ZdnFglB5wNlHG1AOOuw28WhUq8/8emhBmLv6jX5by4WJCh7lW0uSYZYS6DXqIsyZVIXRZU9A== + dependencies: + ignore-walk "^3.0.1" + npm-bundled "^1.0.1" + npm-normalize-package-bin "^1.0.1" + npm-run-path@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" @@ -8338,7 +8438,7 @@ npm-run-path@^2.0.0: dependencies: path-key "^2.0.0" -"npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.0: +"npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.0, npmlog@^4.0.2: version "4.1.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== @@ -8620,7 +8720,7 @@ os-tmpdir@^1.0.0, os-tmpdir@~1.0.2: resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= -osenv@0: +osenv@0, osenv@^0.1.4: version "0.1.5" resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== @@ -9990,6 +10090,16 @@ raw-body@2.4.0: iconv-lite "0.4.24" unpipe "1.0.0" +rc@^1.2.7: + version "1.2.8" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" + integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== + dependencies: + deep-extend "^0.6.0" + ini "~1.3.0" + minimist "^1.2.0" + strip-json-comments "~2.0.1" + react-app-polyfill@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/react-app-polyfill/-/react-app-polyfill-1.0.6.tgz#890f8d7f2842ce6073f030b117de9130a5f385f0" @@ -10730,7 +10840,7 @@ rgba-regex@^1.0.0: resolved "https://registry.yarnpkg.com/rgba-regex/-/rgba-regex-1.0.0.tgz#43374e2e2ca0968b0ef1523460b7d730ff22eeb3" integrity sha1-QzdOLiyglosO8VI0YLfXMP8i7rM= -rimraf@2, rimraf@^2.5.4, rimraf@^2.6.3, rimraf@^2.7.1: +rimraf@2, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.3, rimraf@^2.7.1: version "2.7.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== @@ -10919,7 +11029,7 @@ semver-greatest-satisfied-range@^1.1.0: dependencies: sver-compat "^1.5.0" -"semver@2 || 3 || 4 || 5", semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: +"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== @@ -11564,6 +11674,11 @@ strip-json-comments@^3.0.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== +strip-json-comments@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= + style-loader@0.23.1: version "0.23.1" resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-0.23.1.tgz#cb9154606f3e771ab6c4ab637026a1049174d925" @@ -11676,6 +11791,19 @@ tar@^2.0.0: fstream "^1.0.12" inherits "2" +tar@^4.4.2: + version "4.4.13" + resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525" + integrity sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA== + dependencies: + chownr "^1.1.1" + fs-minipass "^1.2.5" + minipass "^2.8.6" + minizlib "^1.2.1" + mkdirp "^0.5.0" + safe-buffer "^5.1.2" + yallist "^3.0.3" + terser-webpack-plugin@2.3.4: version "2.3.4" resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-2.3.4.tgz#ac045703bd8da0936ce910d8fb6350d0e1dee5fe" @@ -12818,7 +12946,7 @@ yallist@^2.1.2: resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= -yallist@^3.0.2: +yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3: version "3.1.1" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== From d84ee342f7f51939b9153c24ba7b57f715eb7889 Mon Sep 17 00:00:00 2001 From: William Harvey Date: Sun, 20 Sep 2020 13:15:28 -0400 Subject: [PATCH 02/24] structure backend folder and implement GreeterService --- .vscode/settings.json | 10 ++- README.md | 6 ++ backend/.gitignore | 3 +- backend/backend/__init__.py | 0 backend/{ => backend}/app.py | 7 +- backend/resampling.py | 140 --------------------------------- backend/setup.cfg | 4 + protos/install_grpc_plugins.sh | 4 +- web/src/index.js | 22 ++++++ 9 files changed, 46 insertions(+), 150 deletions(-) create mode 100644 backend/backend/__init__.py rename backend/{ => backend}/app.py (92%) delete mode 100644 backend/resampling.py create mode 100644 backend/setup.cfg diff --git a/.vscode/settings.json b/.vscode/settings.json index 6505efe4..2c445e4d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -23,8 +23,12 @@ "--grpc_python_out=backend/protos", "--plugin=protoc-gen-grpc_python=/usr/bin/grpc_python_plugin", "--js_out=web/src/protos", - "--plugin=protoc-gen-grpc_node=/usr/bin/grpc_node_plugin", - "--grpc_node_out=web/src/protos" + "--grpc_node_out=web/src/protos", + "--plugin=protoc-gen-grpc_node=/usr/bin/grpc_node_plugin" ] - } + }, + "python.linting.enabled": true, + "python.linting.flake8Enabled": true, + "python.formatting.provider": "autopep8", + "python.pythonPath": "backend/.venv/bin/python" } diff --git a/README.md b/README.md index 23f20e2b..b23e891f 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,12 @@ This projects aims to offer a comprehensive guide to **record polysomnographic EEG data from home** with an OpenBCI, a website to **upload sleep data** to our classifier and an **interactive visualisation** tool to observe the classified night of sleep. +## Requirements + ### GRPC and proto generation In order to be able to proceed to GRPC and proto generation, you need to run `sh ./install_grpc_plugins` under the protos/ folder. + +### Backend development + +You'll need install venv with `python -m pip install virtualenv`. Then you can create a virtual environment. Be sure that you link your venv `python` executable to your code editor/terminal. diff --git a/backend/.gitignore b/backend/.gitignore index 0cafc1cd..098e05e8 100644 --- a/backend/.gitignore +++ b/backend/.gitignore @@ -1 +1,2 @@ -.venv/ \ No newline at end of file +.venv/ +.vscode/ \ No newline at end of file diff --git a/backend/backend/__init__.py b/backend/backend/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/backend/app.py b/backend/backend/app.py similarity index 92% rename from backend/app.py rename to backend/backend/app.py index 626db06c..2471ef86 100644 --- a/backend/app.py +++ b/backend/backend/app.py @@ -18,12 +18,11 @@ import grpc -import backend.protos.helloworld_pb2 -import backend.protos.helloworld_pb2_grpc +from protos import helloworld_pb2 +from protos import helloworld_pb2_grpc class Greeter(helloworld_pb2_grpc.GreeterServicer): - def SayHello(self, request, context): return helloworld_pb2.HelloReply(message='Hello, %s!' % request.name) @@ -38,4 +37,4 @@ def serve(): if __name__ == '__main__': logging.basicConfig() - serve() \ No newline at end of file + serve() diff --git a/backend/resampling.py b/backend/resampling.py deleted file mode 100644 index d87c6702..00000000 --- a/backend/resampling.py +++ /dev/null @@ -1,140 +0,0 @@ -import numpy as np -import scipy -from scipy import signal -from scipy.interpolate import griddata -import copy -import pandas as pd -import math -import mne -from fractions import Fraction -import pandas_schema -from pandas_schema import Column -from pandas_schema.validation import CustomElementValidation -from decimal import Decimal, InvalidOperation - -SAMPLING_RATE = 100 - -def check_decimal(dec): - try: - Decimal(dec) - except InvalidOperation: - return False - return True - -def do_validation(data): - # define validation elements - decimal_validation = [CustomElementValidation(lambda d: check_decimal(d), 'is not decimal')] - null_validation = [CustomElementValidation(lambda d: d is not np.nan, 'this field cannot be null')] - - # define validation schema - schema = pandas_schema.Schema([ - Column('ch1', decimal_validation + null_validation), - Column('ch2', decimal_validation+ null_validation)]) - - # apply validation - errors = schema.validate(data) - errors_index_rows = [e.row for e in errors] - if len(errors)==0: - return True - else: - for e in range(0,len(errors_index_rows)): - print("Error on line ", errors[e].row, " for ",errors[e].column, " : ",errors[e].value, " ", errors[e].message) - return False - -def upsampling(ch_1, ch_2, up_factor, starting_s_rate): - npts = len(ch_1) #equal to len(ch_2) also - time = np.arange(0,npts)/starting_s_rate - - #Upsample by a factor - new_npts = npts * up_factor - - #New time vector after upsampling - new_up_time = np.arange(0,new_npts)/(up_factor*starting_s_rate) - new_up_time = new_up_time[new_up_time= 3) { + user = process.argv[2]; +} else { + user = 'world'; +} +request.setName(user); +client.sayHello(request, function (err, response) { + console.log('Greeting:', response.getMessage()); +}); + +// -------------- + ReactDOM.render( From e5fd9532e0a6fcfefc07ce00540ca6b66001e720 Mon Sep 17 00:00:00 2001 From: William Harvey Date: Mon, 21 Sep 2020 17:52:34 -0400 Subject: [PATCH 03/24] Add grpc-web to web/ --- .vscode/settings.json | 12 +- README.md | 2 +- backend/.gitignore | 3 +- backend/Dockerfile | 25 +- backend/backend/app.py | 2 +- backend/envoy.yaml | 28 +++ mobile/lib/main.dart | 21 +- mobile/pubspec.lock | 42 ++++ mobile/pubspec.yaml | 1 + protos/install_grpc_plugins.sh | 15 +- web/.env | 1 + web/Dockerfile | 14 -- web/package.json | 9 +- web/src/index.js | 27 +-- web/yarn.lock | 414 +++++++++++++++++++++------------ 15 files changed, 412 insertions(+), 204 deletions(-) create mode 100644 backend/envoy.yaml create mode 100644 web/.env delete mode 100644 web/Dockerfile diff --git a/.vscode/settings.json b/.vscode/settings.json index 2c445e4d..ce941e0d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -17,14 +17,12 @@ "protoc": { "compile_on_save": true, "options": [ - "--proto_path=protos", - "--dart_out=mobile/lib/protos", - "--python_out=backend/protos", - "--grpc_python_out=backend/protos", + "--dart_out=mobile/lib", + "--python_out=backend", + "--grpc_python_out=backend", "--plugin=protoc-gen-grpc_python=/usr/bin/grpc_python_plugin", - "--js_out=web/src/protos", - "--grpc_node_out=web/src/protos", - "--plugin=protoc-gen-grpc_node=/usr/bin/grpc_node_plugin" + "--js_out=import_style=commonjs:web/src", + "--grpc-web_out=import_style=commonjs,mode=grpcwebtext:web/src" ] }, "python.linting.enabled": true, diff --git a/README.md b/README.md index b23e891f..e451af06 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This projects aims to offer a comprehensive guide to **record polysomnographic E ### GRPC and proto generation -In order to be able to proceed to GRPC and proto generation, you need to run `sh ./install_grpc_plugins` under the protos/ folder. +In order to be able to proceed to GRPC and proto generation, you need to run `sh ./install_grpc_python_plugin` under the protos/ folder. ### Backend development diff --git a/backend/.gitignore b/backend/.gitignore index 098e05e8..93163afa 100644 --- a/backend/.gitignore +++ b/backend/.gitignore @@ -1,2 +1,3 @@ .venv/ -.vscode/ \ No newline at end of file +.vscode/ +__pycache__/ diff --git a/backend/Dockerfile b/backend/Dockerfile index 97c0b228..10de4d95 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,11 +1,16 @@ -FROM namely/protoc-all as generator -WORKDIR / -COPY protos protos -COPY backend backend -RUN protoc --proto_path=protos protos/* --python_out=backend/protos +# FROM namely/protoc-all as generator +# WORKDIR / +# COPY protos protos +# COPY backend backend +# RUN protoc --proto_path=protos protos/* --python_out=backend/protos -FROM python -COPY --from=generator /backend /backend -WORKDIR /backend -RUN pip install -r requirements.txt --no-cache-dir -ENTRYPOINT ["python", "app.py"] +# FROM python +# COPY --from=generator /backend /backend +# WORKDIR /backend +# RUN pip install -r requirements.txt --no-cache-dir +# ENTRYPOINT ["python", "app.py"] + +# Need to run in order for grpc-web to communicate with server. +FROM envoyproxy/envoy:v1.14.4 +COPY ./envoy.yaml /etc/envoy/envoy.yaml +CMD /usr/local/bin/envoy -c /etc/envoy/envoy.yaml diff --git a/backend/backend/app.py b/backend/backend/app.py index 2471ef86..508486f9 100644 --- a/backend/backend/app.py +++ b/backend/backend/app.py @@ -30,7 +30,7 @@ def SayHello(self, request, context): def serve(): server = grpc.server(futures.ThreadPoolExecutor(max_workers=10)) helloworld_pb2_grpc.add_GreeterServicer_to_server(Greeter(), server) - server.add_insecure_port('[::]:50051') + server.add_insecure_port('[::]:9090') server.start() server.wait_for_termination() diff --git a/backend/envoy.yaml b/backend/envoy.yaml new file mode 100644 index 00000000..9173c63b --- /dev/null +++ b/backend/envoy.yaml @@ -0,0 +1,28 @@ +listeners: + - name: listener_0 + address: + socket_address: { address: 0.0.0.0, port_value: 8080 } + filter_chains: + - filters: + - name: envoy.http_connection_manager + config: + codec_type: auto + stat_prefix: ingress_http + route_config: + name: local_route + virtual_hosts: + - name: local_service + domains: ["*"] + routes: + - match: { prefix: "/" } + route: { cluster: echo_service } + http_filters: + - name: envoy.grpc_web + - name: envoy.router + clusters: + - name: echo_service + connect_timeout: 0.25s + type: logical_dns + http2_protocol_options: {} + lb_policy: round_robin + hosts: [{ socket_address: { address: node-server, port_value: 9090 }}] \ No newline at end of file diff --git a/mobile/lib/main.dart b/mobile/lib/main.dart index 11655b66..99f285f3 100644 --- a/mobile/lib/main.dart +++ b/mobile/lib/main.dart @@ -1,6 +1,25 @@ +import 'package:grpc/grpc.dart'; import 'package:flutter/material.dart'; -void main() { +import 'protos/helloworld.pb.dart'; + +void main() async { + // GRPC TEST + final channel = ClientChannel( + 'localhost', + port: 9090, + options: const ChannelOptions(credentials: ChannelCredentials.insecure()), + ); + final stub = GreeterClient(channel); + + try { + var response = await stub.sayHello(HelloRequest()..name = 'world'); + print('Greeter client received: ${response.message}'); + } catch (e) { + print('Caught error: $e'); + } + await channel.shutdown(); + // END OF TEST runApp(MyApp()); } diff --git a/mobile/pubspec.lock b/mobile/pubspec.lock index 6be43335..77a4dcc1 100644 --- a/mobile/pubspec.lock +++ b/mobile/pubspec.lock @@ -137,6 +137,20 @@ packages: description: flutter source: sdk version: "0.0.0" + googleapis_auth: + dependency: transitive + description: + name: googleapis_auth + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.12" + grpc: + dependency: "direct main" + description: + name: grpc + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.0" hive: dependency: "direct main" description: @@ -144,6 +158,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.4.4" + http: + dependency: transitive + description: + name: http + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.2" + http2: + dependency: transitive + description: + name: http2 + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" + http_parser: + dependency: transitive + description: + name: http_parser + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.4" matcher: dependency: transitive description: @@ -179,6 +214,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.0-nullsafety" + pedantic: + dependency: transitive + description: + name: pedantic + url: "https://pub.dartlang.org" + source: hosted + version: "1.9.2" plugin_platform_interface: dependency: transitive description: diff --git a/mobile/pubspec.yaml b/mobile/pubspec.yaml index 5409c88d..f0700ce0 100644 --- a/mobile/pubspec.yaml +++ b/mobile/pubspec.yaml @@ -28,6 +28,7 @@ dependencies: # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^0.1.3 protobuf: ^1.0.1 + grpc: ^2.3.0 hive: ^1.4.4 usb_serial: ^0.2.4 flutter_blue: ^0.7.2 diff --git a/protos/install_grpc_plugins.sh b/protos/install_grpc_plugins.sh index d625dd1d..3e62eb0c 100644 --- a/protos/install_grpc_plugins.sh +++ b/protos/install_grpc_plugins.sh @@ -1,7 +1,16 @@ echo "This script install grpc_python_plugin from source because of this https://github.com/grpc/grpc/issues/15675#issuecomment-397038811" -echo "It also install grpc_node_plugin from source. We prefer static generation over dynamic for nodejs" git clone --recursive https://github.com/grpc/grpc -cd grpc && make grpc_python_plugin -j 4 && make grpc_node_plugin -j 4 +cd grpc && make grpc_python_plugin -j 4 sudo mv bins/opt/grpc_python_plugin /usr/bin -sudo mv bins/opt/grpc_node_plugin /usr/bin cd .. && sudo rm -r grpc/ + +# See https://github.com/grpc/grpc-web/releases for other releases +# LINUX +wget -O protoc-gen-grpc-web "https://github.com/grpc/grpc-web/releases/download/1.2.1/protoc-gen-grpc-web-1.2.1-linux-x86_64" +sudo mv protoc-gen-grpc-web /usr/bin + +# MAC +# wget -O protoc-gen-grpc-web https://github.com/grpc/grpc-web/releases/download/1.2.1/protoc-gen-grpc-web-1.2.1-darwin-x86_64 +# sudo mv protoc-gen-grpc-web /usr/bin + +chmod +x /usr/bin/protoc-gen-grpc-web diff --git a/web/.env b/web/.env new file mode 100644 index 00000000..3ccb8fff --- /dev/null +++ b/web/.env @@ -0,0 +1 @@ +EXTEND_ESLINT=true \ No newline at end of file diff --git a/web/Dockerfile b/web/Dockerfile deleted file mode 100644 index e4008934..00000000 --- a/web/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM namely/protoc-all as generator -WORKDIR / -COPY protos protos -COPY web web -RUN protoc --proto_path=protos protos/* --js_out=web/src/protos - -FROM node:14 as builder -COPY --from=generator /web /web -WORKDIR /web -RUN yarn install -RUN yarn build - -FROM nginx:alpine -COPY --from=builder /web/build/ /usr/share/nginx/html diff --git a/web/package.json b/web/package.json index 8a0fc6a9..d7618cfb 100644 --- a/web/package.json +++ b/web/package.json @@ -14,7 +14,10 @@ "format": "yarn prettier --config ../.vscode/.prettierrc.yaml --write \"./**/*.{js,jsx,css,scss,json}\"" }, "eslintConfig": { - "extends": "react-app" + "extends": "react-app", + "ignorePatterns": [ + "**/*_pb.js" + ] }, "browserslist": [ ">0.2%", @@ -23,11 +26,15 @@ "not op_mini all" ], "dependencies": { + "@grpc/grpc-js": "^1.1.7", + "@grpc/proto-loader": "^0.5.5", "argon-design-system-react": "^1.1.0", "bootstrap": "^4.5.0", "classnames": "2.2.6", "d3": "^5.16.0", "d3-tip": "^0.9.1", + "google-protobuf": "^3.13.0", + "grpc-web": "^1.2.1", "headroom.js": "^0.11.0", "moment": "^2.27.0", "node-sass": "4.14.1", diff --git a/web/src/index.js b/web/src/index.js index 788a72a0..a349d885 100644 --- a/web/src/index.js +++ b/web/src/index.js @@ -12,27 +12,16 @@ import Performance from 'views/performance/performance'; import ScrollToTop from 'components/scroll_to_top'; import Emoji from 'components/emoji'; -// -------------- -var messages = require('./helloworld_pb'); -var services = require('./helloworld_grpc_pb'); +// GRPC TEST +import {HelloRequest, HelloReply} from 'protos/helloworld_pb'; +import {GreeterClient} from 'protos/helloworld_grpc_web_pb'; -var grpc = require('grpc'); - -var client = new services.GreeterClient('localhost:50051', grpc.credentials.createInsecure()); -var request = new messages.HelloRequest(); -var user; -if (process.argv.length >= 3) { - user = process.argv[2]; -} else { - user = 'world'; -} -request.setName(user); -client.sayHello(request, function (err, response) { - console.log('Greeting:', response.getMessage()); -}); - -// -------------- +const client = new GreeterClient('http://localhost:8080'); +const request = new HelloRequest(); +request.setName('World'); +client.sayHello(request, {}, (err, response) => console.log(response.getMessage())); +// END OF TEST ReactDOM.render( diff --git a/web/yarn.lock b/web/yarn.lock index 203ca29f..f1c079cc 100644 --- a/web/yarn.lock +++ b/web/yarn.lock @@ -1179,6 +1179,35 @@ resolved "https://registry.yarnpkg.com/@csstools/normalize.css/-/normalize.css-10.1.0.tgz#f0950bba18819512d42f7197e56c518aa491cf18" integrity sha512-ij4wRiunFfaJxjB0BdrYHIH8FxBJpOwNPhhAcunlmPdXudL1WQV1qoP9un6JsEBAgQH+7UXyyjh0g7jTxXK6tg== +"@grpc/grpc-js@^1.1.7": + version "1.1.7" + resolved "https://registry.yarnpkg.com/@grpc/grpc-js/-/grpc-js-1.1.7.tgz#d3d71c6da95397e2d63895ccc4a05e7572f7b7e6" + integrity sha512-EuxMstI0u778dp0nk6Fe3gHXYPeV6FYsWOe0/QFwxv1NQ6bc5Wl/0Yxa4xl9uBlKElL6AIxuASmSfu7KEJhqiw== + dependencies: + "@grpc/proto-loader" "^0.6.0-pre14" + "@types/node" "^12.12.47" + google-auth-library "^6.0.0" + semver "^6.2.0" + +"@grpc/proto-loader@^0.5.5": + version "0.5.5" + resolved "https://registry.yarnpkg.com/@grpc/proto-loader/-/proto-loader-0.5.5.tgz#6725e7a1827bdf8e92e29fbf4e9ef0203c0906a9" + integrity sha512-WwN9jVNdHRQoOBo9FDH7qU+mgfjPc8GygPYms3M+y3fbQLfnCe/Kv/E01t7JRgnrsOHH8euvSbed3mIalXhwqQ== + dependencies: + lodash.camelcase "^4.3.0" + protobufjs "^6.8.6" + +"@grpc/proto-loader@^0.6.0-pre14": + version "0.6.0-pre9" + resolved "https://registry.yarnpkg.com/@grpc/proto-loader/-/proto-loader-0.6.0-pre9.tgz#0c6fe42f6c5ef9ce1b3cef7be64d5b09d6fe4d6d" + integrity sha512-oM+LjpEjNzW5pNJjt4/hq1HYayNeQT+eGrOPABJnYHv7TyNPDNzkQ76rDYZF86X5swJOa4EujEMzQ9iiTdPgww== + dependencies: + "@types/long" "^4.0.1" + lodash.camelcase "^4.3.0" + long "^4.0.0" + protobufjs "^6.9.0" + yargs "^15.3.1" + "@hapi/address@2.x.x": version "2.1.4" resolved "https://registry.yarnpkg.com/@hapi/address/-/address-2.1.4.tgz#5d67ed43f3fd41a69d4b9ff7b56e7c0d1d0a81e5" @@ -1643,10 +1672,15 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-14.6.3.tgz#cc4f979548ca4d8e7b90bc0180052ab99ee64224" integrity sha512-pC/hkcREG6YfDfui1FBmj8e20jFU5Exjw4NYDm8kEdrW+mOh0T1Zve8DWKnS7ZIZvgncrctcNCXF4Q2I+loyww== +"@types/node@^12.12.47": + version "12.12.62" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.62.tgz#733923d73669188d35950253dd18a21570085d2b" + integrity sha512-qAfo81CsD7yQIM9mVyh6B/U47li5g7cfpVQEDMfQeF8pSZVwzbhwU3crc0qG4DmpsebpJPR49AKOExQyJ05Cpg== + "@types/node@^13.7.0": - version "13.13.16" - resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.16.tgz#66f2177047b61131eaac18c47eb25d6f1317070a" - integrity sha512-dJ9vXxJ8MEwzNn4GkoAGauejhXoKuJyYKegsA6Af25ZpEDXomeVXt5HUWUNVHk5UN7+U0f6ghC6otwt+7PdSDg== + version "13.13.21" + resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.21.tgz#e48d3c2e266253405cf404c8654d1bcf0d333e5c" + integrity sha512-tlFWakSzBITITJSxHV4hg4KvrhR/7h3xbJdSFbYJBVzKubrASbnnIFuSgolUh7qKGo/ZeJPKUfbZ0WS6Jp14DQ== "@types/parse-json@^4.0.0": version "4.0.0" @@ -1897,6 +1931,13 @@ abbrev@1: resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== +abort-controller@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" + integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== + dependencies: + event-target-shim "^5.0.0" + accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.7: version "1.3.7" resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd" @@ -1954,6 +1995,13 @@ adjust-sourcemap-loader@2.0.0: object-path "0.11.4" regex-parser "2.2.10" +agent-base@6: + version "6.0.1" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.1.tgz#808007e4e5867decb0ab6ab2f928fbdb5a596db4" + integrity sha512-01q25QQDwLSsyfhrKbn8yuur+JNw0H+0Y4JiGIKd3z9aYk/w/2kxD/Upc+t2ZBBSUNff50VjPsSW2YxM8QYKVg== + dependencies: + debug "4" + aggregate-error@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.1.0.tgz#92670ff50f5359bdb7a3e0d40d0ec30c5737687a" @@ -2060,7 +2108,7 @@ ansi-styles@^3.2.0, ansi-styles@^3.2.1: dependencies: color-convert "^1.9.0" -ansi-styles@^4.1.0: +ansi-styles@^4.0.0, ansi-styles@^4.1.0: version "4.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.1.tgz#90ae75c424d008d2624c5bf29ead3177ebfcf359" integrity sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA== @@ -2275,6 +2323,11 @@ arrify@^1.0.1: resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0= +arrify@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa" + integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug== + asap@~2.0.3, asap@~2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" @@ -2578,7 +2631,7 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= -base64-js@^1.0.2: +base64-js@^1.0.2, base64-js@^1.3.0: version "1.3.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.1.tgz#58ece8cb75dd07e71ed08c736abc5fac4dbf8df1" integrity sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g== @@ -2613,6 +2666,11 @@ big.js@^5.2.2: resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328" integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ== +bignumber.js@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.0.0.tgz#805880f84a329b5eac6e7cb6f8274b6d82bdf075" + integrity sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A== + binary-extensions@^1.0.0: version "1.13.1" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.13.1.tgz#598afe54755b2868a5330d2aff9d4ebb53209b65" @@ -2831,6 +2889,11 @@ bser@2.1.1: dependencies: node-int64 "^0.4.0" +buffer-equal-constant-time@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819" + integrity sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk= + buffer-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/buffer-equal/-/buffer-equal-1.0.0.tgz#59616b498304d556abd466966b22eeda3eca5fbe" @@ -3195,6 +3258,15 @@ cliui@^5.0.0: strip-ansi "^5.2.0" wrap-ansi "^5.1.0" +cliui@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1" + integrity sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.0" + wrap-ansi "^6.2.0" + clone-buffer@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/clone-buffer/-/clone-buffer-1.0.0.tgz#e3e25b207ac4e701af721e2cb5a16792cac3dc58" @@ -4160,7 +4232,14 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.9: dependencies: ms "2.0.0" -debug@^3.1.1, debug@^3.2.5, debug@^3.2.6: +debug@4: + version "4.2.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.2.0.tgz#7f150f93920e94c58f5574c2fd01a3110effe7f1" + integrity sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg== + dependencies: + ms "2.1.2" + +debug@^3.1.1, debug@^3.2.5: version "3.2.6" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== @@ -4196,11 +4275,6 @@ deep-equal@^1.0.1, deep-equal@^1.1.1: object-keys "^1.1.1" regexp.prototype.flags "^1.2.0" -deep-extend@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" - integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== - deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" @@ -4301,11 +4375,6 @@ detect-file@^1.0.0: resolved "https://registry.yarnpkg.com/detect-file/-/detect-file-1.0.0.tgz#f0d66d03672a825cb1b73bdb3fe62310c8e552b7" integrity sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc= -detect-libc@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" - integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= - detect-newline@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-2.1.0.tgz#f41f1c10be4b00e87b5f13da680759f2c5bfd3e2" @@ -4511,6 +4580,13 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" +ecdsa-sig-formatter@1.0.11, ecdsa-sig-formatter@^1.0.11: + version "1.0.11" + resolved "https://registry.yarnpkg.com/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz#ae0f0fa2d85045ef14a817daa3ce9acd0489e5bf" + integrity sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ== + dependencies: + safe-buffer "^5.0.1" + ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" @@ -4927,6 +5003,11 @@ etag@~1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= +event-target-shim@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" + integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== + eventemitter3@^4.0.0: version "4.0.7" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" @@ -5065,7 +5146,7 @@ extend-shallow@^3.0.0, extend-shallow@^3.0.2: assign-symbols "^1.0.0" is-extendable "^1.0.1" -extend@^3.0.0, extend@~3.0.2: +extend@^3.0.0, extend@^3.0.2, extend@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== @@ -5145,6 +5226,11 @@ fast-levenshtein@~2.0.6: resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= +fast-text-encoding@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/fast-text-encoding/-/fast-text-encoding-1.0.3.tgz#ec02ac8e01ab8a319af182dae2681213cfe9ce53" + integrity sha512-dtm4QZH9nZtcDt8qJiOH9fcQd1NAgi+K1O2DbE6GG1PPCK/BWfOH3idCTRQ4ImXRUOyopDEgDEnVEE7Y/2Wrig== + faye-websocket@^0.10.0: version "0.10.0" resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.10.0.tgz#4e492f8d04dfb6f89003507f6edbf2d501e7c6f4" @@ -5273,7 +5359,7 @@ find-cache-dir@^3.2.0: make-dir "^3.0.2" pkg-dir "^4.1.0" -find-up@4.1.0, find-up@^4.0.0: +find-up@4.1.0, find-up@^4.0.0, find-up@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== @@ -5475,13 +5561,6 @@ fs-extra@^8.1.0: jsonfile "^4.0.0" universalify "^0.1.0" -fs-minipass@^1.2.5: - version "1.2.7" - resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7" - integrity sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA== - dependencies: - minipass "^2.6.0" - fs-minipass@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-2.1.0.tgz#7f5036fdbf12c63c169190cbe4199c852271f9fb" @@ -5564,6 +5643,17 @@ gauge@~2.7.3: strip-ansi "^3.0.1" wide-align "^1.1.0" +gaxios@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/gaxios/-/gaxios-3.2.0.tgz#11b6f0e8fb08d94a10d4d58b044ad3bec6dd486a" + integrity sha512-+6WPeVzPvOshftpxJwRi2Ozez80tn/hdtOUag7+gajDHRJvAblKxTFSSMPtr2hmnLy7p0mvYz0rMXLBl8pSO7Q== + dependencies: + abort-controller "^3.0.0" + extend "^3.0.2" + https-proxy-agent "^5.0.0" + is-stream "^2.0.0" + node-fetch "^2.3.0" + gaze@^1.0.0: version "1.1.3" resolved "https://registry.yarnpkg.com/gaze/-/gaze-1.1.3.tgz#c441733e13b927ac8c0ff0b4c3b033f28812924a" @@ -5571,6 +5661,14 @@ gaze@^1.0.0: dependencies: globule "^1.0.0" +gcp-metadata@^4.1.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/gcp-metadata/-/gcp-metadata-4.2.0.tgz#3b424355ccdc240ee07c5791e2fd6a60a283d89a" + integrity sha512-vQZD57cQkqIA6YPGXM/zc+PIZfNRFdukWGsGZ5+LcJzesi5xp6Gn7a02wRJi4eXPyArNMIYpPET4QMxGqtlk6Q== + dependencies: + gaxios "^3.0.0" + json-bigint "^1.0.0" + gensync@^1.0.0-beta.1: version "1.0.0-beta.1" resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.1.tgz#58f4361ff987e5ff6e1e7a210827aa371eaac269" @@ -5764,6 +5862,33 @@ glogg@^1.0.0: dependencies: sparkles "^1.0.0" +google-auth-library@^6.0.0: + version "6.0.6" + resolved "https://registry.yarnpkg.com/google-auth-library/-/google-auth-library-6.0.6.tgz#5102e5c643baab45b4c16e9752cd56b8861f3a82" + integrity sha512-fWYdRdg55HSJoRq9k568jJA1lrhg9i2xgfhVIMJbskUmbDpJGHsbv9l41DGhCDXM21F9Kn4kUwdysgxSYBYJUw== + dependencies: + arrify "^2.0.0" + base64-js "^1.3.0" + ecdsa-sig-formatter "^1.0.11" + fast-text-encoding "^1.0.0" + gaxios "^3.0.0" + gcp-metadata "^4.1.0" + gtoken "^5.0.0" + jws "^4.0.0" + lru-cache "^6.0.0" + +google-p12-pem@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/google-p12-pem/-/google-p12-pem-3.0.3.tgz#673ac3a75d3903a87f05878f3c75e06fc151669e" + integrity sha512-wS0ek4ZtFx/ACKYF3JhyGe5kzH7pgiQ7J5otlumqR9psmWMYc+U9cErKlCYVYHoUaidXHdZ2xbo34kB+S+24hA== + dependencies: + node-forge "^0.10.0" + +google-protobuf@^3.13.0: + version "3.13.0" + resolved "https://registry.yarnpkg.com/google-protobuf/-/google-protobuf-3.13.0.tgz#909c5983d75dd6101ed57c79e0528d000cdc3251" + integrity sha512-ZIf3qfLFayVrPvAjeKKxO5FRF1/NwRxt6Dko+fWEMuHwHbZx8/fcaAao9b0wCM6kr8qeg2te8XTpyuvKuD9aKw== + graceful-fs@^4.0.0, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.2: version "4.2.4" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" @@ -5774,12 +5899,20 @@ growly@^1.3.0: resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= -grpc-tools@1.9.1: - version "1.9.1" - resolved "https://registry.yarnpkg.com/grpc-tools/-/grpc-tools-1.9.1.tgz#e43be478860a21781ce9a535647985cd365b1e06" - integrity sha512-t2JFMPLjxcgwVSJwFEauFaoEiO56kijxSwehQDgZNR/hrStJCH0pHGsjqJNuCOvmI9Z31pYOfgj4zeInTQWh5A== +grpc-web@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/grpc-web/-/grpc-web-1.2.1.tgz#860051d705bf5baa7b81fcbd14030060bf16b7b9" + integrity sha512-ibBaJPzfMVuLPgaST9w0kZl60s+SnkPBQp6QKdpEr85tpc1gXW2QDqSne9xiyiym0logDfdUSm4aX5h9YBA2mw== + +gtoken@^5.0.0: + version "5.0.3" + resolved "https://registry.yarnpkg.com/gtoken/-/gtoken-5.0.3.tgz#b76ef8e9a2fed6fef165e47f7d05b60c498e4d05" + integrity sha512-Nyd1wZCMRc2dj/mAD0LlfQLcAO06uKdpKJXvK85SGrF5+5+Bpfil9u/2aw35ltvEHjvl0h5FMKN5knEU+9JrOg== dependencies: - node-pre-gyp "^0.15.0" + gaxios "^3.0.0" + google-p12-pem "^3.0.0" + jws "^4.0.0" + mime "^2.2.0" gud@^1.0.0: version "1.0.0" @@ -6158,7 +6291,15 @@ https-browserify@^1.0.0: resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM= -iconv-lite@0.4, iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4: +https-proxy-agent@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz#e2a90542abb68a762e0a0850f6c9edadfd8506b2" + integrity sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA== + dependencies: + agent-base "6" + debug "4" + +iconv-lite@0.4, iconv-lite@0.4.24, iconv-lite@^0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== @@ -6196,13 +6337,6 @@ iferr@^0.1.5: resolved "https://registry.yarnpkg.com/iferr/-/iferr-0.1.5.tgz#c60eed69e6d8fdb6b3104a1fcbca1c192dc5b501" integrity sha1-xg7taebY/bazEEofy8ocGS3FtQE= -ignore-walk@^3.0.1: - version "3.0.3" - resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.3.tgz#017e2447184bfeade7c238e4aefdd1e8f95b1e37" - integrity sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw== - dependencies: - minimatch "^3.0.4" - ignore@^3.3.5: version "3.3.10" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" @@ -6311,7 +6445,7 @@ inherits@2.0.3: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= -ini@^1.3.4, ini@^1.3.5, ini@~1.3.0: +ini@^1.3.4, ini@^1.3.5: version "1.3.5" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== @@ -6691,6 +6825,11 @@ is-stream@^1.0.1, is-stream@^1.1.0: resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= +is-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3" + integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw== + is-string@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.5.tgz#40493ed198ef3ff477b8c7f92f644ec82a5cd3a6" @@ -7323,6 +7462,13 @@ jsesc@~0.5.0: resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" integrity sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0= +json-bigint@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/json-bigint/-/json-bigint-1.0.0.tgz#ae547823ac0cad8398667f8cd9ef4730f5b01ff1" + integrity sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ== + dependencies: + bignumber.js "^9.0.0" + json-parse-better-errors@^1.0.1, json-parse-better-errors@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" @@ -7414,6 +7560,23 @@ just-debounce@^1.0.0: resolved "https://registry.yarnpkg.com/just-debounce/-/just-debounce-1.0.0.tgz#87fccfaeffc0b68cd19d55f6722943f929ea35ea" integrity sha1-h/zPrv/AtozRnVX2cilD+SnqNeo= +jwa@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/jwa/-/jwa-2.0.0.tgz#a7e9c3f29dae94027ebcaf49975c9345593410fc" + integrity sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA== + dependencies: + buffer-equal-constant-time "1.0.1" + ecdsa-sig-formatter "1.0.11" + safe-buffer "^5.0.1" + +jws@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jws/-/jws-4.0.0.tgz#2d4e8cf6a318ffaa12615e9dec7e86e6c97310f4" + integrity sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg== + dependencies: + jwa "^2.0.0" + safe-buffer "^5.0.1" + killable@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/killable/-/killable-1.0.1.tgz#4c8ce441187a061c7474fb87ca08e2a638194892" @@ -7643,6 +7806,11 @@ lodash._reinterpolate@^3.0.0: resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0= +lodash.camelcase@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" + integrity sha1-soqmKIorn8ZRA1x3EfZathkDMaY= + lodash.memoize@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" @@ -7725,6 +7893,13 @@ lru-cache@^5.1.1: dependencies: yallist "^3.0.2" +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + make-dir@^2.0.0, make-dir@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" @@ -7936,7 +8111,7 @@ mime@1.6.0: resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== -mime@^2.4.4: +mime@^2.2.0, mime@^2.4.4: version "2.4.6" resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.6.tgz#e5b407c90db442f2beb5b162373d07b69affa4d1" integrity sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA== @@ -8008,14 +8183,6 @@ minipass-pipeline@^1.2.2: dependencies: minipass "^3.0.0" -minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0: - version "2.9.0" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6" - integrity sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg== - dependencies: - safe-buffer "^5.1.2" - yallist "^3.0.0" - minipass@^3.0.0, minipass@^3.1.1: version "3.1.3" resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.1.3.tgz#7d42ff1f39635482e15f9cdb53184deebd5815fd" @@ -8023,13 +8190,6 @@ minipass@^3.0.0, minipass@^3.1.1: dependencies: yallist "^4.0.0" -minizlib@^1.2.1: - version "1.3.3" - resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d" - integrity sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q== - dependencies: - minipass "^2.9.0" - mississippi@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/mississippi/-/mississippi-3.0.0.tgz#ea0a3291f97e0b5e8776b363d5f0a12d94c67022" @@ -8062,7 +8222,7 @@ mixin-object@^2.0.1: for-in "^0.1.3" is-extendable "^0.1.1" -"mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@^0.5.5, mkdirp@~0.5.1: +"mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@^0.5.5, mkdirp@~0.5.1: version "0.5.5" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== @@ -8101,7 +8261,7 @@ ms@2.1.1: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== -ms@^2.1.1: +ms@2.1.2, ms@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== @@ -8156,15 +8316,6 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= -needle@^2.5.0: - version "2.5.2" - resolved "https://registry.yarnpkg.com/needle/-/needle-2.5.2.tgz#cf1a8fce382b5a280108bba90a14993c00e4010a" - integrity sha512-LbRIwS9BfkPvNwNHlsA41Q29kL2L/6VaOJ0qisM5lLWsTV3nP15abO5ITL6L81zqFhzjRKDAYjpcBcwM0AVvLQ== - dependencies: - debug "^3.2.6" - iconv-lite "^0.4.4" - sax "^1.2.4" - negotiator@0.6.2: version "0.6.2" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb" @@ -8201,11 +8352,21 @@ node-fetch@^1.0.1: encoding "^0.1.11" is-stream "^1.0.1" +node-fetch@^2.3.0: + version "2.6.1" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" + integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== + node-forge@0.9.0: version "0.9.0" resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.9.0.tgz#d624050edbb44874adca12bb9a52ec63cb782579" integrity sha512-7ASaDa3pD+lJ3WvXFsxekJQelBKRpne+GOVbLbtHYdd7pFspyeuJHnWfLplGf3SwKGbfs/aYl5V/JCIaHVUKKQ== +node-forge@^0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.10.0.tgz#32dea2afb3e9926f02ee5ce8794902691a676bf3" + integrity sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA== + node-gyp@^3.8.0: version "3.8.0" resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-3.8.0.tgz#540304261c330e80d0d5edce253a68cb3964218c" @@ -8274,22 +8435,6 @@ node-notifier@^5.4.2: shellwords "^0.1.1" which "^1.3.0" -node-pre-gyp@^0.15.0: - version "0.15.0" - resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.15.0.tgz#c2fc383276b74c7ffa842925241553e8b40f1087" - integrity sha512-7QcZa8/fpaU/BKenjcaeFF9hLz2+7S9AqyXFhlH/rilsQ/hPZKK32RtR5EQHJElgu+q5RfbJ34KriI79UWaorA== - dependencies: - detect-libc "^1.0.2" - mkdirp "^0.5.3" - needle "^2.5.0" - nopt "^4.0.1" - npm-packlist "^1.1.6" - npmlog "^4.0.2" - rc "^1.2.7" - rimraf "^2.6.1" - semver "^5.3.0" - tar "^4.4.2" - node-releases@^1.1.52, node-releases@^1.1.60: version "1.1.60" resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.60.tgz#6948bdfce8286f0b5d0e5a88e8384e954dfe7084" @@ -8348,14 +8493,6 @@ node-sass@4.14.1: dependencies: abbrev "1" -nopt@^4.0.1: - version "4.0.3" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.3.tgz#a375cad9d02fd921278d954c2254d5aa57e15e48" - integrity sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg== - dependencies: - abbrev "1" - osenv "^0.1.4" - normalize-package-data@^2.3.2, normalize-package-data@^2.3.4: version "2.5.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" @@ -8410,27 +8547,6 @@ now-and-later@^2.0.0: dependencies: once "^1.3.2" -npm-bundled@^1.0.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.1.1.tgz#1edd570865a94cdb1bc8220775e29466c9fb234b" - integrity sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA== - dependencies: - npm-normalize-package-bin "^1.0.1" - -npm-normalize-package-bin@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz#6e79a41f23fd235c0623218228da7d9c23b8f6e2" - integrity sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA== - -npm-packlist@^1.1.6: - version "1.4.8" - resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.4.8.tgz#56ee6cc135b9f98ad3d51c1c95da22bbb9b2ef3e" - integrity sha512-5+AZgwru5IevF5ZdnFglB5wNlHG1AOOuw28WhUq8/8emhBmLv6jX5by4WJCh7lW0uSYZYS6DXqIsyZVIXRZU9A== - dependencies: - ignore-walk "^3.0.1" - npm-bundled "^1.0.1" - npm-normalize-package-bin "^1.0.1" - npm-run-path@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" @@ -8438,7 +8554,7 @@ npm-run-path@^2.0.0: dependencies: path-key "^2.0.0" -"npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.0, npmlog@^4.0.2: +"npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.0: version "4.1.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== @@ -8720,7 +8836,7 @@ os-tmpdir@^1.0.0, os-tmpdir@~1.0.2: resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= -osenv@0, osenv@^0.1.4: +osenv@0: version "0.1.5" resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== @@ -9921,7 +10037,7 @@ prop-types@^15.0.0, prop-types@^15.5.7, prop-types@^15.5.8, prop-types@^15.6.1, object-assign "^4.1.1" react-is "^16.8.1" -protobufjs@^6.10.1: +protobufjs@^6.8.6, protobufjs@^6.9.0: version "6.10.1" resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.10.1.tgz#e6a484dd8f04b29629e9053344e3970cccf13cd2" integrity sha512-pb8kTchL+1Ceg4lFd5XUpK8PdWacbvV5SK2ULH2ebrYtl4GjJmS24m6CKME67jzV53tbJxHlnNOSqQHbTsR9JQ== @@ -10090,16 +10206,6 @@ raw-body@2.4.0: iconv-lite "0.4.24" unpipe "1.0.0" -rc@^1.2.7: - version "1.2.8" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" - integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== - dependencies: - deep-extend "^0.6.0" - ini "~1.3.0" - minimist "^1.2.0" - strip-json-comments "~2.0.1" - react-app-polyfill@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/react-app-polyfill/-/react-app-polyfill-1.0.6.tgz#890f8d7f2842ce6073f030b117de9130a5f385f0" @@ -10840,7 +10946,7 @@ rgba-regex@^1.0.0: resolved "https://registry.yarnpkg.com/rgba-regex/-/rgba-regex-1.0.0.tgz#43374e2e2ca0968b0ef1523460b7d730ff22eeb3" integrity sha1-QzdOLiyglosO8VI0YLfXMP8i7rM= -rimraf@2, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.3, rimraf@^2.7.1: +rimraf@2, rimraf@^2.5.4, rimraf@^2.6.3, rimraf@^2.7.1: version "2.7.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== @@ -11029,7 +11135,7 @@ semver-greatest-satisfied-range@^1.1.0: dependencies: sver-compat "^1.5.0" -"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: +"semver@2 || 3 || 4 || 5", semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== @@ -11561,7 +11667,7 @@ string-width@^3.0.0, string-width@^3.1.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" -string-width@^4.1.0: +string-width@^4.1.0, string-width@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5" integrity sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg== @@ -11674,11 +11780,6 @@ strip-json-comments@^3.0.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== -strip-json-comments@~2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" - integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= - style-loader@0.23.1: version "0.23.1" resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-0.23.1.tgz#cb9154606f3e771ab6c4ab637026a1049174d925" @@ -11791,19 +11892,6 @@ tar@^2.0.0: fstream "^1.0.12" inherits "2" -tar@^4.4.2: - version "4.4.13" - resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525" - integrity sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA== - dependencies: - chownr "^1.1.1" - fs-minipass "^1.2.5" - minipass "^2.8.6" - minizlib "^1.2.1" - mkdirp "^0.5.0" - safe-buffer "^5.1.2" - yallist "^3.0.3" - terser-webpack-plugin@2.3.4: version "2.3.4" resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-2.3.4.tgz#ac045703bd8da0936ce910d8fb6350d0e1dee5fe" @@ -12881,6 +12969,15 @@ wrap-ansi@^5.1.0: string-width "^3.0.0" strip-ansi "^5.0.0" +wrap-ansi@^6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" + integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" @@ -12946,7 +13043,7 @@ yallist@^2.1.2: resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= -yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3: +yallist@^3.0.2: version "3.1.1" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== @@ -12985,6 +13082,14 @@ yargs-parser@^13.1.2: camelcase "^5.0.0" decamelize "^1.2.0" +yargs-parser@^18.1.2: + version "18.1.3" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0" + integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + yargs@12.0.5: version "12.0.5" resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.5.tgz#05f5997b609647b64f66b81e3b4b10a368e7ad13" @@ -13019,6 +13124,23 @@ yargs@^13.3.0, yargs@^13.3.2: y18n "^4.0.0" yargs-parser "^13.1.2" +yargs@^15.3.1: + version "15.4.1" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8" + integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A== + dependencies: + cliui "^6.0.0" + decamelize "^1.2.0" + find-up "^4.1.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^4.2.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^18.1.2" + yargs@^7.0.0, yargs@^7.1.0: version "7.1.1" resolved "https://registry.yarnpkg.com/yargs/-/yargs-7.1.1.tgz#67f0ef52e228d4ee0d6311acede8850f53464df6" From 01f06d37562cc7666e1046619bd08b413751ddb1 Mon Sep 17 00:00:00 2001 From: William Harvey Date: Mon, 21 Sep 2020 22:52:39 -0400 Subject: [PATCH 04/24] Front-end uses envoy as a proxy --- .vscode/settings.json | 2 +- backend/Dockerfile | 25 ++++++++++--------------- backend/envoy.yaml | 28 ---------------------------- mobile/lib/main.dart | 1 + mobile/pubspec.lock | 2 +- web/Dockerfile | 4 ++++ web/envoy.yaml | 39 +++++++++++++++++++++++++++++++++++++++ web/src/index.js | 4 +++- 8 files changed, 59 insertions(+), 46 deletions(-) delete mode 100644 backend/envoy.yaml create mode 100644 web/Dockerfile create mode 100644 web/envoy.yaml diff --git a/.vscode/settings.json b/.vscode/settings.json index ce941e0d..70840f97 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -17,7 +17,7 @@ "protoc": { "compile_on_save": true, "options": [ - "--dart_out=mobile/lib", + "--dart_out=grpc:mobile/lib", "--python_out=backend", "--grpc_python_out=backend", "--plugin=protoc-gen-grpc_python=/usr/bin/grpc_python_plugin", diff --git a/backend/Dockerfile b/backend/Dockerfile index 10de4d95..97c0b228 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,16 +1,11 @@ -# FROM namely/protoc-all as generator -# WORKDIR / -# COPY protos protos -# COPY backend backend -# RUN protoc --proto_path=protos protos/* --python_out=backend/protos +FROM namely/protoc-all as generator +WORKDIR / +COPY protos protos +COPY backend backend +RUN protoc --proto_path=protos protos/* --python_out=backend/protos -# FROM python -# COPY --from=generator /backend /backend -# WORKDIR /backend -# RUN pip install -r requirements.txt --no-cache-dir -# ENTRYPOINT ["python", "app.py"] - -# Need to run in order for grpc-web to communicate with server. -FROM envoyproxy/envoy:v1.14.4 -COPY ./envoy.yaml /etc/envoy/envoy.yaml -CMD /usr/local/bin/envoy -c /etc/envoy/envoy.yaml +FROM python +COPY --from=generator /backend /backend +WORKDIR /backend +RUN pip install -r requirements.txt --no-cache-dir +ENTRYPOINT ["python", "app.py"] diff --git a/backend/envoy.yaml b/backend/envoy.yaml deleted file mode 100644 index 9173c63b..00000000 --- a/backend/envoy.yaml +++ /dev/null @@ -1,28 +0,0 @@ -listeners: - - name: listener_0 - address: - socket_address: { address: 0.0.0.0, port_value: 8080 } - filter_chains: - - filters: - - name: envoy.http_connection_manager - config: - codec_type: auto - stat_prefix: ingress_http - route_config: - name: local_route - virtual_hosts: - - name: local_service - domains: ["*"] - routes: - - match: { prefix: "/" } - route: { cluster: echo_service } - http_filters: - - name: envoy.grpc_web - - name: envoy.router - clusters: - - name: echo_service - connect_timeout: 0.25s - type: logical_dns - http2_protocol_options: {} - lb_policy: round_robin - hosts: [{ socket_address: { address: node-server, port_value: 9090 }}] \ No newline at end of file diff --git a/mobile/lib/main.dart b/mobile/lib/main.dart index 99f285f3..ac099dc1 100644 --- a/mobile/lib/main.dart +++ b/mobile/lib/main.dart @@ -1,3 +1,4 @@ +import 'package:Polydodo/protos/helloworld.pbgrpc.dart'; import 'package:grpc/grpc.dart'; import 'package:flutter/material.dart'; diff --git a/mobile/pubspec.lock b/mobile/pubspec.lock index 77a4dcc1..43b3d1ab 100644 --- a/mobile/pubspec.lock +++ b/mobile/pubspec.lock @@ -255,7 +255,7 @@ packages: name: share url: "https://pub.dartlang.org" source: hosted - version: "0.6.5" + version: "0.6.5+1" sky_engine: dependency: transitive description: flutter diff --git a/web/Dockerfile b/web/Dockerfile new file mode 100644 index 00000000..85500ed4 --- /dev/null +++ b/web/Dockerfile @@ -0,0 +1,4 @@ +# Need to run in order for grpc-web to communicate with server. +FROM envoyproxy/envoy:v1.14.4 +COPY ./envoy.yaml /etc/envoy/envoy.yaml +CMD /usr/local/bin/envoy -c /etc/envoy/envoy.yaml diff --git a/web/envoy.yaml b/web/envoy.yaml new file mode 100644 index 00000000..b7a6c4ad --- /dev/null +++ b/web/envoy.yaml @@ -0,0 +1,39 @@ +static_resources: + listeners: + - name: listener_0 + address: + socket_address: { address: 0.0.0.0, port_value: 8080 } + filter_chains: + - filters: + - name: envoy.http_connection_manager + config: + codec_type: auto + stat_prefix: ingress_http + route_config: + name: local_route + virtual_hosts: + - name: local_service + domains: ["*"] + routes: + - match: { prefix: "/" } + route: + cluster: greeter_service + max_grpc_timeout: 0s + cors: + allow_origin_string_match: + - prefix: "*" + allow_methods: GET, PUT, DELETE, POST, OPTIONS + allow_headers: keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout + max_age: "1728000" + expose_headers: custom-header-1,grpc-status,grpc-message + http_filters: + - name: envoy.grpc_web + - name: envoy.cors + - name: envoy.router + clusters: + - name: greeter_service + connect_timeout: 0.25s + type: logical_dns + http2_protocol_options: {} + lb_policy: round_robin + hosts: [{ socket_address: { address: 0.0.0.0, port_value: 9090 }}] \ No newline at end of file diff --git a/web/src/index.js b/web/src/index.js index a349d885..c7bab463 100644 --- a/web/src/index.js +++ b/web/src/index.js @@ -20,7 +20,9 @@ import {GreeterClient} from 'protos/helloworld_grpc_web_pb'; const client = new GreeterClient('http://localhost:8080'); const request = new HelloRequest(); request.setName('World'); -client.sayHello(request, {}, (err, response) => console.log(response.getMessage())); +client.sayHello(request, {}, (err, response) => { + err ? console.log(err): console.log(response.getMessage()) +}); // END OF TEST ReactDOM.render( From daca785eb3e7fb738e57b30527300de9e308ffdb Mon Sep 17 00:00:00 2001 From: William Harvey Date: Mon, 21 Sep 2020 22:56:08 -0400 Subject: [PATCH 05/24] move envoy proxy to backend --- backend/Dockerfile | 25 +++++++++++++++---------- {web => backend}/envoy.yaml | 1 + web/Dockerfile | 4 ---- 3 files changed, 16 insertions(+), 14 deletions(-) rename {web => backend}/envoy.yaml (93%) delete mode 100644 web/Dockerfile diff --git a/backend/Dockerfile b/backend/Dockerfile index 97c0b228..10de4d95 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,11 +1,16 @@ -FROM namely/protoc-all as generator -WORKDIR / -COPY protos protos -COPY backend backend -RUN protoc --proto_path=protos protos/* --python_out=backend/protos +# FROM namely/protoc-all as generator +# WORKDIR / +# COPY protos protos +# COPY backend backend +# RUN protoc --proto_path=protos protos/* --python_out=backend/protos -FROM python -COPY --from=generator /backend /backend -WORKDIR /backend -RUN pip install -r requirements.txt --no-cache-dir -ENTRYPOINT ["python", "app.py"] +# FROM python +# COPY --from=generator /backend /backend +# WORKDIR /backend +# RUN pip install -r requirements.txt --no-cache-dir +# ENTRYPOINT ["python", "app.py"] + +# Need to run in order for grpc-web to communicate with server. +FROM envoyproxy/envoy:v1.14.4 +COPY ./envoy.yaml /etc/envoy/envoy.yaml +CMD /usr/local/bin/envoy -c /etc/envoy/envoy.yaml diff --git a/web/envoy.yaml b/backend/envoy.yaml similarity index 93% rename from web/envoy.yaml rename to backend/envoy.yaml index b7a6c4ad..6da60674 100644 --- a/web/envoy.yaml +++ b/backend/envoy.yaml @@ -1,3 +1,4 @@ +# Taken from https://github.com/grpc/grpc-web/tree/master/net/grpc/gateway/examples/helloworld static_resources: listeners: - name: listener_0 diff --git a/web/Dockerfile b/web/Dockerfile deleted file mode 100644 index 85500ed4..00000000 --- a/web/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -# Need to run in order for grpc-web to communicate with server. -FROM envoyproxy/envoy:v1.14.4 -COPY ./envoy.yaml /etc/envoy/envoy.yaml -CMD /usr/local/bin/envoy -c /etc/envoy/envoy.yaml From f64efc801b66dfa378f8d54dfb5ba050689e1142 Mon Sep 17 00:00:00 2001 From: William Harvey Date: Mon, 21 Sep 2020 23:56:23 -0400 Subject: [PATCH 06/24] Add computer loopback interface as grpc client ip address --- backend/readme.md | 22 ++++++++++++++++++++++ mobile/lib/main.dart | 5 +++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 backend/readme.md diff --git a/backend/readme.md b/backend/readme.md new file mode 100644 index 00000000..3861199e --- /dev/null +++ b/backend/readme.md @@ -0,0 +1,22 @@ +# Backend + +This backend holds a GRPC server that classify OpenBCI raw EEG data into sleep stages. + +## How to run + +I you are running the front-end, you'll need to build the dockerfile to get the Envoy proxy. + +> docker build -t polydodo-web . + +> docker run -d -p 8080:8080 -p 9090:9090 --network=host polydodo-web + +To start the server: + +> python backend/app.py + +If you want to use the backend with the flutter app, you can't run the Envoy Proxy concurrently (only one process can access the 9090 port). + +## Get requirements: + +> python -m venv .venv +> python -m pip install -r requirements.txt diff --git a/mobile/lib/main.dart b/mobile/lib/main.dart index ac099dc1..4a3c1c16 100644 --- a/mobile/lib/main.dart +++ b/mobile/lib/main.dart @@ -7,14 +7,15 @@ import 'protos/helloworld.pb.dart'; void main() async { // GRPC TEST final channel = ClientChannel( - 'localhost', + '10.0.2.2', // Emulator alias to host's loopback interface (when server is running on computer) + // 'localhost', // When server is running on phone port: 9090, options: const ChannelOptions(credentials: ChannelCredentials.insecure()), ); final stub = GreeterClient(channel); try { - var response = await stub.sayHello(HelloRequest()..name = 'world'); + final response = await stub.sayHello(HelloRequest()..name = 'world'); print('Greeter client received: ${response.message}'); } catch (e) { print('Caught error: $e'); From 70f5a5e3d342fc2259bd253d74ae5150a88fe32d Mon Sep 17 00:00:00 2001 From: William Harvey Date: Mon, 21 Sep 2020 23:58:51 -0400 Subject: [PATCH 07/24] remove false comment aboute proxy port --- backend/readme.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/backend/readme.md b/backend/readme.md index 3861199e..4cac8e6f 100644 --- a/backend/readme.md +++ b/backend/readme.md @@ -14,8 +14,6 @@ To start the server: > python backend/app.py -If you want to use the backend with the flutter app, you can't run the Envoy Proxy concurrently (only one process can access the 9090 port). - ## Get requirements: > python -m venv .venv From 610d1a40f5a5daa62852fe2e372b6ea327e2aa79 Mon Sep 17 00:00:00 2001 From: William Harvey Date: Tue, 22 Sep 2020 20:43:20 -0400 Subject: [PATCH 08/24] add instructions for grpc installation in readme --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index e451af06..55356bda 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,14 @@ This projects aims to offer a comprehensive guide to **record polysomnographic E ### GRPC and proto generation +First thing to do is to install protoc via dart's protoc_plugin. To do so: + +> flutter pub global activate protoc_plugin + In order to be able to proceed to GRPC and proto generation, you need to run `sh ./install_grpc_python_plugin` under the protos/ folder. +When you'll save `.proto` files, this will automatically generate langage specific code to use GRPC. + ### Backend development You'll need install venv with `python -m pip install virtualenv`. Then you can create a virtual environment. Be sure that you link your venv `python` executable to your code editor/terminal. From af1e6638bc36d211d7b9b2b2a99b5fcc26f1416f Mon Sep 17 00:00:00 2001 From: Anes Belfodil Date: Thu, 24 Sep 2020 22:58:04 -0400 Subject: [PATCH 09/24] test --- .github/workflows/mobile.yml | 2 +- .github/workflows/web.yml | 4 +++- backend/Dockerfile | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 1508c38b..85778be8 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -25,7 +25,7 @@ jobs: with: enable-dart: true - - run: protoc --proto_path=protos protos/* --dart_out=mobile/lib/protos + - run: protoc --proto_path=protos protos/* --dart_out=grpc:mobile/lib/protos working-directory: . - run: flutter pub get diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml index 5ce5d866..9849b023 100644 --- a/.github/workflows/web.yml +++ b/.github/workflows/web.yml @@ -14,10 +14,12 @@ jobs: steps: - uses: actions/checkout@v2 - uses: abelfodil/protoc-action@v1 + with: + enable-grpc-web: true - uses: borales/actions-yarn@v2.3.0 with: cmd: --cwd web install - - run: protoc --proto_path=protos protos/* --js_out=web/src/protos + - run: protoc --proto_path=protos protos/* --js_out=web/src/protos --grpc-web_out=import_style=commonjs,mode=grpcwebtext:web/src/protos - uses: borales/actions-yarn@v2.3.0 with: cmd: --cwd web build diff --git a/backend/Dockerfile b/backend/Dockerfile index 97c0b228..fc0eb8aa 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -2,7 +2,8 @@ FROM namely/protoc-all as generator WORKDIR / COPY protos protos COPY backend backend -RUN protoc --proto_path=protos protos/* --python_out=backend/protos +RUN ln $(which grpc_python_plugin) /usr/bin/protoc-gen-grpc_python +RUN protoc --proto_path=protos protos/* --python_out=backend/protos --grpc_python_out=backend/protos FROM python COPY --from=generator /backend /backend From 577100250433bc0ec8f85be7ab07016e2345ae36 Mon Sep 17 00:00:00 2001 From: William Harvey Date: Fri, 25 Sep 2020 01:05:02 -0400 Subject: [PATCH 10/24] Remove useless install script && fix package name --- mobile/lib/main.dart | 2 +- protos/install_grpc_plugins.sh | 16 ---------------- 2 files changed, 1 insertion(+), 17 deletions(-) delete mode 100644 protos/install_grpc_plugins.sh diff --git a/mobile/lib/main.dart b/mobile/lib/main.dart index 7dc7d9bd..ac91988a 100644 --- a/mobile/lib/main.dart +++ b/mobile/lib/main.dart @@ -1,4 +1,4 @@ -import 'package:Polydodo/protos/helloworld.pbgrpc.dart'; +import 'package:polydodo/protos/helloworld.pbgrpc.dart'; import 'package:grpc/grpc.dart'; import 'package:flutter/material.dart'; diff --git a/protos/install_grpc_plugins.sh b/protos/install_grpc_plugins.sh deleted file mode 100644 index 3e62eb0c..00000000 --- a/protos/install_grpc_plugins.sh +++ /dev/null @@ -1,16 +0,0 @@ -echo "This script install grpc_python_plugin from source because of this https://github.com/grpc/grpc/issues/15675#issuecomment-397038811" -git clone --recursive https://github.com/grpc/grpc -cd grpc && make grpc_python_plugin -j 4 -sudo mv bins/opt/grpc_python_plugin /usr/bin -cd .. && sudo rm -r grpc/ - -# See https://github.com/grpc/grpc-web/releases for other releases -# LINUX -wget -O protoc-gen-grpc-web "https://github.com/grpc/grpc-web/releases/download/1.2.1/protoc-gen-grpc-web-1.2.1-linux-x86_64" -sudo mv protoc-gen-grpc-web /usr/bin - -# MAC -# wget -O protoc-gen-grpc-web https://github.com/grpc/grpc-web/releases/download/1.2.1/protoc-gen-grpc-web-1.2.1-darwin-x86_64 -# sudo mv protoc-gen-grpc-web /usr/bin - -chmod +x /usr/bin/protoc-gen-grpc-web From 1cdb13feb1c0c0b142307d78b23c9654c5b74429 Mon Sep 17 00:00:00 2001 From: William Harvey Date: Mon, 28 Sep 2020 22:21:13 -0400 Subject: [PATCH 11/24] Apply suggestions from code review Co-authored-by: Anes Belfodil --- .vscode/settings.json | 1 + README.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 70840f97..4facdd0f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -16,6 +16,7 @@ }, "protoc": { "compile_on_save": true, + "compile_all_path": "protos", "options": [ "--dart_out=grpc:mobile/lib", "--python_out=backend", diff --git a/README.md b/README.md index 04fbe848..30a54671 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ This projects aims to offer a comprehensive guide to **record polysomnographic E - Install Python 3 and pip - Consider using `venv` to create a virtual environment -- Install `protoc-gen-grpc_python` using a package manager or by compiling the [source code](https://github.com/grpc/grpc) +- Install gRPC using a package manager or by compiling the [source code](https://github.com/grpc/grpc) - Create a simlink named `protoc-gen-grpc_python` to `grpc_python_plugin` using `ln -nsf $(which grpc_python_plugin) /some/where/in/your/path/protoc-gen-grpc_python` ### Flutter From 055ca940b8ee74c7b14356457173bdf120e80925 Mon Sep 17 00:00:00 2001 From: Anes Belfodil Date: Thu, 1 Oct 2020 15:09:31 -0400 Subject: [PATCH 12/24] Enhance vscode xp --- .vscode/.editorconfig => .editorconfig | 0 .vscode/.prettierrc.yaml => .prettierrc.yaml | 2 +- .vscode/extensions.json | 13 ---- .vscode/settings.json | 33 --------- polydodo.code-workspace | 73 ++++++++++++++++++++ 5 files changed, 74 insertions(+), 47 deletions(-) rename .vscode/.editorconfig => .editorconfig (100%) rename .vscode/.prettierrc.yaml => .prettierrc.yaml (72%) delete mode 100644 .vscode/extensions.json delete mode 100644 .vscode/settings.json create mode 100644 polydodo.code-workspace diff --git a/.vscode/.editorconfig b/.editorconfig similarity index 100% rename from .vscode/.editorconfig rename to .editorconfig diff --git a/.vscode/.prettierrc.yaml b/.prettierrc.yaml similarity index 72% rename from .vscode/.prettierrc.yaml rename to .prettierrc.yaml index f51d99fc..3c7da0b7 100644 --- a/.vscode/.prettierrc.yaml +++ b/.prettierrc.yaml @@ -1,4 +1,4 @@ -trailingComma: 'all' +trailingComma: "all" tabWidth: 2 semi: true singleQuote: true diff --git a/.vscode/extensions.json b/.vscode/extensions.json deleted file mode 100644 index 39f95aac..00000000 --- a/.vscode/extensions.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "recommendations": [ - "christian-kohler.path-intellisense", - "ms-python.python", - "2gua.rainbow-brackets", - "esbenp.prettier-vscode", - "eamodio.gitlens", - "editorconfig.editorconfig", - "dbaeumer.vscode-eslint", - "dart-code.flutter", - "zxh404.vscode-proto3" - ] -} diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 4facdd0f..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "prettier.configPath": ".vscode/.prettierrc.yaml", - "editor.defaultFormatter": "esbenp.prettier-vscode", - "eslint.packageManager": "yarn", - "editor.codeActionsOnSave": { - "source.fixAll.eslint": true - }, - "[javascript]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[jsonc]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[json]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "protoc": { - "compile_on_save": true, - "compile_all_path": "protos", - "options": [ - "--dart_out=grpc:mobile/lib", - "--python_out=backend", - "--grpc_python_out=backend", - "--plugin=protoc-gen-grpc_python=/usr/bin/grpc_python_plugin", - "--js_out=import_style=commonjs:web/src", - "--grpc-web_out=import_style=commonjs,mode=grpcwebtext:web/src" - ] - }, - "python.linting.enabled": true, - "python.linting.flake8Enabled": true, - "python.formatting.provider": "autopep8", - "python.pythonPath": "backend/.venv/bin/python" -} diff --git a/polydodo.code-workspace b/polydodo.code-workspace new file mode 100644 index 00000000..447323c8 --- /dev/null +++ b/polydodo.code-workspace @@ -0,0 +1,73 @@ +{ + "folders": [ + { + "name": "Polydodo", + "path": "." + }, + { + "name": "AI", + "path": "ai" + }, + { + "name": "Backend", + "path": "backend" + }, + { + "name": "Mobile", + "path": "mobile" + }, + { + "name": "Web client", + "path": "web" + }, + { + "name": "Protos", + "path": "protos" + } + ], + "settings": { + "prettier.configPath": ".prettierrc.yaml", + "editor.defaultFormatter": "esbenp.prettier-vscode", + "eslint.packageManager": "yarn", + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true + }, + "[javascript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[jsonc]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[json]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "protoc": { + "compile_on_save": true, + "compile_all_path": "protos", + "options": [ + "--dart_out=grpc:mobile/lib", + "--python_out=backend", + "--grpc_python_out=backend", + "--js_out=import_style=commonjs:web/src", + "--grpc-web_out=import_style=commonjs,mode=grpcwebtext:web/src" + ] + }, + "python.linting.enabled": true, + "python.linting.flake8Enabled": true, + "python.formatting.provider": "autopep8", + "python.pythonPath": "/usr/bin/python" + }, + "extensions": { + "recommendations": [ + "christian-kohler.path-intellisense", + "ms-python.python", + "2gua.rainbow-brackets", + "esbenp.prettier-vscode", + "eamodio.gitlens", + "editorconfig.editorconfig", + "dbaeumer.vscode-eslint", + "dart-code.flutter", + "zxh404.vscode-proto3" + ] + } +} From 75bbc988a869cfea5e1ae50b347fe976ef94fa99 Mon Sep 17 00:00:00 2001 From: Anes Belfodil Date: Thu, 1 Oct 2020 15:16:41 -0400 Subject: [PATCH 13/24] Fix python app --- backend/{backend => }/app.py | 0 backend/backend/__init__.py | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename backend/{backend => }/app.py (100%) delete mode 100644 backend/backend/__init__.py diff --git a/backend/backend/app.py b/backend/app.py similarity index 100% rename from backend/backend/app.py rename to backend/app.py diff --git a/backend/backend/__init__.py b/backend/backend/__init__.py deleted file mode 100644 index e69de29b..00000000 From 353196b51f48870d9046c8aea0643956e9ffeae3 Mon Sep 17 00:00:00 2001 From: William Harvey Date: Thu, 1 Oct 2020 15:22:09 -0400 Subject: [PATCH 14/24] add host environment variable for grpc --- mobile/.vscode/launch.json | 6 +++++- mobile/lib/main.dart | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mobile/.vscode/launch.json b/mobile/.vscode/launch.json index c7ced0c2..95b36429 100644 --- a/mobile/.vscode/launch.json +++ b/mobile/.vscode/launch.json @@ -8,7 +8,11 @@ "name": "mobile", "program": "lib/main.dart", "request": "launch", - "type": "dart" + "type": "dart", + "args": [ + "--dart-define", + "HOST=10.0.2.2" + ] } ] } diff --git a/mobile/lib/main.dart b/mobile/lib/main.dart index ac91988a..11699fb8 100644 --- a/mobile/lib/main.dart +++ b/mobile/lib/main.dart @@ -8,8 +8,7 @@ import 'src/app.dart'; void main() async { // GRPC TEST final channel = ClientChannel( - '10.0.2.2', // Emulator alias to host's loopback interface (when server is running on computer) - // 'localhost', // When server is running on phone + const String.fromEnvironment('HOST'), port: 9090, options: const ChannelOptions(credentials: ChannelCredentials.insecure()), ); From dc53aa0c84f4ac97f5a525fce8f03e781b481c23 Mon Sep 17 00:00:00 2001 From: Anes Belfodil Date: Thu, 1 Oct 2020 15:48:30 -0400 Subject: [PATCH 15/24] Add envoy to docker --- README.md | 9 +++++++-- backend/Dockerfile | 19 ++++++++++--------- backend/start.sh | 5 +++++ 3 files changed, 22 insertions(+), 11 deletions(-) create mode 100755 backend/start.sh diff --git a/README.md b/README.md index 30a54671..ce3f2bd8 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ This projects aims to offer a comprehensive guide to **record polysomnographic E - Install Python 3 and pip - Consider using `venv` to create a virtual environment -- Install gRPC using a package manager or by compiling the [source code](https://github.com/grpc/grpc) +- Install gRPC using a package manager or by compiling the [source code](https://github.com/grpc/grpc) - Create a simlink named `protoc-gen-grpc_python` to `grpc_python_plugin` using `ln -nsf $(which grpc_python_plugin) /some/where/in/your/path/protoc-gen-grpc_python` ### Flutter @@ -35,7 +35,12 @@ This projects aims to offer a comprehensive guide to **record polysomnographic E ## Dev workflow -- Open root folder on VS Code +- Open workspace `polydodo.code-workspace` - Install node modules by running `yarn install --cwd web` - Fetch Flutter dependencies through the `Flutter` extension - Compile all protos through `proto3` extension + +## Running the server locally + +- `docker build . -f backend/Dockerfile -t polydodo` +- `docker run -p 8080:8080 polydodo` diff --git a/backend/Dockerfile b/backend/Dockerfile index f8bf754b..cb6e7293 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -3,15 +3,16 @@ WORKDIR / COPY protos protos COPY backend backend RUN ln $(which grpc_python_plugin) /usr/bin/protoc-gen-grpc_python -RUN protoc --proto_path=protos protos/* --python_out=backend/protos --grpc_python_out=backend/protos +RUN protoc protos/* --python_out=backend --grpc_python_out=backend -FROM python +FROM envoyproxy/envoy:v1.15-latest +RUN apt-get update \ + && apt-get -y install python3-pip \ + && apt-get autoremove -y \ + && apt-get clean \ + && rm -rf /tmp/* /var/tmp/* \ + && rm -rf /var/lib/apt/lists/* COPY --from=generator /backend /backend WORKDIR /backend -RUN pip install -r requirements.txt --no-cache-dir -ENTRYPOINT ["python", "app.py"] - -# # Need to run in order for grpc-web to communicate with server. -# FROM envoyproxy/envoy:v1.14.4 -# COPY ./envoy.yaml /etc/envoy/envoy.yaml -# CMD /usr/local/bin/envoy -c /etc/envoy/envoy.yaml +RUN pip3 install -r requirements.txt --no-cache-dir +CMD "./start.sh" diff --git a/backend/start.sh b/backend/start.sh new file mode 100755 index 00000000..aeecd538 --- /dev/null +++ b/backend/start.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env sh + +set -m +python3 app.py & +envoy -c envoy.yaml From 8f523ae7effd02ae16241bcd9ed564af440d6f06 Mon Sep 17 00:00:00 2001 From: Anes Belfodil Date: Thu, 1 Oct 2020 16:03:32 -0400 Subject: [PATCH 16/24] Fix prettier format --- backend/envoy.yaml | 72 ++++++++++++++++++++--------------------- polydodo.code-workspace | 2 +- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/backend/envoy.yaml b/backend/envoy.yaml index 6da60674..181806ef 100644 --- a/backend/envoy.yaml +++ b/backend/envoy.yaml @@ -1,40 +1,40 @@ # Taken from https://github.com/grpc/grpc-web/tree/master/net/grpc/gateway/examples/helloworld static_resources: listeners: - - name: listener_0 - address: - socket_address: { address: 0.0.0.0, port_value: 8080 } - filter_chains: - - filters: - - name: envoy.http_connection_manager - config: - codec_type: auto - stat_prefix: ingress_http - route_config: - name: local_route - virtual_hosts: - - name: local_service - domains: ["*"] - routes: - - match: { prefix: "/" } - route: - cluster: greeter_service - max_grpc_timeout: 0s - cors: - allow_origin_string_match: - - prefix: "*" - allow_methods: GET, PUT, DELETE, POST, OPTIONS - allow_headers: keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout - max_age: "1728000" - expose_headers: custom-header-1,grpc-status,grpc-message - http_filters: - - name: envoy.grpc_web - - name: envoy.cors - - name: envoy.router + - name: listener_0 + address: + socket_address: { address: 0.0.0.0, port_value: 8080 } + filter_chains: + - filters: + - name: envoy.http_connection_manager + config: + codec_type: auto + stat_prefix: ingress_http + route_config: + name: local_route + virtual_hosts: + - name: local_service + domains: ["*"] + routes: + - match: { prefix: "/" } + route: + cluster: greeter_service + max_grpc_timeout: 0s + cors: + allow_origin_string_match: + - prefix: "*" + allow_methods: GET, PUT, DELETE, POST, OPTIONS + allow_headers: keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout + max_age: "1728000" + expose_headers: custom-header-1,grpc-status,grpc-message + http_filters: + - name: envoy.grpc_web + - name: envoy.cors + - name: envoy.router clusters: - - name: greeter_service - connect_timeout: 0.25s - type: logical_dns - http2_protocol_options: {} - lb_policy: round_robin - hosts: [{ socket_address: { address: 0.0.0.0, port_value: 9090 }}] \ No newline at end of file + - name: greeter_service + connect_timeout: 0.25s + type: logical_dns + http2_protocol_options: {} + lb_policy: round_robin + hosts: [{ socket_address: { address: 0.0.0.0, port_value: 9090 } }] diff --git a/polydodo.code-workspace b/polydodo.code-workspace index 447323c8..d28f1dc7 100644 --- a/polydodo.code-workspace +++ b/polydodo.code-workspace @@ -26,7 +26,7 @@ } ], "settings": { - "prettier.configPath": ".prettierrc.yaml", + "prettier.configPath": "../.prettierrc.yaml", "editor.defaultFormatter": "esbenp.prettier-vscode", "eslint.packageManager": "yarn", "editor.codeActionsOnSave": { From 2298cb702ff0d0bc3e57acc1de99dbe15512fb61 Mon Sep 17 00:00:00 2001 From: Anes Belfodil Date: Thu, 1 Oct 2020 16:14:05 -0400 Subject: [PATCH 17/24] Verbose logs --- .github/workflows/mobile.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 85778be8..e1241729 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -32,13 +32,13 @@ jobs: - run: flutter test - - run: flutter build apk + - run: flutter build apk -v - uses: actions/upload-artifact@v2 with: name: Android app path: mobile/build/app/outputs/flutter-apk/app-release.apk - - run: flutter build ios --release --no-codesign + - run: flutter build ios --release --no-codesign -v - uses: actions/upload-artifact@v2 with: name: iOS app From 4ff63911fdb25ae4f502af1c62523aaed7a8f766 Mon Sep 17 00:00:00 2001 From: Anes Belfodil Date: Thu, 1 Oct 2020 16:46:47 -0400 Subject: [PATCH 18/24] Downgrade java --- .github/workflows/mobile.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 85778be8..8b796406 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-java@v1 with: - java-version: "12.x" + java-version: "8.x" - uses: subosito/flutter-action@v1 - uses: abelfodil/protoc-action@v1 with: From 413f3a20845d6f9ef8e33abad87ad6ec040e12ab Mon Sep 17 00:00:00 2001 From: Anes Belfodil Date: Thu, 1 Oct 2020 17:03:07 -0400 Subject: [PATCH 19/24] update readme --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ce3f2bd8..d15d745f 100644 --- a/README.md +++ b/README.md @@ -42,5 +42,6 @@ This projects aims to offer a comprehensive guide to **record polysomnographic E ## Running the server locally -- `docker build . -f backend/Dockerfile -t polydodo` -- `docker run -p 8080:8080 polydodo` +- [Login](https://docs.github.com/en/free-pro-team@latest/packages/using-github-packages-with-your-projects-ecosystem/configuring-docker-for-use-with-github-packages#authenticating-with-a-personal-access-token) to Github Docker registry +- `docker pull docker.pkg.github.com/polycortex/polydodo/backend:latest` +- `docker run -p 8080:8080 docker.pkg.github.com/polycortex/polydodo/backend:latest` From 207c7c0fe3489f10d0610a04219fca86dfdacbdf Mon Sep 17 00:00:00 2001 From: Anes Belfodil Date: Thu, 1 Oct 2020 17:11:31 -0400 Subject: [PATCH 20/24] Fix web pipeline --- .github/workflows/web.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml index 23456efe..fa8a16a6 100644 --- a/.github/workflows/web.yml +++ b/.github/workflows/web.yml @@ -17,7 +17,7 @@ jobs: - uses: abelfodil/protoc-action@v1 with: enable-grpc-web: true - - run: protoc --proto_path=protos protos/* --js_out=web/src/protos --grpc-web_out=import_style=commonjs,mode=grpcwebtext:web/src/protos + - run: protoc protos/* --js_out=import_style=commonjs:web/src --grpc-web_out=import_style=commonjs,mode=grpcwebtext:web/src - run: yarn --cwd web install - run: yarn --cwd web build - uses: actions/upload-artifact@v2 From 8afe68cc0fab8be8e222f1fdbae637abf0a0e74a Mon Sep 17 00:00:00 2001 From: Anes Belfodil Date: Thu, 1 Oct 2020 17:11:55 -0400 Subject: [PATCH 21/24] rename folders --- polydodo.code-workspace | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/polydodo.code-workspace b/polydodo.code-workspace index d28f1dc7..2f0d9cfd 100644 --- a/polydodo.code-workspace +++ b/polydodo.code-workspace @@ -9,11 +9,11 @@ "path": "ai" }, { - "name": "Backend", + "name": "Server", "path": "backend" }, { - "name": "Mobile", + "name": "Mobile client", "path": "mobile" }, { From d10f5ff0ca124860c3453477d8aca382f915054b Mon Sep 17 00:00:00 2001 From: Anes Belfodil Date: Thu, 1 Oct 2020 17:20:18 -0400 Subject: [PATCH 22/24] Attempt to fix web --- web/src/index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/web/src/index.js b/web/src/index.js index 2f054658..54955242 100644 --- a/web/src/index.js +++ b/web/src/index.js @@ -17,16 +17,15 @@ import AnalyzeSleep from 'views/analyze-sleep'; import ScrollToTop from 'components/scroll_to_top'; import Emoji from 'components/emoji'; - // GRPC TEST -import {HelloRequest, HelloReply} from 'protos/helloworld_pb'; -import {GreeterClient} from 'protos/helloworld_grpc_web_pb'; +import { HelloRequest } from 'protos/helloworld_pb'; +import { GreeterClient } from 'protos/helloworld_grpc_web_pb'; const client = new GreeterClient('http://localhost:8080'); const request = new HelloRequest(); request.setName('World'); client.sayHello(request, {}, (err, response) => { - err ? console.log(err): console.log(response.getMessage()) + err ? console.log(err) : console.log(response.getMessage()); }); // END OF TEST From a1c235520d86f3cb023bb8fda4be98b0b29baf8a Mon Sep 17 00:00:00 2001 From: Anes Belfodil Date: Thu, 1 Oct 2020 17:29:44 -0400 Subject: [PATCH 23/24] Remove verbose --- .github/workflows/mobile.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 26a90d08..8b796406 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -32,13 +32,13 @@ jobs: - run: flutter test - - run: flutter build apk -v + - run: flutter build apk - uses: actions/upload-artifact@v2 with: name: Android app path: mobile/build/app/outputs/flutter-apk/app-release.apk - - run: flutter build ios --release --no-codesign -v + - run: flutter build ios --release --no-codesign - uses: actions/upload-artifact@v2 with: name: iOS app From 7053f032234e252db54aabb46fd21ed7655b200a Mon Sep 17 00:00:00 2001 From: William Harvey Date: Thu, 1 Oct 2020 17:32:57 -0400 Subject: [PATCH 24/24] Change ignorePatterns for evrything in protos/ folder --- web/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/package.json b/web/package.json index b1ab2b11..72f65ee9 100644 --- a/web/package.json +++ b/web/package.json @@ -16,7 +16,7 @@ "eslintConfig": { "extends": "react-app", "ignorePatterns": [ - "**/*_pb.js" + "src/protos/" ] }, "browserslist": [