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

Running graphQL server on a different port (microservice) #172

Closed
mairh opened this issue May 8, 2017 · 6 comments
Closed

Running graphQL server on a different port (microservice) #172

mairh opened this issue May 8, 2017 · 6 comments

Comments

@mairh
Copy link
Member

mairh commented May 8, 2017

First of all thanks for developing and maintaining the starter kit. I would like to understand how can I run the GraphQL server as a microservice.

For e.g, I have to develop both web and mobile app using react and react native. However, I would like the web and mobile app to use the same GraphQL server available over https.

Do you have any pointers on how to achieve that? What I am trying to achieve at the end is what grahpcool guys are doing (you call the GraphQL server api endpoint in your app), which is not tightly coupled with the platform. So I can use the same GraphQL server on my web and mobile app.

@larixer
Copy link
Member

larixer commented May 8, 2017

To run GraphQL server produced by this starter kit simply set PORT=zzzz environment variable before running backend process. You can have multiple backend processes running on the same machine this way. We haven't explored the best way to implement microservices with this starter kit yet, but we have already fully decoupled features from one another, both client-side:
https://github.com/sysgears/apollo-fullstack-starter-kit/blob/master/src/client/modules/connector.js
https://github.com/sysgears/apollo-fullstack-starter-kit/blob/master/src/client/modules/index.js
and server-side:
https://github.com/sysgears/apollo-fullstack-starter-kit/blob/master/src/server/modules/connector.js
https://github.com/sysgears/apollo-fullstack-starter-kit/blob/master/src/server/modules/index.js
So the way to go with microservices would be to continue and move out these decoupled features into separate running node processes. At the moment we are still busy with other tasks for this starter kit. But if you would like to work on this and submit pull request - that would be great and we will try to help from our side.

@mairh
Copy link
Member Author

mairh commented May 8, 2017

Thanks for your reply. I will try to create a PR when I reach the stage of my project when I have to deploy the server on a different node process.

@mairh mairh closed this as completed May 8, 2017
@larixer
Copy link
Member

larixer commented May 8, 2017

Sounds good, thank you @mairh !

@strefethen
Copy link

@Vlasenko curious if this ever evolved beyond the discussion above. I too an interested in leveraging microservices and would like to be able to run the graphql server on a separate machine. I don't see anything in the docs mentioning it so I'm guessing the likelihood is that it didn't evolve.

@larixer
Copy link
Member

larixer commented Jun 15, 2019

@strefethen At the time this discussion started, it was pretty difficult to make microservice based arch with GraphQL. Though the kit has been modular always and it was one step away from microservice-based arch if GraphQL and Apollo allowed that. We have never bothered because we saw that GraphQL is not ready itself. Two weeks ago Apollo Federation has been released:
https://blog.apollographql.com/apollo-federation-f260cf525d21
which promises to solve microservice concerns for GraphQL.And I have created issue:
#1095
that states Apollo Federation should be investigated. So anyone is welcome to investigate using the kit with Apollo Federation and share his results / open pull request with Apollo Federation integration.

@strefethen
Copy link

@Vlasenko thanks very much for the link and dialog on this, much appreciated.

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

No branches or pull requests

3 participants