Skip to content

Commit 7bb7603

Browse files
daniel86AbhijitVyassasjongekaviyachandran
authored
NEEM Hub support (#56)
* removed init_webapp * removed experiments admin page * removed mongo admin interface * towards neem-hub * fixed user_data route * add menu item for user info * quickly bootstrapped the user_info page * user password can be changed * Reformatting global variable name * added .dockerignore to avoid docker COPY command including .git dirs in local node_modules * require @openease/charts and @openease/canvas-three * depend on @openease/charts and @openease/canvas-three * load layout.css * remove imports that are part of node modules @openease/charts and @openease/canvas-three * cop local node_modules directory into the image * added empty node_modules directory * moved some openEASE specific JS code back into this source tree * require @openease/ros-clients and @openease/rosprolog-console * depend on @openease/ros-clients and @openease/rosprolog-console * JS modules have moved to statis/js * updated README * removed unused env * moved highlightElement into this template * updated JS imports * logging interface app.logger is used * show_user_data is renamed as user_data in app.py * css files are moved into openease_flask container and thus openease_css is removed * variable name changed due to typo * added QueryCard widget * css for split.js, todo: seems not working on small devices from the scratch * removed table definitions * added ease logo with light colors * depend on split.s * +MAX_HISTORY_LINES * only use one volume for neems (neems-ws is not used anymore) * removed some definitions used in QA page * updated imports * refactor * serve meshes from neem directory * set fixed frame to map * reorganized navbar a bit * work on QA page * work on QA page * quick fix for api endpoints, for now disabled starting user container * work on query console * need to escape single quotes in query string * wait on KnowRob before loading a NEEM * scalable pages * minor changes: smaller-screen-size class added and unused code removed. * qa-container should have w-100 class * use only one navbar-brand since it does not look right for small devices * minor changes: smaller-screen-size class removed from QA html and split sizes changed based on window width. * Fixed bug by using Ubuntu 18.04 * NEEM instances are created from mongo docs * env variable name is changed * neem meta information updated: name and url paramters are added to neem * neem id is set from mongo meta data * Explore link now works and redirects to QA Page. * make explore button work again * neem_id type is checked before using it for retrieving neem from mongoDB. * Updated some js packages * updated versions of node packages * renamed env variable * Environment variables used for mongoclient set-up. * Int data is required as mongo port. * robot image as background-image of card-body * show neem id * removed unused code * removed unused code * connect to host knowrob * neem discovery * Added usage of server for meshes * Update settings.py * discovery page updated * crated by is displayed in more readable format * modified meta data is red from mongo client * final changes for neem discovery page with different kinds of neems * neem_id is now set by the choice on the discovery page * repo path is shown on top of neem card with clickable link * neem card header text color is changed * added more examples * implemented some example queries * example queries * Initial commit with tutorial page. TODO : Fix the column in the right * - Right page - query console is not editable * Set the code from the tutorial to the console * Modified text and queries * switch to npm v12 * re-enabled route for video page * implemented filtering via simple mongo query * video page * canvas snapshot * cleanup * canvas snapshot works now * handle neem id in QA.js * fixed some errors * removed unused code * some minor things * new logo is added to navbar * Links for Admin dropdown list are fixed. However pages needs to be properly defined. * footer position is fixed. Also background color of some pages are changed. * navbar on top and footer on bottom are fixed. Also user details page updated. * links are replaced by buttons in user details page * margins for containers classes are added for top and bottom side * minor changes * redesinged QA page * minor * added empty template for query examples page * work on blackboard * blackboard * border color * light blue background for card header * Update ROSCanvas.js * Update ROSCanvas.js * Update ROSCanvas.js * new logo is added to other remaining pages. * typos removed and padding class is added * event playback * NEEM Hub Configuration (#52) * first commit with NEEM Hub configuration * Postgresql is configured for storing NEEMHubSettings data * NEEM configuration is checked on application start * Go to configuration helper page added * Final working changes * neemHubSettings are passed at container creation time. Also code cleaned. * updates with working version * code cleaned: unused boolean variable removed * code cleaning: unused variables are removed. * code cleaned: unused method removed. * code cleaned. suggestions implemented. * changes related to neem_manager singleton * minor update * suggestions are applied * TODOs are removed * Final comments are added where exception handling is done on method caller side * Custom neem meta exception class is added to handle exceptions during connecting to mongodb neem meta collection * custom SQL Alchemy exception class is added * all exceptions are handled by flask handler so do not need to handle them individually. * added button bar to canvas * changed reverted for navbar and footer position fixed. Now footer gets fixed position for some pages but not all. Also openease logo is reverted to old logo. (#53) * canvas links * few more changes (#54) * changed reverted for navbar and footer position fixed. Now footer gets fixed position for some pages but not all. Also openease logo is reverted to old logo. * few more changes: QA logo fixed and footer script is arranged properly * implemented pause button in playback widget (#55) * cleanup * cleanup * removed some unused files * QA * playback widget * fix fir woff files by Abhijit * code cleanup * refactoring * more general invalid settings page * removed unused mesh_data volume * cleanup * refactoring * refactor * removed unused file * fix for db admin pages * refactor * removed unused template * fixed package structure * removed unused file * added README * refactor * removed unused code * refactor * removed unused code * refactor * remove screen.css and user.css * refactor * refactor * refactor * removed unused dependency * CSS cleanup * no need to use openease/postgres * removed unused files * refactor * examples page * query examples * example queries * clickable example queries * clickable example queries * css cleanup * renamed docker image openease/flask to openease/app Co-authored-by: Abhijit Vyas <[email protected]> Co-authored-by: Sascha Jongebloed <[email protected]> Co-authored-by: Daniel Beßler <[email protected]> Co-authored-by: kaviyachandran <[email protected]>
1 parent ce8e300 commit 7bb7603

File tree

207 files changed

+6610
-4744
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

207 files changed

+6610
-4744
lines changed

.codecov.yml

-7
This file was deleted.

.dockerignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
certs/*
2+
node_modules/*/.*
3+
node_modules/*/*/.*

.gitignore

100644100755
+3-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ setup.cfg
2222
build
2323

2424
# node and javascript stuff
25-
node_modules/
25+
/node_modules/*
26+
!/node_modules/README.md
27+
2628
npm-debug.log
2729

2830
# ignore sass-cache

Dockerfile

+27-18
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
FROM ubuntu:16.04
1+
FROM ubuntu:18.04
22
MAINTAINER Daniel Beßler, [email protected]
33

44
# install python and flask
55
RUN apt-get -qq update
66
RUN DEBIAN_FRONTEND=noninteractive apt-get -qq install -y -q curl python-all python-pip python-dev wget gcc imagemagick mongodb libffi-dev libpq-dev
77
RUN DEBIAN_FRONTEND=noninteractive apt-get -qq install -y -q subversion git
88

9-
RUN DEBIAN_FRONTEND=noninteractive apt-get -qq install -y -q nodejs nodejs-legacy npm
9+
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash
10+
RUN DEBIAN_FRONTEND=noninteractive apt-get -qq install -y -q nodejs
1011
RUN DEBIAN_FRONTEND=noninteractive apt-get -qq install -y -q postgresql
1112

12-
WORKDIR /opt/webapp
13+
RUN apt-get update && \
14+
DEBIAN_FRONTEND=noninteractive apt-get install -y ruby-full build-essential rubygems && \
15+
gem install sass --no-user-install -v 3.5.5 && \
16+
apt-get clean
1317

14-
# flag used in nginx configuration
15-
# TODO: is this still needed?
16-
ENV OPEN_EASE_WEBAPP true
18+
WORKDIR /opt/webapp
1719

1820
# install python-dependencies including flask
1921
COPY requirements.txt .
@@ -24,27 +26,34 @@ RUN useradd -m -d /home/ros -p ros ros && chsh -s /bin/bash ros
2426
ENV HOME /home/ros
2527

2628
## install npm dendencies
27-
RUN mkdir /tmp/npm
28-
ADD ./webrob/static/index.js ./webrob/static/package.json /tmp/npm/
29-
RUN cd /tmp/npm && npm install && npm run build && chown -R ros:ros /tmp/npm
29+
RUN mkdir -p /tmp/npm/node_modules
30+
WORKDIR /tmp/npm
31+
COPY static/package.json /tmp/npm/
32+
RUN npm install
33+
# copy local node modules into the image
34+
# FIXME: needs to be done after npm install
35+
COPY ./node_modules /tmp/npm/node_modules
36+
37+
COPY static/index.js /tmp/npm/
38+
RUN npm run build
39+
RUN chown -R ros:ros /tmp/npm
40+
WORKDIR /opt/webapp
3041

3142
## copy this folder to the container
32-
ADD . /opt/webapp/
43+
RUN mkdir /opt/webapp/webrob
44+
COPY . /opt/webapp/webrob
3345
RUN chown -R ros:ros /opt/webapp/
3446

35-
RUN mkdir /home/ros/mesh_data
36-
RUN chown -R ros:ros /home/ros/mesh_data
37-
3847
USER ros
3948

40-
# install JS libraries using npm
41-
# TODO why need to copy?
42-
# RUN cd /opt/webapp/webrob/static && npm install
49+
# install JS libraries to static dir of webserver
4350
RUN mv /tmp/npm/openease*.js /opt/webapp/webrob/static/
4451

4552
RUN cd /home/ros
46-
# Expose volumes for maintenance
47-
VOLUME /opt/webapp/
53+
54+
# configure scss to css file conversion here with sass
55+
WORKDIR /opt/webapp/webrob/static/css/SCSS
56+
RUN sass --update .:.
4857

4958
EXPOSE 5000
5059

README.md

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
openease/flask
22
================
33

4-
### Master: [![Build Status](https://travis-ci.org/navidJadid/openease_flask.svg?branch=master)](https://travis-ci.org/navidJadid/openease_flask) [![codecov](https://codecov.io/gh/navidJadid/openease_flask/branch/master/graph/badge.svg)](https://codecov.io/gh/navidJadid/openease_flask)
5-
6-
### Development: [![Build Status](https://travis-ci.org/navidJadid/openease_flask.svg?branch=development)](https://travis-ci.org/navidJadid/openease_flask) [![codecov](https://codecov.io/gh/navidJadid/openease_flask/branch/development/graph/badge.svg)](https://codecov.io/gh/navidJadid/openease_flask)
7-
8-
Repository which contains the front & back-end code for the openEASE project.
9-
10-
Cannot be run by itself as of right now. Either build the [whole project](https://github.com/ease-crc/openease) with docker-compose (will pull the most recent docker-build from [`docker-hub`](https://hub.docker.com/r/openease/flask)) or check out the [development project](https://github.com/navidJadid/openease_webserver_development).
11-
12-
Apart from that, tests will of course still run in CI-environment.
4+
### Master: [![Build Status](https://travis-ci.org/ease-crc/openease_flask.svg?branch=master)](https://travis-ci.org/ease-crc/openease_flask) [![codecov](https://codecov.io/gh/ease-crc/openease_flask/branch/master/graph/badge.svg)](https://codecov.io/gh/ease-crc/openease_flask)

webrob/__init__.py __init__.py

File renamed without changes.

webrob/app_and_db.py app_and_db.py

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#
77
# Authors: Ling Thio <[email protected]>
88

9+
import os
910
from flask import Flask
1011
from flask_sqlalchemy import SQLAlchemy
1112
import logging
@@ -15,5 +16,10 @@
1516
app.logger.addHandler(logging.StreamHandler())
1617
app.logger.setLevel(logging.INFO)
1718

19+
# set up flask SQLAlchemy db uri
20+
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://docker@' + \
21+
os.environ['POSTGRES_PORT_5432_TCP_ADDR'] + ':' + \
22+
os.environ['POSTGRES_PORT_5432_TCP_PORT'] + '/docker'
23+
1824
# This is the SQLAlchemy ORM object
1925
db = SQLAlchemy(app)

certs/.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Ignore certificate files and keys, those must not be commited/published!
2+
*.crt
3+
*.csr
4+
*.key

certs/dhparams.pem

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-----BEGIN DH PARAMETERS-----
2+
MIIBCAKCAQEAm+GxaTqFwuw/rcg++CQ4YBNE+QVIpAicQKFSanWjIYSrIAMJ+MOL
3+
DYaRxQw8pzUhF0RoGPK41ap+61SRPP4YQXUhCmbH+mRc+SD4HOJm1Yf6PNY0Ze7X
4+
SW+ZhDImAiIpMwfqK/hClVEWJ3jBkaVnmtUnKeIuBohNlhoW+nskrH3nRgcJWuVh
5+
gDXATKQf2jAD9l2Yr7HUogBM9JnnYJ5HMK1jpPDmhVeO/WuQB1qHTb5EZrGZV2s6
6+
53SNZrMpMkNaRqyCLuafONBtucJRRP2hZjXK345r0+9n8Z4vs8e/hHLlZlBHwOg/
7+
C7Ny0wdwKAM5v2V43DCpl7VhAjbivgolUwIBAg==
8+
-----END DH PARAMETERS-----

certs/gencert.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
NAME=default
3+
openssl genrsa -out $NAME.key 4096
4+
openssl req -new -key $NAME.key -out $NAME.csr -subj "/OU=IAI/CN=localhost/O=Universitaet Bremen/C=DE"
5+
openssl x509 -req -days 365 -in $NAME.csr -signkey $NAME.key -out $NAME.crt
6+
rm $NAME.csr
File renamed without changes.

config/nginx.tmpl

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the
2+
# scheme used to connect to this server
3+
map $http_x_forwarded_proto $proxy_x_forwarded_proto {
4+
default $http_x_forwarded_proto;
5+
'' $scheme;
6+
}
7+
8+
# If we receive Upgrade, set Connection to "upgrade"; otherwise, delete any
9+
# Connection header that may have been passed to this server
10+
map $http_upgrade $proxy_connection {
11+
default upgrade;
12+
'' '';
13+
}
14+
15+
gzip_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
16+
17+
# Maximum upload size (affects size of text a user can type in the editor). Default is 1 MB
18+
client_max_body_size 20M;
19+
20+
log_format vhost '$host $remote_addr - $remote_user [$time_local] '
21+
'"$request" $status $body_bytes_sent '
22+
'"$http_referer" "$http_user_agent"';
23+
24+
access_log /proc/self/fd/1 vhost;
25+
error_log /proc/self/fd/2;
26+
27+
# HTTP 1.1 support
28+
proxy_http_version 1.1;
29+
proxy_buffering off;
30+
proxy_set_header Host $http_host;
31+
proxy_set_header Upgrade $http_upgrade;
32+
proxy_set_header Connection $proxy_connection;
33+
proxy_set_header X-Real-IP $remote_addr;
34+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
35+
proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
36+
37+
proxy_read_timeout 600s;
38+
{{ $cert := "default" }}
39+
40+
server {
41+
listen 80;
42+
server_name localhost data.open-ease.org;
43+
# entrypoint that connects to ros service on the host
44+
# TODO: figure out howto make the IP a variable so that openEASE can connect
45+
# to remote ROS master.
46+
#location ~ ^/ws/remote/(.*)$ {
47+
#rewrite /ws/remote/.*/(.*) /$1 break;
48+
#proxy_pass http://$1:9090;
49+
#}
50+
# Allow connections to ROS master on docker host via /ws/remote/172.17.42.1
51+
location /ws/host {
52+
rewrite /ws/host/(.*) /$1 break;
53+
proxy_pass http://172.17.0.1:9090;
54+
}
55+
56+
# iterates over all containers and creates 'location' entries
57+
# websocket endpoints: /ws/<container-name>
58+
{{ range $host, $containers := groupByMulti $ "Env.VIRTUAL_HOST" "," }}
59+
{{ range $container := $containers }}
60+
{{ if $container.Env.VIRTUAL_PORT }}
61+
{{ range $i, $address := $container.Addresses }}
62+
{{ $network := index $container.Networks 0 }}
63+
{{ if eq $address.Port $container.Env.VIRTUAL_PORT }}
64+
# Container {{ $host }}
65+
{{ if eq $host "openease" }}
66+
location / {
67+
{{ else }}
68+
location /ws/{{ $host }}/ {
69+
rewrite /ws/{{ $host }}/(.*) /$1 break;
70+
{{ end }}
71+
proxy_pass http://{{ $network.IP }}:{{ $address.Port }};
72+
{{ end }}
73+
{{ end }}
74+
{{ end }}
75+
{{ end }}
76+
}
77+
{{ end }}
78+
}
79+
80+
{{ if (and (ne $cert "") (exists (printf "/etc/nginx/certs/%s.crt" $cert)) (exists (printf "/etc/nginx/certs/%s.key" $cert))) }}
81+
server {
82+
server_name localhost data.open-ease.org;
83+
listen 443 ssl;
84+
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
85+
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA;
86+
ssl_prefer_server_ciphers on;
87+
ssl_session_timeout 10m;
88+
ssl_session_cache shared:SSL:50m;
89+
ssl_certificate /etc/nginx/certs/{{ (printf "%s.crt" $cert) }};
90+
ssl_certificate_key /etc/nginx/certs/{{ (printf "%s.key" $cert) }};
91+
ssl_dhparam /etc/nginx/certs/dhparams.pem;
92+
add_header Strict-Transport-Security "max-age=31536000";
93+
proxy_redirect http:// https://;
94+
location / {
95+
proxy_pass http://localhost;
96+
}
97+
}
98+
{{ end }}

webrob/config/settings.py config/settings.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
MAIL_PASSWORD = os.environ.get('OPENEASE_MAIL_PASSWORD')
1919
MAIL_DEFAULT_SENDER = '"Sender" <[email protected]>'
2020

21+
USE_HOST_KNOWROB = bool(os.environ.get('OPENEASE_USE_HOST_KNOWROB', 'False'))
22+
2123
FACEBOOK_APP_TOKENS = (os.environ.get('FACEBOOK_APP_ID'), os.environ.get('FACEBOOK_APP_SECRET'))
2224
TWITTER_APP_TOKENS = (os.environ.get('TWITTER_APP_ID'), os.environ.get('TWITTER_APP_SECRET'))
2325
GITHUB_APP_TOKENS = (os.environ.get('GITHUB_APP_ID'), os.environ.get('GITHUB_APP_SECRET'))
@@ -29,7 +31,6 @@
2931

3032
MAX_HISTORY_LINES = 100
3133

32-
MESH_REPOSITORIES = map(lambda x: tuple(x.split(' ')),
33-
os.getenv('OPENEASE_MESHES', 'git https://github.com/PR2/pr2_common').split(','))
34-
35-
ROS_DISTRIBUTION = os.getenv('OPENEASE_ROS_DISTRIBUTION', 'indigo')
34+
MESH_URDF_SERVER = os.environ.get('MESH_URDF_SERVER')
35+
if bool(MESH_URDF_SERVER)==False:
36+
MESH_URDF_SERVER='http://neem-1.informatik.uni-bremen.de/data/'

0 commit comments

Comments
 (0)