Set up of the d4SU server in development mode
Summary of port numbers on local host
- 3100 for NodeJS (Integration Server) -- not part of d4SU Server
- 4040 for ngrok web -- not part of d4SU server
- 5173 for That Open (Ifc Viewer)
- 5432 for Postgres
- 5555 for Flower (Celery Monitoring)
- 6379 for Redis Server (Celery Broker and Result Backend; sessions for the Integration Server)
- 8000 for FastAPI
- 8001 for RedisInsight
- 8002 for http-server (serving the files from the local folder X_BIM_FILES)
- 8003 for mkdocs (see mkdocs.yml)
Virtual Environment
follow https://fastapi.tiangolo.com/virtual-environments/
- create project:
- mkdir d4su-server
- cd d4su-server
- create virtual environment:
- python -m venv .venv
- activate the virtual environment:
- source .venv/bin/activate
- check if active:
- which python > gives '/Users/lucvanlier/X_PYTHON_APP/d4su-server/.venv/bin/python'
- add gitignore:
- echo "*" > .venv/.gitignore
- install packages: pip install -r requirements.txt
- intall other with conda
- conda install -c conda-forge pythonocc-core=7.8.1 (for a Jupyter viewer)
- pip install pythreejs (for a Jupyter viewer)
Activation
Activate the virtual environment before starting the server in VS Code. In a terminal:
- source .venv/bin/activate
Run of fastapi & celery
- dev mode:
- terminal 1 - Fastapi:
- fastapi dev src/main.py
- terminal 2 - Celery:
- cd src
- celery -A long_bg_tasks worker -l INFO
- terminal 3 - Flower:
- cd src
- celery -A long_bg_tasks flower
- terminal 4 - MkDocs:
- Documentation moved to another location ; available on GitHub @ https://github.com/lvanlier/lvanlier.github.io
- terminal 1 - Fastapi:
- prod mode:
- fastapi run
- to be defined = demonize the celeri worker
FastAPI Doc: Available web services
- provided by Swagger UI: http://127.0.0.1:8000/docs
- provided by ReDoc: http://127.0.0.1:8000/redoc
MkDocs
Use Mkdocs from github for Mkdocs
Use the table reader (creates a table from a csv or xlsx, ...)
Redis
Install Redis for Docker (to be run in Docker Desktop)
PostgreSQl with PostGIS
PostGIS is apparently available by default.
PostgreSQL with AGE
Install AGE on PostgreSQL 16
- Download Apache AGE 1.5.0
- sudo make PG_CONFIG=/library/PostgreSQL/16/bin/pg_config install
thereafter CREATE EXTENSION age; works
Install bpy (Blender Python) --to be progressed
https://pypi.org/procdject/bpy/ https://pypi.org/project/bpy/#files
https://medium.com/@xiajiun/how-to-use-blenders-bpy-module-on-python-and-jupyter-notebook-on-macos-9155323d362b
This worked:
- Install Python 3.11.0 from the Python site
- Download https://www.python.org/downloads/release/python-3110/
- Install the downloaded pkg
- Python is in /Library/Frameworks/Python.framework/Versions/3.11/Python
- remove the previous .venv311 with: sudo rm -rf .venv311
- Create a venv311
- /Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11 -m venv .venv311
- Activate the vene
- source .venv311/bin/activate
- Install bpy
- pip install bpy==4.3.0
- got bpy-4.3.0-cp311-cp311-macosx_11_0_arm64.whl
- pip install ifcopenshell
- got ifcopenshell-0.8.0-py311-none-macosx_11_0_arm64.whl
- pip install mathutils
Need also to have OpenCASCADE brew install opencascade
======
conda create --name envconda conda activate envconda conda install python=3.11.0 conda install -c conda-forge ifcopenshell conda install shapely --channel conda-forge
======