Create and deploy simple openscad api #228
Reference in New Issue
Block a user
Delete Branch "kurt/219-222"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A minimal frontend integration has been added to as a POC
resolves #219 and #222
https://user-images.githubusercontent.com/29681384/110231357-77055b00-7f6b-11eb-85ea-fd0b9e2ede01.mov
The local development setup is not great, so I've made #227 to come back and fix that later (probably fairly soon).
This api is completely seperate to the rest of the apps api (or whatever you call graphql), and I think that's fine!?
I'll add more comments inline.
@@ -0,0 +16,4 @@Because of the way the docker containers to be deployed as lambdas on aws are somewhat specialised for the purpose we're using `docker-compose` to spin one up for each function/endpoint. But more work needs to be done to get this to work with the app locally.```bashdocker-compose up --buildBecause the lambda functions needed are suposed to run in aws-land they can't be used directly, so I plan on making a dev only docker container that does a bit of aws emulation so that we can use them locally. I started doing this with with the docker-compose file, but I think it will make more sense to get this bit of work done when I start actually iterating on the openscad api (atm it's very simple).
It's not great to be writing dev only code (emulating aws), and the serverless framework I'm using does have a offline plugin that I've used before, but doesn't seem to like docker lambdas.
@@ -25,2 +1,2 @@})}const openScadBaseURL ='https://x2wvhihk56.execute-api.us-east-1.amazonaws.com/dev'wasn't sure if I should commit this.
I can make it an env var instead, but that makes it a pain for anyone new forking the repo, as they'ed need to get it off me before they can use openscad locally. This isn't a secret so I think it's fine.
Couple things I should fix up now.
I should commit this bash script I think. TODO
I'll delete this readme, made redundant by the better one in the api/src/docker. TODO
@@ -0,0 +24,4 @@# we need to allow binary types to be able to send back images and stls, but it would be better to be more specific# ie image/png etc. as */* treats everything as binary including the json body as the input the lambdas# which mean we need to decode the input bode from base64, but the images break with anything other than */* :(- '*/*'There's a bit of nuance here that I should capture in a comment. TODO
@@ -0,0 +52,4 @@functions:# see preflightoptions comment in openscad.jspreflightrender:reference comment in openscad.js. TODO
@@ -0,0 +1,151 @@service: cad-lambdashttps://www.serverless.com/
@@ -0,0 +24,4 @@# we need to allow binary types to be able to send back images and stls, but it would be better to be more specific# ie image/png etc. as */* treats everything as binary including the json body as the input the lambdas# which mean we need to decode the input bode from base64, but the images break with anything other than */* :(- '*/*'This
*/*issue is a good future in-the-weeds task for someone really looking to learn lambdas!Looks great, I don't know how you waded through that shell script docker lambda inception so quickly.
Clean! 🧼 I like how this is shaped on the frontend.
With great sadness😂.