-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create and deploy simple openscad api #228
Conversation
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. | ||
|
||
```bash | ||
docker-compose up --build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because 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.
@@ -1,34 +1,50 @@ | |||
const openScadBaseURL = | |||
'https://x2wvhihk56.execute-api.us-east-1.amazonaws.com/dev' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple things I should fix up now.
api/src/docker/openscad/Dockerfile
Outdated
RUN apt-get install -y curl | ||
|
||
# install node 14, (maybe I should put the .sh file into version control?) | ||
RUN curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should commit this bash script I think. TODO
api/src/docker/openscad/readme.md
Outdated
@@ -0,0 +1,13 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll delete this readme, made redundant by the better one in the api/src/docker. TODO
apiGateway: | ||
metrics: true | ||
binaryMediaTypes: | ||
- '*/*' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a bit of nuance here that I should capture in a comment. TODO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This */*
issue is a good future in-the-weeds task for someone really looking to learn lambdas!
# variable1: value1 | ||
|
||
functions: | ||
preflightrender: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reference comment in openscad.js. TODO
@@ -0,0 +1,151 @@ | |||
service: cad-lambdas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, I don't know how you waded through that shell script docker lambda inception so quickly.
} | ||
} | ||
const data = await response.blob() | ||
return { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clean! 🧼 I like how this is shaped on the frontend.
|
A minimal frontend integration has been added to as a POC
resolves #219 and #222
Screen.Recording.2021-03-07.at.4.23.01.pm.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.