Create and deploy simple openscad api #228

Merged
Irev-Dev merged 2 commits from kurt/219-222 into main 2021-03-09 08:40:49 +01:00
Irev-Dev commented 2021-03-07 07:38:58 +01:00 (Migrated from github.com)

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.

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.
Irev-Dev (Migrated from github.com) reviewed 2021-03-07 07:42:11 +01:00
@@ -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.
```bash
docker-compose up --build
Irev-Dev (Migrated from github.com) commented 2021-03-07 07:42:11 +01:00

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.

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.
Irev-Dev (Migrated from github.com) reviewed 2021-03-07 07:46:55 +01:00
@@ -25,2 +1,2 @@
})
}
const openScadBaseURL =
'https://x2wvhihk56.execute-api.us-east-1.amazonaws.com/dev'
Irev-Dev (Migrated from github.com) commented 2021-03-07 07:46:55 +01:00

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.

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.
Irev-Dev (Migrated from github.com) reviewed 2021-03-07 07:51:00 +01:00
Irev-Dev (Migrated from github.com) left a comment

Couple things I should fix up now.

Couple things I should fix up now.
Irev-Dev (Migrated from github.com) commented 2021-03-07 07:48:19 +01:00

I should commit this bash script I think. TODO

I should commit this bash script I think. TODO
Irev-Dev (Migrated from github.com) commented 2021-03-07 07:49:17 +01:00

I'll delete this readme, made redundant by the better one in the api/src/docker. 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 */* :(
- '*/*'
Irev-Dev (Migrated from github.com) commented 2021-03-07 07:50:08 +01:00

There's a bit of nuance here that I should capture in a comment. TODO

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.js
preflightrender:
Irev-Dev (Migrated from github.com) commented 2021-03-07 07:50:39 +01:00

reference comment in openscad.js. TODO

reference comment in openscad.js. TODO
Irev-Dev (Migrated from github.com) reviewed 2021-03-07 19:59:09 +01:00
@@ -0,0 +1,151 @@
service: cad-lambdas
Irev-Dev (Migrated from github.com) commented 2021-03-07 19:59:09 +01:00
https://www.serverless.com/
franknoirot (Migrated from github.com) reviewed 2021-03-09 02:16:59 +01:00
@@ -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 */* :(
- '*/*'
franknoirot (Migrated from github.com) commented 2021-03-09 02:16:59 +01:00

This */* issue is a good future in-the-weeds task for someone really looking to learn lambdas!

This `*/*` issue is a good future in-the-weeds task for someone really looking to learn lambdas!
franknoirot (Migrated from github.com) approved these changes 2021-03-09 02:21:51 +01:00
franknoirot (Migrated from github.com) left a comment

Looks great, I don't know how you waded through that shell script docker lambda inception so quickly.

Looks great, I don't know how you waded through that shell script docker lambda inception so quickly.
franknoirot (Migrated from github.com) commented 2021-03-09 02:19:48 +01:00

Clean! 🧼 I like how this is shaped on the frontend.

Clean! 🧼 I like how this is shaped on the frontend.
Irev-Dev commented 2021-03-09 08:40:42 +01:00 (Migrated from github.com)

Looks great, I don't know how you waded through that shell script docker lambda inception so quickly.

With great sadness 😂.

> Looks great, I don't know how you waded through that shell script docker lambda inception so quickly. `With great sadness` 😂.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: h3n3/cadhub#228