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

complete restructuring #9

Merged
merged 1 commit into from Aug 9, 2021
Merged

complete restructuring #9

merged 1 commit into from Aug 9, 2021

Conversation

lennyburdette
Copy link
Contributor

@lennyburdette lennyburdette commented Aug 6, 2021

This is one of those “I didn’t have time to write you a short letter, so I wrote you a long one” kind of things. I was just trying to get it working but it spiraled out of control. If I had more time before vacation I would break this up in to smaller changes. Instead I'm just going to dump this on you with no expectation that you'll review or merge it. But hopefully it'll be a useful reference for changes you could make before I get back.

  • made the subgraphs independent packages

    allows removing packages from the root package.json and simplifies the dockerfiles. i think this is a better solution than forcing the containers to use x86_64 images on ARM devices.

  • remove typescript from subgraphs and apollo-server implementation

    no need to transpile. i added tsconfig files to get typechecking in your ide.

  • use a prebuilt gateway container image

    able to delete some code and remove some dependencies.

  • move implementations to the root

    a step towards making the area for contribution front-and-center in the repo.

  • use multiple docker files to reduce repetition

    you can pass -f multiple times and compose will merge the configs. makes the compose configs in each implementation very small.

  • use execa for shelling out to docker-compose

    async-await-friendly library.

  • use fetch() for checking the gateway health

    using a remotegraphqldatasource doesn't make sense here. almost added apollo client, but it's not used for graphql requests yet!

  • add retries for checking the product service health

    federation-jvm takes a moment to start up, so i added a cheap loop.

  • build the federation-jvm implementation in the docker image

    the existing docker file assumed that the jar was prebuilt, so it didn't work at all on my machine. there are opportunities to optimize this as it's a pretty large image.

  • format most things with prettier

    happens by default when i save files.

Edit

I ended up accidentally upgrading @apollo/gateway and the RemoteGraphQLDataSource#process API changed and wasn't possible to call. I swapped it out with a fetch call — I'm pretty sure that'll be the right decision in the long run as the subgraph contract will always be an HTTP call.

* made the subgraphs independent packages
* remove typescript from subgraphs and apollo-server implementation
* use a prebuilt gateway container image
* move implementations to the root
* use multiple docker files to reduce repetition
* use execa for shelling out to docker-compose
* use fetch() for checking the gateway health
* add retries for checking the product service health
* build the federation-jvm implementation in the docker image
* format most things with prettier
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.

None yet

2 participants