This section describes how to add an app to Giraffe and make it available to the right people.
Once you've designed an app, and set default featureCategories, defaultParams, etc. you need to configure it to run. All apps are run through Google's PubSub service. This means that queuing your app's tasks and scaling your app with multiple workers is taken care of by Giraffe.
<aside> ❓ If your app requires direct access to the Giraffe API (bypassing PubSub), that is possible too. Please email [email protected] for assistance.
</aside>
The apps added to Giraffe are able to be run on any computer connected to the internet. When a user runs an app, the following sequence of events takes place:
<aside> ℹ️ Giraffe leverages the Google cloud pubsub system. You can read about it here. https://cloud.google.com/pubsub/docs/overview.
</aside>
This is how the data flows.
The python script included here requires a credentials.json which allows the server to subscribe to the topic. The python script then uses the name of the app to fire a Grasshopper script of the same name. The python script saves the giraffeModel in a folder specified by the user and the GH script reads it in from that folder. Finally the python script POSTs the GH output from a folder to the Giraffe endpoint specified in the pubsub message.
At the top of main.py set the following variables in order for you server to start.
SCRIPT_DIR = 'C:\\\\Users\\\\Public\\\\gh_load' # SCRIPT TO GO HERE
INPUT_PATH = 'C:\\\\Users\\\\Public\\\\gh_load\\\\gmodel.json' # FOLDER TO LOAD GMODEL (SET AT START OF GH SCRIPT)
OUTPUT_PATH = 'C:\\\\Users\\\\Public\\\\gh_dump\\\\output.json' # FOLDER TO DUMP OUTPUT (SET AT END OF GH SCRIPT)
RESTART_PATH = 'C:\\\\Users\\\\Public\\\\test_plugin\\\\start_subscribe.bat' #bat file that references credentials json
TOPIC_NAME = 'YOUR TOPIC NAME'
run start_subscribe.bat to load in the credentials and start the listener.