Skip to content

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/

  1. create project:
    • mkdir d4su-server
    • cd d4su-server
  2. create virtual environment:
    • python -m venv .venv
  3. activate the virtual environment:
    • source .venv/bin/activate
  4. check if active:
    • which python > gives '/Users/lucvanlier/X_PYTHON_APP/d4su-server/.venv/bin/python'
  5. add gitignore:
    • echo "*" > .venv/.gitignore
  6. install packages: pip install -r requirements.txt
  7. 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

  1. 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:
      • mkdocs serve
  2. prod mode:
    • fastapi run
    • to be defined = demonize the celeri worker
    • for MkDocs: mkdocs gh-deploy --force

FastAPI Doc: Available web services

  1. provided by Swagger UI: http://127.0.0.1:8000/docs
  2. 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

Released: Jul 25, 2024

https://pypi.org/procdject/bpy/ https://pypi.org/project/bpy/#files

wheel unpack bpy-4.2.0-cp311-cp311-macosx_11_0_arm64.whl --> NOK

https://medium.com/@xiajiun/how-to-use-blenders-bpy-module-on-python-and-jupyter-notebook-on-macos-9155323d362b

This worked:

  • create a virtual environment with python 3.11.0
  • /usr/local/bin/python3.11 -m venv .venv311
  • activate the virtual environment
  • source .venv311/bin/activate
  • install bpy
  • pip install bpy=4.2.0
  • this collected and installed bpy-4.2.0-cp311-cp311-macosx_11_0_x86_64.whl
  • test with
  • python
  • import bpy
  • exit()