Git Product home page Git Product logo

Comments (9)

florianwiech avatar florianwiech commented on May 4, 2024 3

Thank you for providing an initial aws-cdk setup! I think the idea with CloudFront for static assets is great.

Since over time some things have changed (added remix AWS Architect deployment option, aws-cdk v2 release, ...), I have built an example deployment based on the current project versions:
remix-aws-cdk-example

It is based on the AWS Architect remix template (and still uses it for the local development). The deployment can be done via aws-cdk v2.

from remix.

florianwiech avatar florianwiech commented on May 4, 2024 2

@ryan-mars You're right, I get the same warnings.
I think we need to give it some more time until those warnings might be resolved by itself through dependency updates.

Here are some infos I could gather regarding the status of those warnings:
FYI: We use the @remix-run/architect package. Yes it is called architect, but it is actually a generic adapter for AWS Lambda behind API Gateway (#1038).
If we have a quick look at our dependency tree we can see the following: @remix-run/architect > @remix-run/node > @web-std/file.
I was able to find a merge request regarding those warnings in their repo. The fix is already merged, although I was not able to find a release on npm yet. If that is shipped we could update the lockfile and might be good to go without the warnings.


Note to myself: Gosh I really have to add a dependabot to the example repo that there is some sort of automation on keeping it up-to-date.

from remix.

m14t avatar m14t commented on May 4, 2024 1

@shortjared had the idea to use multiple CloudFront origins. With this we can serve all public/* files from an S3 bucket and then fallback to serving all other requests from API Gateway.

This has been implemented in m14t/starter-aws-cdk@1e32ff2 and can be seen working at https://d3cmgcnia7ll9p.cloudfront.net. 🎉

The favicon.ico is still being served from the lambda (via the CDN), so we can either choose to add another "Behavior" to also serve that from the S3 bucket or leave things as is. It would be nice to be able to remove the serveStaticFileIfExists function, but this would mean needing to keep this Behavior part of deployment config in sync any time we added a new static asset which I'm not a fan of.


With that all being said, there are certainly improvements that could be made, but I think this is a workable solution.

Happy to hear any feedback, questions, or suggestions!

from remix.

florianwiech avatar florianwiech commented on May 4, 2024 1

@florianwiech , apologies for the newbie-type questions:

  1. Could the 'makefile' and 'deploy.sh' calls be integrated directly into the package.json file, in theory (what are the benefits of having those files?)?

BTW, thank you VERY much for this offering 🙏🏾

Sure, it is totally fine to use other utilities for running scripts (eg. providing scripts inside the package.json as you mentioned).
I also started with package.json scripts but eventually these scripts increased in size and parameter length. It basically bloated the package.json scripts section. That was the reason I moved to the makefile and deploy.sh layout.

In my case I chose the makefile to group cli commands so that I do not have to retype then while developing.
The deploy.sh basically wraps the cdk deploy command with all the needed parameters and directory structure it needs.


If there are other questions regarding some remix-aws-cdk-example specifics I would suggest opening a ticket in the remix-aws-cdk-example repo. This way we can keep this thread targeted to the remix aws-cdk integration.

from remix.

florianwiech avatar florianwiech commented on May 4, 2024 1

@ryan-mars Thank you for pointing out that the latest release of remix introduced some breaking changes.
I updated the example and it should work with the latest remix version now. (florianwiech/remix-aws-cdk-example@f6d5cd1)


Moreover, I introduced yarn workspaces for better project separation and extended the readme.

from remix.

sixman9 avatar sixman9 commented on May 4, 2024

@florianwiech , apologies for the newbie-type questions:

  1. Could the 'makefile' and 'deploy.sh' calls be integrated directly into the package.json file, in theory (what are the benefits of having those files?)?

BTW, thank you VERY much for this offering 🙏🏾

from remix.

ryan-mars avatar ryan-mars commented on May 4, 2024

Does anyone have a working version of Remix deployed via CDK? None of the projects mentioned in this thread seem to be maintained and work with latest Remix.

from remix.

ryan-mars avatar ryan-mars commented on May 4, 2024

@florianwiech Thanks! I got it to mostly work by disabling minifcation but even with your changes I still get bundler warnings... do you see this too?

Bundling asset remix/RequestHandler/Code/Stage...
▲ [WARNING] Non-relative path "packages/file/src/lib.js" is not allowed when "baseUrl" is not set (did you forget a leading "./"?)

    node_modules/@web-std/file/tsconfig.json:6:24:
      6 │       "@web-std/file": ["packages/file/src/lib.js"]
        ╵                         ~~~~~~~~~~~~~~~~~~~~~~~~~~

▲ [WARNING] Non-relative path "packages/blob/src/lib.js" is not allowed when "baseUrl" is not set (did you forget a leading "./"?)

    node_modules/@web-std/blob/tsconfig.json:6:24:
      6 │       "@web-std/blob": ["packages/blob/src/lib.js"]
        ╵                         ~~~~~~~~~~~~~~~~~~~~~~~~~~

2 warnings

from remix.

ryan-mars avatar ryan-mars commented on May 4, 2024

@florianwiech Thank you so much!

from remix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.