This a simplest application based on Tarantool Cartridge.
To build application and setup topology:
cartridge build
cartridge start -d
cartridge replicasets setup --bootstrap-vshard
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 one simple role, app.roles.custom
.
It exposes /hello
and /metrics
endpoints:
curl localhost:8081/hello
curl localhost:8081/metrics
Also, Cartridge roles are registered
(vshard-storage
, vshard-router
and metrics
).
You can add your own role, but don't forget to register in using
cartridge.cfg
call.
Configuration of instances that can be used to start application
locally is places in instances.yml.
It is used by cartridge start
.
Topology configuration is described in replicasets.yml
.
It is used by cartridge replicasets setup
.
Simple unit and integration tests are placed in test
directory.
First, we need to install test dependencies:
./deps.sh
Then, run linter:
.rocks/bin/luacheck .
Now we can run tests:
cartridge stop # to prevent "address already in use" error
.rocks/bin/luatest -v
Application has admin function probe
configured.
You can use it to probe instances:
cartridge start -d # if you've stopped instances
cartridge admin probe \
--name cartridge-and-vshard \
--run-dir ./tmp/run \
--uri localhost:3302