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).
-
Setup VM: I suspect it’s a new version and doesn’t match the video ( Rhino App Server - YouTube) but after following all the steps ( Rhino - Deploying to Production Servers (rhino3d.com)) the compute.geometry service is not displayed. → is it usual?
-
Run Hops: install compute in the VM, define URL and KEY in grasshopper (local) and works.
- Request API: Define env variables RHINO_COMPUTE_URL/KEY in local machine. Start the appserver in local machine 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 - -
Sometimes 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)"
}
- 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
And this is what rhino. Compute shows in the vm:
System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:3000
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetResponse()
at compute.geometry.GrasshopperDefinition.ArchiveFromUrl(String url) in /home/runner/work/compute.rhino3d/compute.rhino3d/src/compute.geometry/GrasshopperDefinition.cs:line 1067
at compute.geometry.GrasshopperDefinition.FromUrl(String url, Boolean cache) in /home/runner/work/compute.rhino3d/compute.rhino3d/src/compute.geometry/GrasshopperDefinition.cs:line 93
at compute.geometry.ResthopperEndpointsModule.GrasshopperSolveHelper(Schema input, String body, Stopwatch stopwatch) in /home/runner/work/compute.rhino3d/compute.rhino3d/src/compute.geometry/ResthopperEndpoints.cs:line 99
at compute.geometry.ResthopperEndpointsModule.Grasshopper(NancyContext ctx) in /home/runner/work/compute.rhino3d/compute.rhino3d/src/compute.geometry/ResthopperEndpoints.cs:line 172
at Nancy.Routing.Route.<>c__DisplayClass4.<Wrap>b__3(Object parameters, CancellationToken context)
CG 80 [14:00:45 INF] 170.253.22.152 - [2023-05-01T14:00:45.2363352+00:00] "POST /grasshopper HTTP/1.1" 500 -