Comment on page
TaaS GraphQL in Docker
Requirements
- Docker
- Tezos Node with enabled RPC endpoint supporting read-only calls
Ready-to-use docker image is available from Docker Hub here:
Example of the
docker run
command- exposing port 3000
Do not forget to change the Tezos:NodeUrl based on your configuration!
docker run --rm -it -p 3000:3000 \
--env TEZOS_NODE="https://api.tezos.org.ua" \
tezoslive/taas-graphql
By providing the following ENV variables you can override default configuration.
docker run --rm -it -p 3000:3000 \
--env PORT="3000" \
--env TEZOS_NODE="https://api.tezos.org.ua" \
--env MAX_BLOCKS="5" \
--env GRAPHQL_ENABLE_PLAYGROUND="true" \
--env GRAPHQL_ENABLE_INTROSPECTION="true" \
--env ENABLE_API_KEY="true" \
--env API_KEY="random!@#123String" \
tezoslive/taas-graphql
PORT
configuration for the port on which NodeJS server listens. Default is3000
.MAX_BLOCKS
configuration for the maximum number of blocks that can be fetched usingblocks
GraphQL query. Default is5
.GRAPHQL_ENABLE_PLAYGROUND
configuration for the GraphQL playground. Default istrue
. It is recommend as best practice to disable this in production environment by Apollo.GRAPHQL_ENABLE_INTROSPECTION
configuration for the GraphQL introspection. Default istrue
. It is recommend as best practice to disable this in production environment by Apollo.ENABLE_API_KEY
if enabled API Key is required with each request. API key needs to be provided in theX-TaaS-Key
header. Default isfalse
.API_KEY
configures the API key value. There is no default value.
If you have used default port number (3000) and exposed the port using
docker run
command mentioned above, you should be able to access the following URL in the browser (with enabled GRAPHQL_ENABLE_PLAYGROUND
). http://127.0.0.1:3000/graphql
127.0.0.1
Your localhost running Docker
You can take a look at the schema in the GraphQL playground or on the link below.
If you need a caching layer between your GraphQL Docker container and your Tezos Node, you can use TezProxy.
For a simple use case you can enable single API key directly on the TaaS GraphQL cointainer with
ENABLE_API_KEY
API_KEY
If you need more complex solution, like JWT token authentication, rate limiting (throttling) or load balancing please take a look at the following resources.
One possible scenario if you opt out to have TaaS deployed on VMs or dedicated servers could be to have HAProxy load balancer configure with JWT authentication running in from of the TaaS docker containers.
There are multiple options in case you will opt out to host your TaaS GraphQL stack in the cloud running in the serverless mode (AWS Lambda, Azure Functions, Cloudflare Workers, etc.) and the best solution will depend on your specific cloud provider.