Skip to content

Commit 52f32e5

Browse files
johltnaothms
authored andcommittedJul 24, 2022
Progress on validation (AECgeeks#4)
1 parent 1877ed0 commit 52f32e5

29 files changed

+2783
-1118
lines changed
 

‎.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ application/bimsurfer_temp/
1414
application/static/test.jpg
1515
application/checks/ifcopenshell/
1616
application/checks/request_builder.py
17+
application/checks/test_bsdd_v2.py
18+
application/checks/test_bsdd_v3.py
1719
application/checks/dresult_bsdd.json
1820
application/checks/result_bsdd.json
1921
application/checks/__pycache__
@@ -22,4 +24,4 @@ application/checks/tests/test_files
2224
application/decoded.json
2325
application/test_send.py
2426
*.txt
25-
application/ifcopenshell
27+
application/ifcopenshell

‎.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
[submodule "application/bimsurfer"]
22
path = application/bimsurfer
33
url = https://github.com/AECgeeks/BIMsurfer2
4-
[submodule "application/checks/ifc-python-parser"]
5-
path = application/checks/ifc-python-parser
6-
url = https://github.com/johltn/ifc-python-parser
74
[submodule "application/checks/step-file-parser"]
85
path = application/checks/step-file-parser
96
url = https://github.com/IfcOpenShell/step-file-parser

‎README.md

+52
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,56 @@ docker-compose up -d
1111
~~~
1212

1313
## Development notes
14+
1415
Remember to store credentials as environment variables in `/etc/environment`
16+
17+
### Nginx proxy on dev server
18+
19+
~~~
20+
apt install nginx snapd
21+
snap install --classic certbot
22+
certbot --nginx
23+
~~~
24+
25+
Add section below to /etc/nginx/sites-enabled/default
26+
27+
~~~
28+
client_max_body_size 4G;
29+
keepalive_timeout 5;
30+
31+
32+
location @app {
33+
proxy_pass http://localhost:5000;
34+
proxy_redirect off;
35+
36+
proxy_set_header Host $http_host;
37+
proxy_set_header X-Real-IP $remote_addr;
38+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
39+
proxy_set_header X-Forwarded-Proto $scheme;
40+
}
41+
~~~
42+
43+
Comment out lines (not consecutive in file)
44+
45+
~~~
46+
root /var/www/html;
47+
index index.html index.htm index.nginx-debian.html;
48+
~~~
49+
50+
Change to
51+
52+
~~~
53+
try_files $uri @app;
54+
~~~
55+
56+
Finally run to restart nginx
57+
58+
~~~
59+
systemctl restart nginx
60+
~~~
61+
62+
Start flask with
63+
64+
~~~
65+
./run_local.sh
66+
~~~

‎application/Dockerfile

+20-27
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,55 @@
1-
FROM debian:buster-slim
1+
FROM ubuntu:latest
2+
3+
ARG DEBIAN_FRONTEND=noninteractive
24

35
WORKDIR /
4-
RUN apt-get -y update && apt-get -y --no-install-recommends --no-install-suggests install git python3 python3-pip unzip wget libpq-dev build-essential libssl-dev libffi-dev libxml2-dev libxslt1-dev zlib1g-dev npm python3-setuptools python3-dev python3-wheel supervisor
6+
RUN apt-get -y update && apt-get -y --no-install-recommends --no-install-suggests install git python3 python3-pip unzip wget libpq-dev build-essential libssl-dev libffi-dev libxml2-dev libxslt1-dev zlib1g-dev python3-setuptools python3-dev python3-wheel supervisor
7+
8+
ENV LC_ALL=C.UTF-8
9+
ENV LANG=C.UTF-8
10+
11+
RUN wget https://downloads.python.org/pypy/pypy3.8-v7.3.7-linux64.tar.bz2
12+
RUN tar -xf pypy3.8-v7.3.7-linux64.tar.bz2
13+
ENV PATH="${PATH}:/pypy3.8-v7.3.7-linux64/bin"
14+
15+
RUN /pypy3.8-v7.3.7-linux64/bin/python3 -m ensurepip
16+
17+
RUN /pypy3.8-v7.3.7-linux64/bin/python3 -m pip install --upgrade pip
18+
RUN /pypy3.8-v7.3.7-linux64/bin/python3 -m pip install lark-parser
519

620
RUN python3 -m pip install --upgrade pip
721

8-
RUN python3 -m pip install flask flask-cors numpy Pillow gunicorn rq redis SQLAlchemy==1.3.24 psycopg2 sqlalchemy-utils Flask-BasicAuth flasgger requests flask-dropzone lark-parser pyparsing XlsxWriter fuzzywuzzy python-Levenshtein requests_oauthlib Authlib requests argparse --upgrade
9-
RUN npm install -g jsdoc gltf-pipeline requirejs npx uglify-js
22+
RUN python3 -m pip install flask flask-cors numpy gunicorn rq redis SQLAlchemy==1.4.31 psycopg2 psycopg2cffi sqlalchemy-utils Flask-BasicAuth flasgger requests pyparsing XlsxWriter requests_oauthlib Authlib requests argparse --upgrade
1023

1124
# IfcConvert v0.6.0
1225
RUN wget https://s3.amazonaws.com/ifcopenshell-builds/IfcConvert-v0.6.0-c15fdc7-linux64.zip -O /tmp/IfcConvert.zip
1326
RUN unzip /tmp/IfcConvert.zip -d /usr/bin
1427

15-
RUN wget -O /tmp/ifcopenshell_python.zip https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-`python3 -c 'import sys;print("".join(map(str, sys.version_info[0:2])))'`-v0.6.0-c15fdc7-linux64.zip
28+
RUN wget -O /tmp/ifcopenshell_python.zip https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-`python3 -c 'import sys;print("".join(map(str, sys.version_info[0:2]))[0:2])'`-v0.7.0-883b8a5-linux64.zip
1629
RUN mkdir -p `python3 -c 'import site; print(site.getusersitepackages())'`
1730
RUN unzip -d `python3 -c 'import site; print(site.getusersitepackages())'` /tmp/ifcopenshell_python.zip
1831

19-
2032
# Temporary 'hotfix'
21-
RUN wget -O `python3 -c 'import site; print(site.getusersitepackages())'`/ifcopenshell/validate.py https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.6.0/src/ifcopenshell-python/ifcopenshell/validate.py
33+
RUN wget -O `python3 -c 'import site; print(site.getusersitepackages())'`/ifcopenshell/validate.py https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.7.0/src/ifcopenshell-python/ifcopenshell/validate.py
2234

2335
# Server
2436
WORKDIR /www
2537
COPY application/*.py /www/
2638
COPY application/templates /www/templates
2739

2840
COPY application/checks /www/checks
29-
RUN unzip -d /www/checks /tmp/ifcopenshell_python.zip
30-
31-
32-
RUN mkdir -p /www/checks/ifcopenshell/mvd
33-
RUN echo 1
34-
RUN git clone https://github.com/opensourceBIM/python-mvdxml /www/checks/ifcopenshell/mvd
3541

36-
# RUN ls www/checks/ifcopenshell/
37-
# RUN mv python-mvdxml/* www/checks/ifcopenshell/mvd
38-
# RUN ls www/checks/ifcopenshell/
42+
COPY application/*.yml /www/
3943

4044
COPY .git/HEAD /tmp/.git/HEAD
4145
COPY .git/refs/ /tmp/.git/refs/
4246
RUN /bin/bash -c '(cat /tmp/.git/$(cat /tmp/.git/HEAD | cut -d \ -f 2)) || cat /tmp/.git/HEAD' > /version
4347
RUN sed -i "4i<script>console.log('pipeline version: $(cat /version)');</script>" /www/templates/*.html
4448
RUN rm -rf /tmp/.git
4549

46-
RUN npm i -D @babel/preset-env @babel/core @babel/cli
47-
4850
COPY application/static /www/static/
4951
COPY application/bimsurfer/bimsurfer /www/static/bimsurfer
5052

51-
WORKDIR /www/static
52-
# RUN jsdoc -r -d docs bimsurfer
53-
RUN r.js -o baseUrl=. name=App out=App.built.js optimize=none
54-
RUN npx babel App.built.js -o App.built.es2015.js --presets=@babel/preset-env --compact false
55-
RUN uglifyjs --compress -o App.$(cat /version).js -- App.built.es2015.js
56-
RUN npx babel bimsurfer/lib/DRACOLoader.js -o bimsurfer/lib/DRACOLoader.es2015.js --presets=@babel/preset-env --compact false
57-
RUN uglifyjs --compress -o bimsurfer/lib/three.gltf.orbit.draco.min.js -- bimsurfer/lib/three.js bimsurfer/lib/GLTFLoader.js bimsurfer/lib/DRACOLoader.es2015.js bimsurfer/lib/OrbitControls.js
58-
RUN rm -rf node_modules package-lock.json
59-
6053
COPY application/queue.conf /etc/supervisord.conf
6154

6255
WORKDIR /www

0 commit comments

Comments
 (0)