API
===
Requirements
------------
RAM: 256 Mb (130 Mb is used by Argon)
Get started
-----------
.. code-block:: bash
make all
Go to http://localhost:9090
Docker images
-------------
:code:`https://registry.gitlab.com/pashinin.com/api:master` - rebuilds on each commit
:code:`https://registry.gitlab.com/pashinin.com/api:stable` - rebuilds on tags and stable branch changes
DEV username/password to login
------------------------------
Username: :code:`admin@localhost`
Password: :code:`password`
Argon2 of "password": :code:`$argon2id$v=19$m=1024,t=3,p=1$MTIzNDU2YXNk$6zQXmU2m3HdqXF1iof7GP+vOS+ae5o/PVtxOi8aooJE`
Flags
-----
Use :code:`./api -help` to see options.
Environment variables
---------------------
Following environment variables must be set:
:code:`AUTH_SECRET` - used to sign JWT (on login). Empty by default. API
will not start if it is empty. Automatically set to "123" while in
development mode (in Makefile).
:code:`TARANTOOL_USER_NAME`
:code:`TARANTOOL_USER_PASSWORD`
Messages
--------
Each tree can send an receive messages (using NATS) which are then
passed through a websocket connection to the browser.
Messages path:
:code:`Endpoint -> NATS -> subscription (websocket.go) -> websocket`
Subscription to NATS channel (inside API) exists only within established
websocket connection.
Health checks
-------------
You can view Health checks under :code:`/healthcheck`. Code is written
in router.go.
code 200 - everything is ok
code 500 - not ok
What is checked:
#. captchaStorage (created and connected)
#. JDI health
..
Metrics
-------
Prometheus metrics ix exported at :code:`/metrics`.