Rhino Compute Deploy

App server to run Rhino Compute in Azure

Summary: So, to run Hops (1) using VM computation, I just need to set the parameter URL and KEY in preference>solver. To execute the vscode or other application request and get the json (2) I need to run the appserver locally (npm run start). And finally, to use the js application (3), both appservers must be running (local and VM).

  1. Run Hops: install compute in the VM, define URL and KEY in grasshopper (local) and works.

  2. Request API: Define env variables RHINO_COMPUTE_URL/KEY in local machine. Start the appserver in both machines and return the resolved json. It works like a charm.

C:\Users\casas\OneDrive\compute.rhino3d.appserver>npm run start

> @mcneel/compute.rhino3d.appserver@0.1.11 start
> node ./src/bin/www

Started worker 1
RHINO_COMPUTE_URL: http://****/
Listening on port 3000
Go to viewer: http://localhost:3000/view
GET /solve/srf_kmeans.gh?int_resolution=30&int_dimension=30&num_x=0.5&num_y=0.5&int_k=6 200 884.433 ms - -

If both do not start, this error occurs:

{
  "message": "Internal Server Error",
  "stack": "Error: Internal Server Error\n    at C:\\Users\\casas\\OneDrive\\compute.rhino3d.appserver\\src\\routes\\solve.js:152:15\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"
}
  1. Run js app: I need to run both appservers (local and vm) to interact with the gh definition, right? Call from http://localhost:3000/examples/spikyThing/

When i am running boths app servers at the same time (vm and local) it works perfectly (did you refer to that? 'A local appserver can only speak to a local Rhino.Compute instance and a remote appserver can only speak to a remote Rhino.Compute instance.')

> @mcneel/compute.rhino3d.appserver@0.1.11 start
> node ./src/bin/www

Started worker 1
RHINO_COMPUTE_URL: http://*****/
Listening on port 3000
Go to viewer: http://localhost:3000/view
GET /examples/spikyThing/ 304 7.850 ms - -
GET /examples/spikyThing/script.js 304 2.397 ms - -
GET /examples/favicon/site.webmanifest 304 2.245 ms - -
GET /examples/favicon/favicon-32x32.png 304 2.945 ms - -      
POST /solve 200 561.313 ms - -

If both do not start, this error occurs:

GET /examples/spikyThing/ 304 1.793 ms - -
GET /examples/spikyThing/script.js 304 0.869 ms - -
GET /examples/favicon/favicon-32x32.png 304 0.999 ms - -
GET /examples/favicon/site.webmanifest 304 0.953 ms - -
Error: Internal Server Error
    at C:\Users\casas\OneDrive\compute.rhino3d.appserver\src\routes\solve.js:152:15
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
POST /solve 500 4177.648 ms - 249

¿Que es Rhino Compute?

Rhino Compute es un servicio de computación en la nube que permite a los usuarios ejecutar scripts y análisis complejos en Rhino y Grasshopper de manera rápida y sencilla. Utilizando la plataforma de Rhino Compute, los usuarios pueden subir sus archivos de Rhino y Grasshopper a la nube y utilizar la potencia de cálculo de la nube para ejecutar análisis complejos y grandes conjuntos de datos en poco tiempo. Esto permite a los usuarios ahorrar tiempo y recursos en la ejecución de análisis y scripts complejos, y también les permite trabajar de manera colaborativa en proyectos comunes.

  • Rhino.Compute is a geometry server: provides and API for geometry calculation using Rhino's geometry library. This server can process incoming http request to perform geoemtric calculation and or slve gh definitions and return results as a http response.

  • geometry server: The server is running Rhino in a non-user interface mode and makes a portion of the RhinoCommon .NET SDK available in a well defined pattern that matches the functions available in RhinoCommon.

  • Client library: communicate any programming language.

  • Setting up a production enviroment: [[Deployment to production servers]]

  • It works with other http clients: c#, python, JavaScript.

  • Hops: client which can make calls to rhino.compute from grasshopper. These function can increase legibility by simplifying complex definition while reducing duplication. [[Hops]].

Introduction

1a conferencia browser <> compute.rhino3d.appserver <> compute.rhino3d rhino3d.appserver: sources: bin>www: mira que hay en el files directory y cosas relacionadas con funciones de js routes: definitions, index, solve (get the request, handle different requests checking params, collecting inputs, checking cache and solving the definition or returning cache)

localhost:3000: /name_definition (description inputs and outputs), /inint.html (warm up, pasa todos los nested loop -sliders- para precalcularlos y guardarlos en el cache)

Automatizar la ejecución de rhino compute en service buscando el .exe. Mientrads tanto se puede ejecutar en local

2a conferencia server run his own instance of Rhinio Compute in Rhino 7 (tienes que tenerlo) e iniciar el servicio automáticamente Apps: compute.rhino3d: RhinoCommon en Grasshopper, private instance compute.rhino3d.appserver: running gh definitions with different inputs, node.js, cache to improve performance, serves browser and web pages. rhino3dm.js: web assembly, serialice geometry from definitions, create js meshes

example (favicon, app.js es el standard de express apps, index.html) compute.rhino3d.appserver>npm install (en el terminal de vscode)

ECOSYSTEM

browser <> compute.rhino3d.appserver <> compute.rhino3d compute.rhino3d (RhinoCommon, private instance, ) compute.rhino3d.appserver (run gh definintions, node.js express webapps [app.js], cache to improve performance, server browser and web pages) rhino3dm.js (web assembly of RhinoCompute <-> node.js, serialize geometry returned from web-grasshopper, create three.js meshes) example (favicon, apps.js with definition and inputs, index.html)

RHINO COMPUTE: geometry engine

architecture: clients (web base) <> server propio (rhino compute -compute_geometry.exe, authentification, API, cache, Rhino7) <-> server mcneal (cloud zoo)

github: https://github.com/mcneel/compute.rhino3d docs: https://developer.rhino3d.com/guides/compute/ billing: 20 cent/core/hour = 1$/hour = 25$/day = 750$/month (todas las horas encendido) presentación: https://discourse.mcneel.com/t/rhino-grasshopper-web-application-framework-presentation/106635

APPSERVER: A node.js app ans API for remote solving grasshopper definitions in Rhino.Compute

introducción: https://www.youtube.com/watch?v=At4BaIuEE3c architecture: clientes (web base) <> appserver (API, files, cache) <> Rhino.Compute API: / (list of definitions), /definition.gh (display info about input-output), /solve (solve gh definition and return json data), /definition/definitionID (send gh definition file)

local setup and debuging: 1. Rhino.Compute (dl, start, play) build: https://ci.appveyor.com/project/mcneel/compute-rhino3d/build/artifacts problemas con el build: https://discourse.mcneel.com/t/problems-with-some-examples-for-rhino-compute-appserver/122311/9 unzip compute and execute compute.geometry.exe and check version 'localhost:8081/version' (run compute) 2. Rhino.Compute (clone, start, debug, play) github: mcneal/compute.rhino3d/docs/develop.md 3. AppServer (clone, start, debug, play) git: https://github.com/mcneel/compute.rhino3d.appserver open samples in vscode folder live server for vscode (with the samples folder open)

appserver folder squema (run in vscode debug mode): sources (bin, example, files (archivos gh), routes[definitions.js, index.js, solve.js, app.js]) /bin/www: principal puerta de entrada, busca lo que hay en el file directory /routes/solve: get the request, handle differetn reuqest (check paramas, collect inputs, check cache and solve definition or return cache) run in localhost:3000 (/*name_definition, /init.html) localhost:3000/example.gh: descripción de inputs y outputs /init.html: pasa por todas las convinaciones para precalcularlas

remote deployment: could be windows server 2019, kubernetes (they use this), docker

  1. Rhino.Compute (deploy, test, play) docs: mcneal/compute.rhino3d/docs/deploy.md get a remote machine (windows) install rhino and compute (one line of code in docs, paste in powershell). This intall some service for autostart rhinocompute.geometry.exe automatically .url: dirección del remote desktop que quieres que ejecute las definiciones (dentro del código de examples)

  2. AppServer (deploy, test, play)

Deploy overview

Ho to setup a instance of rhino.compute on a virtual machine running IIS (internet information services). We can setup it to process incoming request and forward that request to the rhino.compute instance. The IIS is necessary to relaunch the compute server if it crash or malfunction (otherwise an API would be enough). ISS can launch an instance of compute when it is needed which in turn launch one or more child processes (perform the actual computation). When rhino.compute.exe does not receive request to solve the process will shut down and stop incurring core hour billing. When new request is received, ISS will make sure that rhino.compute.exe is running.

Prerequisites

Create and use the VM

Setup a physical machine to act as a server or create a virtual machine.

Modifying compute parameter after deployment

Updating the deployment

<! node: https://nodejs.org/dist/latest-v13.x/ > docs: https://github.com/mcneel/compute.rhino3d.appserver/blob/main/docs/installation.md posible host: docker image, kubernetes, heroku, windows vm billing & licensing: https://developer.rhino3d.com/guides/compute/core-hour-billing/ añadirlo en plotly: https://dash.plotly.com/external-resources RHINO 3DM github: https://github.com/mcneel/rhino3dm build: https://github.com/mcneel/rhino3dm/blob/main/docs/python/RHINO3DM-BUILD.PY.md utilizando python: https://github.com/mcneel/rhino3dm/blob/main/docs/python/RHINO3DM.PY.md utlizando javascript: https://github.com/mcneel/rhino3dm/blob/main/docs/javascript/RHINO3DM.JS.md ejemplos: https://github.com/mcneel/rhino-developer-samples/tree/7/rhino3dm#samples HOPS documentación: https://developer.rhino3d.com/guides/grasshopper/hops-component/ introducción: https://discourse.mcneel.com/t/create-cpython-components-using-hops-in-grasshopper/120517 JUPYTER USING RHINO.COMPUTE git: https://github.com/kpfdev/Rhino_Compute_Workshop <! - DESARROLLAR PLUGINS VisualStudio: https://github.com/mcneel/rhino3dm install npm in vm with vscode: compute.rhino3d.appserver > npm install > <!- https://designcommunicationfx.com/ ->

Última actualización

¿Te fue útil?