-
Notifications
You must be signed in to change notification settings - Fork 4
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
Deploy mljsapi, madliberationjs to a CloudFront distro with API Gateway and S3 #254
Comments
#254 This is after clearing out the files in the repo and running cdk init sample-app --language=typescript
#254 The new experimental deployment process will pull existing application code in as git submodules.
#254 This is to make sure the CI is set up to deploy to an account.
API Gateway might be better due to Lambda@Edge limitationsLambda@Edge has some pretty concerning limitations:
Now I want to see if I can use API Gateway without a custom domain name (thus using the CloudFront distro's TLS certificate) to proxy based on the path and route to, for example, my S3 bucket for passover.lol/, but API Gateway for passover.lol/api. |
#254 Invocation of my endpoint is failing, because it looks like node_modules is missing from my Lambda's ZIP file.
#254 I got this error: ``` $ cdk synth > dev-template-01.yml Cannot find module '@aws-cdk/aws-apigateway' Require stack: - /Users/dougnaphas/repos/madliberation/lib/madliberation-stack.js - /Users/dougnaphas/repos/madliberation/bin/madliberation.ts Subprocess exited with error 1 ``` and running npm i, resulting in the present changes to package-lock.json, fixed it.
The following are sufficient (as of acaa69b) to run the API locally from
Then I can:
|
douglasnaphas/madliberation#254 With this change, the madliberation repo (which includes this repo mljsapi as a submodule) will be able to run mljsapi with `docker-compose up` (without AWS SAM).
#254 This includes submodule changes to mljsapi that add the ability for mljsapi to run locally in a Docker container (not with SAM).
#254 I can now, from madliberation/: $ docker-compose build ... $ docker-compose up ... and $ curl http://localhost:3800/public-endpoint {"Output":"this endpoint is public"}
I'm widening the scope here to include the front-end madliberationjs, because it will be the default origin for the CloudFront distro. |
douglasnaphas/madliberation#254 The function is timing out. It was only using 128 MB of memory, so I increased it to 3008 MB.
douglasnaphas/madliberation#254 This is to try to isolate problems with Apollo and createServer from problems with wiring the Express app up with Lambda.
gh-254 It's already been built, as well, so remove the build command.
I need to set index.html as the default object on the distro. |
gh-254 It doesn't seem to be matching.
gh-254 I'm still getting the error that the origin domaain must be a domain name.
gh-254 Trying to guess why my stripping of /prod/ from the domain name isn't working.
gh-254 This was inspired by looking at the output of `cdk synth`, which includes: ``` lambdaApiurl: Value: Fn::Join: - "" - - https:// - Ref: EndpointEEF1FD8F - .execute-api. - Ref: AWS::Region - "." - Ref: AWS::URLSuffix - / - Ref: EndpointDeploymentStageprodB78BEEA0 - / lambdaApiurltransformed: Value: Fn::Join: - "" - - Ref: EndpointEEF1FD8F - .execute-api. - Ref: AWS::Region - "." - Ref: AWS::URLSuffix - / - Ref: EndpointDeploymentStageprodB78BEEA0 - / ```
New mode of interaction at https://d2zor2cnxtxt2r.cloudfront.net/#/. |
I think I need to set up the existing prod env of passover.lol to have the routing-through-CloudFront approach, because of this in MLJS Configs:
|
douglasnaphas/madliberation#254 This is needed so that: 1. The existing app will still work, and 2. The new setup (CDK) can send the dynamic, environment-specific table name as a variable.
Some things to deal with.
The table name should be fully parameterized so that I can pass it in as an environment variable from the CDK project. |
I need to get the tests passing now that the table name is not hard-coded as |
douglasnaphas/madliberation#254 This includes a fix to some failing tests in joinSeder.test.js, where the env var TABLE_NAME had to be mocked before schema.js was required.
The changes I made on my branch |
I should set SameSite: None when NODE_ENV is "development." It looks like Chrome isn't sending my cookie from localhost:4000 to api-dev.passover.lol. |
douglasnaphas/madliberation#254 Seders are failing in Chrome in dev, because in dev the frontend and backend currently run in different domains for samesite cookie purposes. Chrome now uses samesite lax as the default.
douglasnaphas/madliberation#254 Requests to paths "early" in the server (so to speak), like /scripts, /, and /public-endpoint are intermittently throwing errors.
Closing. The frontend and backend are deployed. I'll set up separate Issues for implementing stages of the workflow (sign-in, listing scripts, joining the seder, etc) in the turnkey env. |
TODO
madliberation/
. We're actually going to run with straight node, because incorporating SAM into the Docker setup is too hard, because SAM itself starts up a containerAccess the API (running with SAM outside of Docker) via port that talks to nginx. This will involve runningWon't do. There's no way for the nginx conf file to reference the out-of-Docker running API, at least not without doing container networking that I don't know how to do. Running with node is close enough to how it will be run in prodsam local start-api
with the--docker-network
option.Run the API locally with SAM, Docker, and docker-compose.Try to run the SAM CLI Docker container from docker-compose. Try something like mapping the volume frommadliberation/mljsapi
.The text was updated successfully, but these errors were encountered: