This Example shows simple and quite easy way of howto use set of modules in application:
- Tarantool GraphQLIDE 0.0.21+
- Tarantool GraphQLAPI 0.0.9+
- Tarantool GraphQLAPI Helpers 0.0.9+ - this particular module available only in Tarantool Enterprise SDK bundle
To build application, start it and setup topology:
# build application
cartridge build
# start all instances including stateboard
cartridge start -d
# configure replicasets and bootstrap vshard
cartridge replicasets setup --bootstrap-vshard
# configure failover
cartridge failover setup --file failover.yml
or use bash-scripts:
# install dependencies
./deps.sh
# build and start application
./scripts/start.sh
# bootstrap cluster and failover
./scripts/bootstrap.sh
Now you can visit http://localhost:8081 and see your application's Admin Web UI.
Note, that application stateboard is always started by default.
See .cartridge.yml
file to change this behavior.
Application entry point is init.lua
file.
It configures Cartridge, initializes admin functions and exposes metrics endpoints.
Before requiring cartridge
module package_compat.cfg()
is called.
It configures package search path to correctly start application on production
(e.g. using systemd
).
Application has two simple roles:
Both api
and storage
roles exposes /metrics
endpoints:
curl localhost:8081/metrics
Custom user api
role uses the following Cartridge roles:
- cartridge.roles.vshard-router
- cartridge.roles.crud-router
- cartridge.roles.graphqlide
- cartridge.roles.graphqlapi
Custom user storage
role uses the following roles:
- cartridge.roles.vshard-storage
- cartridge.roles.crud-storage
After starting application on router
- http://localhost:8081 instance GraphQL IDE will be available:
The following schemes are available in this demo application:
Data
- CRUD GraphQL API generated based on the current cluster data schema;Spaces
- a set of queries and mutations to manipulate spaces.