r/graphql • • Feb 28 '20

please help me understand deployment.

Hello.

Graphql seems pretty cool.

I am having trouble understanding how to, and how to google the proper way to deploy a graphql api.

What I used to do is a) create db, b) create a flask app, (sever to localhost), then c) use gunicorn to serve it to the web.

Currently I am able to build https://github.com/grand-stack/grand-stack-starter I added new nodes, added new components... but everything is connected via localhost.

I want to make an ec2, and serve this to a normal address like: x.x.x.x:y/graql
I need to do this, so I can share one graph among multiple developers... its time to go from POC to group play time.

I have seen stuff about using lambda... but lambda doesnt have a public end point...
I have seen a lot of stuff with localhost... but that doesnt help me..

I have seen stuff with other cloud providers... but realistically we already have an aws account amongst my hobby group so it would be ideal to not branch into other cloud providers unless a very good reason can be made.

tldr: how do we make public endpoints?

Thanks for your help.

0 Upvotes

11 comments sorted by

4

u/prewk Feb 28 '20

FYI: this hasn't anything to do with GraphQL. Your question is basically "how do I run a server on AWS?"

1

u/[deleted] Feb 28 '20

Maybe I am phrasing the problem wrong.
Do I run a rest api with a post route, and then take that request and pass that to the graphql client?

1

u/prewk Feb 28 '20

With "rest api" do you mean "a POST route on /graphql"? If so - yes, that would probably be a sensible default used by any graphql tools you set up in the back-end for your framework (I'm not familiar with what you're using).

Dunno what you mean with passing something to the client, if you mean "tell the client where the server is" then yes :)

Basically - you have a web server taking requests via POST on `/graphql` and then you have code that parses those requests and talks to the database and does stuff. GraphQL is just a language, it's not a server or a client etc.

2

u/tr14l Feb 28 '20

You use API Gateway in combination with lambda to give it an exposed endpoint. Remote into an EC2, run the node script for the server. Go to your settings and make sure you have it exposed to outside traffic for that port number. Get the address from you EC2 and go to it. This is the simplest way to do it. You need AWS docs, not help with graphql

1

u/[deleted] Feb 28 '20

Ok. I need help with publically serving the graphql. I thought it had some logical relationship; did not mean to spam.

I needed help understanding the parts to make an api in order to develop with the graphql.

1

u/tr14l Feb 28 '20

Look at the Apollo documentation. They have step by step setup instructions

2

u/[deleted] Feb 29 '20

I think I was using the wrong term. I was searching make a public endpoint I think i should have been using keywords public port

1

u/[deleted] Feb 28 '20

basically are you saying I make a public post rest route, and then connect that with the graphql client?

1

u/tr14l Feb 28 '20

Yep. It's not REST. It's just an exposed route the same as you would for a rest endpoint

2

u/opaz Feb 28 '20

I believe what you’re looking for is API Gateway

0

u/archivedsofa Feb 28 '20

Maybe use Heroku instead: https://www.heroku.com/

It's more expensive but it solve those things for you. You can deploy from Github for example.