Coder Social home page Coder Social logo

interopxyz / compute.rhino3d Goto Github PK

View Code? Open in Web Editor NEW

This project forked from emilpoulsen/compute.rhino3d

1.0 1.0 0.0 364 KB

REST geometry server based on RhinoCommon and headless Rhino

Batchfile 0.04% C# 83.66% Python 16.00% PowerShell 0.30%

compute.rhino3d's Introduction

Rhino Compute Server

Build status Discourse users

A REST api exposing Rhino's geometry core. This project has two web services: compute.geometry which provides the REST API, and compute.frontend that provides authentication, request stashing (saving POST data for diagnostics), logging, and configuration of request and response headers. compute.frontend creates the compute.geometry process, monitors its health, and restarts compute.geometry as necessary.

Getting Started

  1. Get the latest build from the master branch (or build from source).
  2. Create a Windows Server 2016 computer.
  3. Remote desktop onto server.
  4. Copy src/bin/Release to the server.
  5. Install Rhino using PowerShell* (as administrator):
    • In PowerShell: cd _C:\Users\[USERNAME]\Desktop\Release\deployment\_.
    • Run the admin script using: .\headless_admin.ps1 -updaterhino. This will download the Rhino installer and place it in the deployment directory.
    • Once downloaded, double-click on rhinoinstaller.exe and install like you typically would.
  6. Run and license Rhino. Be sure to validate your license.
  7. Open cmd.exe, cd to the Release directory and run compute.frontend.exe.
  8. For next steps, see Configuration and Running Compute as a service.

* We include a PowerShell script to make easy to download Rhino on Windows Server with it's strict default internet security settings.

Configuration

URL reservation

Release builds of Compute listen on all available IP addreses by default. For this to work, you must:

  1. Start PowerShell as Administrator.
  2. For HTTP, netsh http add urlacl url="http://+:80/" user="Everyone".
  3. For HTTPS, netsh http add urlacl url="https://+:443/" user="Everyone".

Environment variables

All configuration of Compute is done via environment variables.

Environment variable Type Default Description
COMPUTE_HTTP_PORT integer 80 (Release), 8888 (Debug) Port to run HTTP server
COMPUTE_HTTPS_PORT integer 0 Port to run HTTPS server
COMPUTE_SPAWN_GEOMETRY_SERVER bool true (Release), false (Debug) When True, compute.frontend will spawn compute.geometry at http://localhost on port COMPUTE_BACKEND_PORT. Defaults to false in Debug so that you can run both compute.geometry and compute.frontend in the debugger. Configure this in Solution > Properties > Startup Project.
COMPUTE_BACKEND_PORT integer 8081 Sets the TCP port where compute.geometry runs.
COMPUTE_AUTH_METHOD string RHINO_ACCOUNT: Enables authentication via Rhino Accounts OAuth2 Token. Get your token at https://www.rhino3d.com/compute/login and pass it using a Bearer Authentication header in your HTTP request: Authorization: Bearer <YOUR TOKEN>.
API_KEY: Enables athentication via simple API key that looks like an email address.
COMPUTE_LOG_RETAIN_DAYS integer 10 Delete log files after 10 days.
COMPUTE_LOG_CLOUDWATCH bool false Stream logs to Amazon CloudWatch.
COMPUTE_STASH_METHOD string TEMPFILE TEMPFILE: Enables stashing POST input data to a temp file.
AMAZONS3: Enables stashing POST input data to an Amazon S3 bucket.
COMPUTE_STASH_S3_BUCKET string Name of the Amazon S3 bucket where POST input data should be stashed. Requires COMPUTE_STASH_METHOD=AMAZONS3
AWS_ACCESS_KEY string Amazon Web Services Access Key for your account. If compute is running on EC2, consider using EC2 Instance Profiles; Compute will find and use your credentials so they don't need to be on your instance.
AWS_SECRET_ACCESS_KEY string Amazon Web Services Secrete Access Key for your account. If compute is running on EC2, consider using EC2 Instance Profiles; Compute will find and use your credentials so they don't need to be on your instance.
AWS_REGION_ENDPOINT string "us-east-1" Amazon Web Services Region Endpoint

SSL certificate (optional)

Add LetsEncrypt SSL Certificate for HTTPS support:

  • Download from https://github.com/PKISharp/win-acme/releases/tag/v1.9.8.4
  • Unzip download on the server.
  • Start PowerShell as Administrator.
  • cd to unzipped directory.
  • .\letsencrypt.exe
  • N create new certificate.
  • 4 manually input host names.
  • compute.rhino3d.com (or similar)
  • 1 for default web site.
  • [email protected] for the user to receive issues.
  • yes to accept the license agreement.
  • Q to Quit.

Running Compute as a service

Compute uses TopShelf to make it easy to configure and run it as a service on Windows.

  1. Start cmd.exe as Administrator.
  2. In cmd: cd C:\Users\[USERNAME]\Desktop\Release\
  3. Run compute.frontend install to install as a service.
  4. In the interactive menu, enter your username in the format .\\[USERNAME] (for example:.\steve) and use the administrator password for this account.

Building from source

  1. Install Rhino WIP.
  2. Start Rhino WIP to configure its license.
  3. Load compute.sln and compile as Debug.
  4. In Solution Explorer, right-click Solution 'compute', then click Properties
  5. In the Startup Project tab, select Multiple Startup Projects, then set both compute.frontend and compute.geometry to Start.
  6. Start the application in the debugger.
  7. Browse to http://localhost:8888/version or http://localhost:8888/sdk

Notes

  • There is a health check URL (/healthcheck) in case you want to set up a load balancer

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.