[Iteration 1] Zoekt Indexer: Implement heartbeat logic
Problem to solve
This is a first step of implementing this sharding and replication proposal
Proposal
We are going to add to the indexer:
New arguments self_url
, gitlab_url
, secret_path
and node_name
.
-
node_name
is going to have a default value ofhostname
, so we don't need to always set it -
uuid
will be generated if not exists and saved to a file in the index directory (this is needed to understand when the shard needs to be fully reinitialized. For example, when you nuke the node or lose the disk)
Payload
A timer with a lock that is going to send a POST request to gitlab_url
with:
{
"self_url": ...,
"uuid": ...,
"disk_usage": {
"free": ...,
"used": ...,
"all": ...,
},
"metadata": {
"name": ...
}
}
Authentication
We'll need to mount a secret as a file, generate JWT, and send it as the Gitlab-Shell-Api-Request
header. (https://docs.gitlab.com/ee/development/internal_api/)
Edited by Dmitry Gruzd