Skip to content
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

Add support for different DB drivers #623

Merged
merged 41 commits into from
Nov 20, 2019
Merged

Add support for different DB drivers #623

merged 41 commits into from
Nov 20, 2019

Conversation

Pavel910
Copy link
Collaborator

@Pavel910 Pavel910 commented Nov 20, 2019

This PR contains many improvements with focus on support for different DB drivers (#575).
Along the way I also worked on Windows support, so you can setup our repo and deploy everything on Windows (closes #620).

To enable support for different drivers we had to push the usage of plugins a little bit further, here is an example of an apollo service configuration (see the apolloService key):

files:
  component: "@webiny/serverless-files"
  inputs:
    region: ${vars.region}
    bucket: ${vars.bucket}
    functions:
      apolloService:
        memory: 512
        timeout: 10
        uploadMinFileSize: 0 # 0 MB
        uploadMaxFileSize: 26214400 # 25 MB
        plugins:
          - factory: "@webiny/api-plugin-create-apollo-handler"
            options: ${vars.apollo}
          - factory: "@webiny/api-plugin-commodo-mongodb"
            options: ${vars.commodo}
          - factory: "@webiny/api-security/plugins/service"
            options: ${vars.security}
          - "@webiny/api-files/plugins"
          - "@webiny/api-plugin-files-resolvers-mongodb"
      downloadFile:
        memory: 512
        timeout: 10
      imageTransformer:
        memory: 1024
        timeout: 10

A few things to note here:

  1. Apollo handler is now a plugin as well, so you can control how the Apollo handler is being created.
  2. The Commodo driver for MongoDB is now also a plugin @webiny/api-plugin-commodo-mongodb. This way you can easily replace the driver plugin.
  3. @webiny/api-plugin-files-resolvers-mongodb - this is a set of plugins for data resolvers that are using some DB native constructs, like Mongo aggregate. We've implemented those resolvers via plugins, so when you replace a DB driver, you'll also have to provide a set of plugins to resolve the data using your database of choice.

Pavel910 and others added 30 commits November 13, 2019 12:00
This commit refactors components and serverless template to work mostly
with plugins. This enables us to customize apollo handler, apollo gateway,
database drivers, etc. via plugins.
Copy link
Member

@adrians5j adrians5j left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome stuff! 🚀

@Pavel910 Pavel910 merged commit 82a6d66 into webiny:master Nov 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

yarn setup-repo fails on Windows
2 participants